I'm hoping I can get a definite answer on this. I will try and explain this as best I can.
I have a main template file that contains everything I want. In a small area within this template, I want to echo the view that is associated with the link that the user clicks on. This is not a problem so far however, when I have to use a loop data it is not so easy anymore.
If I have this as my template:
table
tr
td><?php echo $myContent; ?></td
/tr
/table
You can clearly see how I would be able to echo the values of the variable. Now, suppose that I wanted to show the user something that required multiple rows of data. I w开发者_开发知识库ould then have to use a loop. So, you see, it depends on the content that I want to display that determines what construct to use within the HTML.
Can someone please help me to figure this out? I'm sure this is just me not correctly understanding how this should be done.
Thanks
Have a HTML files with custom tags of your own.
say template.html:
<div><$content$></div>
when processing the output, you take the contents of template.html and parse it:
$replace = array();
$replace['<$content$>'] = $pagecontents;
$template = file_get_contents('template.html');
$output = str_replace(array_keys($replace),$replace,$template);
Adapted from http://code.google.com/p/samstyle-php-framework/.
精彩评论