0

I'm using the EXP:QUERY tag to get the count of a channel. And I am basically trying to use this for page pagination, and its a custom pagination because of the type of template I'm building.

And I am trying to use the count I receive and use some math to get a page count based on the number of results I have on each page. 5 results per page. So below is what I have.

<?php $foo = {count} / 5; ?>
{if segment_2 <= $foo}
    <li><a class="button next" href="<? $week_count = {segment_2} + 1; echo "/page/" . $week_count; ?>">Next</a></li>
{/if}

I am trying to use the PHP variable $foo within the expressionengine if statement but I can't, what is a better way to do this? Without having to write out it all in PHP.

1

I did the math within the SQL to receive my results.

EDIT: The solution.

SELECT COUNT(entry_id) / 25 AS count FROM exp_channel_data WHERE channel_id = 97
| improve this answer | |
  • Could you edit to provide more details about your solution? – Jeremy Gimbel Oct 14 '13 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.