FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!


A quick PHP Question! You know the answer! Answer ASAP .





Kurosaki-Ichigo
Just a simple question that everyone who works with php probally knows.

Can i put html code into a php file ? And if i do will it work ?
mariohs
Sure. If you just rename your .html to .php, and if your server supports php (of course), it'll display without any problem.
Stubru Freak
echo "<strong>Html code</strong>";
TomS
Kurosaki-Ichigo wrote:
Just a simple question that everyone who works with php probally knows.

Can i put html code into a php file ? And if i do will it work ?



Code:
<?php
// Your phpcode
?>

<b>This is normal htmlcode</b>

<?php
// Some other phpcode
?>


With Stubru Freak's solution the htmlcode will be shown on the page. Formatting tags or link- and imagetags won't work. It's just text.

Ofcourse the file must be .php
Stubru Freak
TomS wrote:
Kurosaki-Ichigo wrote:
Just a simple question that everyone who works with php probally knows.

Can i put html code into a php file ? And if i do will it work ?



Code:
<?php
// Your phpcode
?>

<b>This is normal htmlcode</b>

<?php
// Some other phpcode
?>


With Stubru Freak's solution the htmlcode will be shown on the page. Formatting tags or link- and imagetags won't work. It's just text.

Ofcourse the file must be .php


Not true, your and my solution have exactly the same result.
Kurosaki-Ichigo
Look. I have a script and it has a Download.php . Now i want to put a google adsense script for example inside it. How do i do this ?
X3 Talk
As the French say, c'est trés facile. Or as the English say, it is very easy.

When you have your php document, it doesn't even have to have PHP in it and it still works.

You don't want to have everything all done in PHP when you don't need to.

An example of how to have two in one is this.
This page is called download.php
Code:

<HTML>
<HEAD>
<title>My Download Site</title>
</HEAD>
<BODY>
<img src="header.jpg">
<h1><font face="Arial">Welcome to the site of downloads</font></h1>
<h3><i>The place where the fun doesn't stop until our bandwidth does.</i></h3>
INSERT YOUR GOOGLE SCRIPT HERE
<?php
$var = $_GET['download'];
echo '
<script language='javascript'>
download(' . $var . ');
</script>
';
?>
</BODY>
</HTML>


So as you can see anything outside the <?php tags is just printed like normal HTML code, but when you want to add PHP power, make sure the filename is *.php and go for it.
*** NOTE: This is made up code.
dz9c
yea html code can go into php
Kurosaki-Ichigo
Thanks. One more question, What would happen if the html went inside the PHP codes ?
TomS
@Stubru Freak: Ähm. Jap. But why the <strong> then?
Stubru Freak
TomS wrote:
@Stubru Freak: Ähm. Jap. But why the <strong> then?


To show the text bold.
raymonbunt
Yes you can like,
<?php
echo 'hello world my new site' //and if you want a line below it you use <br> so: instead of the echo <==
you use <?php
echo 'hello world <br> My new site';
?>
Related topics
Help with a quick PHP mod for PHPBB.
php question
JSP and PHP Question
PHP Question
PHP Question
Database on Frihost site
a grouping question?
PHP question
Quick Cpanel Question
PHP question, $_SESSION[] gets changes to by $_POST var
PHP Question - Solved
MySQL and PHP Question
PHP question about passing variables (noob)
How will run question answer website?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.