Results 1 to 8 of 8
Thread: HTML Code in PHP
-
18-10-2006, 08:49 PM #1
HTML Code in PHP
How 2 add HTML Code In PHP Webpage
Friends, Plzzz Visit my website
http://www.gursimran.c-o.in/
add ur link to my Database and signup it is Free!
Plzzz do not forget click on Advertisements, coz i need $$
Cheers,
Gursimran.
-
18-10-2006, 09:06 PM #2
Re: HTML Code in PHP
Thats easy! U have 2 options
Let me give u an example with <a href...> thing!
1. : Parting the Php block
2. : In one go!Code:<?php { //code...php block initiated ?> <a href="mediator_is_great.htm">meds</a> <?php //code php block completed } ?>
Like wise to mark something bold we haveCode:<?php $link="mediator_is_great.html"; $name="meds"; echo "<a href=\"$link\">$name</a>"; ?>
Ur Problem Solved!Code:<?php echo "<b>mediator is cool</b>"; ?>
Last edited by mediator; 18-10-2006 at 09:12 PM.
Bad Bad server.....No candy for u!
-
18-10-2006, 09:32 PM #3Alpha Geek
- Join Date
- Aug 2006
- Posts
- 570
Re: HTML Code in PHP
Just use it after any php code end (IMO), google further
-
18-10-2006, 09:33 PM #4
Re: HTML Code in PHP
Mediator has given the correct solution, so no need to google!
-
18-10-2006, 09:37 PM #5
Re: HTML Code in PHP
Although mediator has explained clearly. Let me add my two cents
Server will treat everything outside <?php ?> tags as html.
If you want to add any html tag in php script then use eithter echo or print command like
<?php
print "<h1>Hello World</h1>";
?>Windows and linux hosting at http://www.ewebguru.com
Get $50 per blog post PM me for details.
-
19-10-2006, 11:34 AM #6
Re: HTML Code in PHP
My further 1 cent in addition to ahref's 2 cents

Its not the server that treats PHP, its the PHP interpreter that does the job!! Here's the over-simplified sequence.- A browser sends a request for a file to the server.
- If its .php file, Apache calls in PHP interpreter for help and hands over the file to it.
- PHP interpreter goes thru the file and processes everything thats within <?php and ?> tags. However, it doesn't do anything to the code thats outside those tags.
- Apache once again takes over the output give by the interpreter and hands it over to the browser which is dumb enough to understand only HTML and Javascript.
- If the browser is IE, it will render even a W3 standard compliant page erroneously. If the browser is not IE, it is more likely that the page is rendered correctly

I would also like to point out that PHP can be used anywhere on the page whether it be <head> or <title> or whatever!! For example, based on certain criterion, it can even me made to select a differnt external CSS files or change the title of the page. Here's a small simple example.
So start thinking a little differently. You can use break-away from static code anywhere with just the <?php and ?> tags. All that you need is .php extension to the file.PHP Code:<html>
<head>
<title>
<?php
$myid = $_GET["identity"];
if ($myid == "one")
print("This is the my favourite page tite");
else
print("This is the default page title");
?>
</title>
</head>
<body>
</body>
</html>Last edited by tuxfan; 19-10-2006 at 11:42 AM.
:: Free hosting and free domain names available in special cases. Conditions apply ::
-
19-10-2006, 11:37 AM #7
Re: HTML Code in PHP
Guys, its better if you use PHP BBCode Tag..
PHP Code:<html>
<body>
<b>
<?php
$a=1;
$b=2;
if($a==$b) {
echo "Bull5hit!";
} else {
die("Yay!");
}
?>
</b>
</body>
</html>[xubz] ● http://xubz.com/
[steam_id] ● http://steamcommunity.com/id/xubz
-
19-10-2006, 11:42 AM #8
Re: HTML Code in PHP
At first, I didn't understand what you are saying! But then found out that you are right. You are talking about the php tag for posting in the forum. The tag makes the PHP code more readable on the forum
Originally Posted by subbzzz
and its nothing to do with the php tag in HTML pages.
:: Free hosting and free domain names available in special cases. Conditions apply ::
Similar Threads
-
Html open in new tab code
By mohityadavx in forum ProgrammingReplies: 2Last Post: 06-11-2011, 05:34 PM -
how can i edit the html code for the mainpage in my wordpress.com blog?
By shankar_ganesh in forum Software Q&AReplies: 2Last Post: 23-12-2006, 07:43 PM -
HTML Code problem
By hailgautam in forum QnA (read only)Replies: 4Last Post: 24-10-2006, 02:21 PM -
HTML code is Off ! ! !
By ax3 in forum QnA (read only)Replies: 5Last Post: 18-10-2006, 10:30 AM -
Html code for forum
By himtuna in forum Internet & WWWReplies: 7Last Post: 19-06-2006, 05:04 PM



LinkBack URL
About LinkBacks

Bookmarks