Jump to content

HTML IN PHP


pranshu82202

Recommended Posts

Same way as HTML.  Depends on whether you use style sheets or what.  If your page has a .php extension:

 

<div style="font-family: serif; font-size: medium"><?php echo "Hello World"; ?></div>

 

Or:

 

echo '<div style="font-family: serif; font-size: medium">Hello World</div>';

Link to comment
Share on other sites

never seen html tag inside php tag, most like it's the other way around... maybe give just little bit more explaination of what you're trying to do... will be happy to help :confused:

you can most certainly print html tags with PHP.....

Link to comment
Share on other sites

never seen html tag inside php tag, most like it's the other way around... maybe give just little bit more explaination of what you're trying to do... will be happy to help :confused:

Look at AbraCadaver's post.

Link to comment
Share on other sites

hehe, which part of AbraCadaver's code is the HTML Tag INSIDE the PHP Tag? :o I was talking about this

<?php <html>blabla</html  ?>

 

the part where he echos HTML

 

echo '<div style="font-family: serif; font-size: medium">Hello World</div>';

 

you cannot have HTML in php tags like you have shown, must be echoed/printed, must be parsed as a string

Link to comment
Share on other sites

hehe, did some research, I opened my eyes, then I saw!!! maybe I haven't code enough to see the efficiency or the effectiveness of coding that way...

but sure pranshu82202 you can put the html coding in the the ECHO... works just find... I just really seen...  :P

Link to comment
Share on other sites

IrOnMaSk, there really is no effectiveness or efficiency. Ideally you should separate the business logic from view logic. On the view side is where the html etc would be placed, without requiring to echo out any html code. This would keep your business logic clean and make it a ton easier for changes in the future, IE you just have to change the HTML side of things instead of tinkering with the actual code.

 

That is just my 2cents however. But yes, you can echo any html tag from within PHP.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.