CodeIgniter Forums

Full Version: Pagination last link redirect?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Tyler Diaz[/eluser]
Hey there CI community, I'm a bit stumped on this one.

Working on a forum script and I want it so when you post on a topic, it will redirect you to view your post. I've done the anchor part such as #post_id to drag you to where your post is, but how do I redirect to the last pagination link on the topic?

Thanks in advance, Tyler.

El Forum

[eluser]jedd[/eluser]
Hi Tyler - did you come up with a solution to this one?

The algorithm seems straightforward enough -- at a guess you'd do count() of the posts, divide it by the number of posts-per-page, round down, and away you go -- but I suspect you wanted to reduce the number of calls to the DB.

El Forum

[eluser]Tyler Diaz[/eluser]
That was my initial solution, kind of a "quick and dirty" feel to it but there seems to be little to none alternative.

Thanks for the helpful reply jedd.