I'm writing a search engine and I'm trying to figure out the best way to display the results (5 per page).
I'm newer to dynamic web development, so bear with me. Currently, the processing is done server side in PHP, and the results are echoed into proper format using a large block of HTML code. While this works just fine, it's not the easiest to maintain if I decide to change the HTML, and quite frankly, it looks messy. Like this, but more involved in the HTML:
while($rows)
echo "<div class='someClass'>".$rows['name']."[...]</div>"
Other than cleaning things up, what, if any, are the gains from switching to a jQuery template that uses data from an AJAX call? Would it be best to keep things in PHP to hide all processing from the user (and not expose any calls to .php files)?
You can use php <<<EOF
(heredoc):
<?php
$test = "something";
$str = <<<EOF
<p>Hello</p>
<p>$test</p>
EOF;
echo $str;
?>
This will allow you to have a large block of easily readable HTML in the PHP. I wouldn't use AJAX calls with JQuery.