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
https://forums.phpfreaks.com/topic/241728-html-in-php/#findComment-1241506
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
https://forums.phpfreaks.com/topic/241728-html-in-php/#findComment-1241841
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
https://forums.phpfreaks.com/topic/241728-html-in-php/#findComment-1241869
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.