Forums Sign Up Reply Search Statistics
Fast Template GraFX Software Solutions - Forum / Fast Template /

Conditional Dynamic Templates

 
Author sam
Forums Member
#1 Posted: 22 Oct 2007 00:07:20
Reply 
I want to thank you for FastTemplate, I had been looking for some way to separate my PHP code from the HTML and FastTemplate works wonderfully! It is EXACTLY what the doctor ordered! So that you know, I am using FastTemplate in my software, Photo Parata to driving my kiosk viewing station. The web site is: http://www.photoparata.com

I am working on the page navigation index panel, something like this:

< 5 [6] 7 8 >

The idea is that there are more then 8 pages, you are currently on page 6. What I have done is defined a template that has four different dynamic blocks in it:

1: previous page (the less than)
2: current page (page 6)
3: other page (5, 7, and 8)
4: next page (the greater than)

When displaying the first set of images there is no previous, it would look like this:

1 [2] 3 4 >

And when you get to the final set of pages there is no next:

< [9] 10

The way I have coded the PHP code is like this:

1: defined the template
2: define_dynamic ALL four dynamic templates
3: If the previous page is needed, assign and parse the previous page dynamic template
4: loop through all the current pages and assigning and parsing either the current page or the other page
5: if the next page is needed, assign and parse that dynamic template
6: Parse the template that all the dynamic templates are in.

The results I am getting is exactly what I expect, except I am getting it THREE (3) times!
Author software
Admin
#2 Posted: 22 Oct 2007 08:27:05
Reply 
Please see http://www.grafxsoftware.com/download/cls_paginati on.zip
Already done by us, but feel free to improve it and send it back.
 
Your Reply

» Username  » Password 
Only registered users are allowed to post here. Please enter your login/password details upon posting a message, or sign up first.