For one of my projects, I needed a simple pagination module. The requirements were pretty standard:
- The first and last page should always be displayed
- There should always be the same number of pages displayed for consistency (+- 1)
- There should be maximum code reuse
- It should be easily configurable
- The current page should stand out
So here is my answer to this problem. Even if you’re not familiar with coldfusion, you should be able to understand the code. (just mentally replace <cfif> by “if”,<cfloop> by “for”, etc.)
[cfm]
1
1
#beforeSeparator#
#i#
#i#
#afterSeparator#
#lastPage#
#lastPage#
[/cfm]
P.S.: if you find your life boring and lacking adventure, try getting ColdFusion code to display right in WordPress. I promise it will get your adrenaline levels up in no time.
nice tutorial thanks
————————
http://www.pakbridge.com
Thanks for you support !
When I have time I will redo this code snippet better, maybe using javascript or php instead of coldfusion, and providing illustrated examples along the way.
Thanx for the code. Now i am starting to feel how nice coldfusion is.
Have to revisit this once again. Just wondering where the 1st and last pages are coming from
In this script, I assume the first page is simply “1”.
The “last page” variable has to be defined before my code. Usually this variable will depend on outside factors, like your database’s content, or search results number, etc.
Bad code, there are some variable that should be set before, and it needs some cfoutput…
Good tutorial however…
Feel free to post your solution. I haven’t done any coldfusion for the last year, so I kinda forgot the syntax..
Hold the line, please Kds Sex
79120