|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#16
|
|||
|
|||
|
RE: help : looping for template
I don't see where it says to actually use the block though?
Surly you need to say something like use_block('song_list') or else it wont appear? |
|
#17
|
|||||
|
|||||
|
RE: help : looping for template
It's in there - where it says $page->replace_block_tags(etc....);
php Code:
|
|
#18
|
||||||||||||||
|
||||||||||||||
|
RE: help : looping for template
After living with this class for a few weeks, I've run into a few issues and have found (as far as I know) solutions, so I thought I'd share the new code here.
I also cleaned up the code a little bit, and added alternating background colors for table rows output in the looped blocks. (I'll explain it at the bottom...) Problems found: PARSE ISSUE If any tag data was a file name - even a file you didn't want parsed, like an image imagefile.jpg, the template engine would attempt to parse the file and it would break. Solved by allowing only files with extension php to be sent to the parse function. REGEX ISSUE Again with file names, but in the template file this time, not in the tags. Any dot (.) in the looping sections in the template file would break the preg_match() function used to pull the parts of the template that would be sent to the block looping function. So if you had a link, like nextpage.php, within the section to be looped, it would break. Changed the regular expression used from ([^.]+) to ([^*]+) and it seems to work now. Here's the new template class file in it's entirety: php Code:
Now for the replace_block_tags additions: It uses this format: php Code:
You can set default bg colors to alternate right here in the class, just replace with the colors you want. To make it not alternate, just call it like before, with the first 2 parameters only: To make it alternate with the default colors, do it with the first 3 parameters: To have it alternate and use custom colors, send it all 5 parameters: php Code:
or php Code:
Hope someone else finds this useful, I'm pretty satisfied with it now, and it's still pretty simple to use. |
|
#19
|
||||||
|
||||||
|
RE: help : looping for template
i know this topic is probably very old.. and i may be bumping it... but, i need help. And any help is apperciated. im using php Code:
modified from php Code:
And |