|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||||
|
|||||
|
help : looping for template
based on this tutor
http://codewalkers.com/tutorials/58/1.html (Writing a Template System in PHP by Timothy Boronczyk) and iam trying to implement it like this : php Code:
but when i try to acces the page i am only see one record (from table guestbook) and the other is gone pls any body help me to show all my guestbook content to my template sorry for my bad english thanks, |
|
#2
|
||||
|
||||
|
RE: help : looping for template
The problem is with the loop. The first iteration of the loop relaces the place-holder tags. The second time around the tags have already been replaced, so there will be nothing left to match.
-Tim |
|
#3
|
|||||
|
|||||
|
RE: help : looping for template
after iam try to doing the looping my code is like this :
php Code:
but iam still confused how to handle the replacement tag with variabel that content array |
|
#4
|
||||
|
||||
|
RE: help : looping for template
The class doesn't support looping like this. The place holder tags are replaced after the first run of the loop. There is nothing to replace the 2nd, 3rd, etc. time the loop runs.
-Tim |
|
#5
|
|||
|
|||
|
RE: help : looping for template
thanks,
|
|
#6
|
||||||||
|
||||||||
|
RE: help : looping for template
I have added two methods so this class can handle with blocks/iterations from mysql-queries. But I'm not sure this is the fastest way for replacing the data.
a block would look like this: php Code:
All the code: php Code:
Can anyone examine the code & give me some advise if there are faster solutions? Thanx, BlackSkad |
|
#7
|
|||
|
|||
|
RE: help : looping for template
ive tried using this block code above but i cant figure it?
im doing this; $tp->block('choices'); $tags = array('choices' => $choices); $tp->replace_block_tags('choices',"SELECT * FROM `poll_choices` WHERE `poll_id` = '" . $poll_info['id'] . "'",$count); Am i doing it wrong? |