Jump to content

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

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.