Link to home
Start Free TrialLog in
Avatar of jedblack
jedblack

asked on

Best Practice: php-inside-html ,OR, html-inside-php ?

Hi All,

not so much a technical question, more a how is this best-done question.

I'm building db driven site(first one) -- I understand the concepts fairly well... however i'm starting to use jquery,ajax,js,css more and more...

is it better practice/standards to create the web page in pure html and use php through via init tags(ie. <?php ?>

OR

build pages with pure php, and use php to create any/all markup language (ie. print "<h3> html element </h3>; )

Currently I have a header.inc and footer.inc that is pure html (they contain the CSS and JS included)

here is an excerpt of one of my pages..

....................


$pager .= "
<div id='pager' class=pager>
      <form>
            <img src='styles/first.png' class='first'/>
            <img src='styles/prev.png' class='prev'/>
            <input type='text' class='pagedisplay'/>
            <img src='styles/next.png' class='next'/>
            <img src='styles/last.png' class='last'/>
            <select class='pagesize'>
                  <option selected='selected'  value='10'>10</option>

                  <option value='20'>20</option>
                  <option value='30'>30</option>
                  <option  value='40'>40</option>
            </select>
      </form>
</div>
<p>
<p>
";



// here its printing out the header, then the fully concactinated $body, and the Jquery markup tblsorter, tblpager content that was dynamically generated from above, then printing the footer.

require('header.inc');
print $tblsorter;
print $tblpager;
print $body;
print $table;
print $pager;
require('footer.inc');
?>
-------------------
ASKER CERTIFIED SOLUTION
Avatar of gamebits
gamebits
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jedblack
jedblack

ASKER

@gr8gonzo,

wow, i did not know that existed in PHP -- I know knew that to be a BASH-ism construct, very cool indeed and will def. use that one...thanks


I split up the points since all three of you had some good comments on the thought....thanks for the input guys(gals)