We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Pagination for newly created module

Development and Programming

magneticpoint's avatar
magneticpoint
1 posts
14 years ago
magneticpoint's avatar magneticpoint

I have a small problem with adding pagination. I wrote my own dedicated module for news and i want to add a pagination on news list site. On template i have:

{exp:news:show_list} html here with news list {exp:news:show_list}

and next i need a paginations controls. Function “show_list” returns an array with all entries for module.

[…] foreach ($query->result_array() as $id => $row) { $variables[$id] = array( ‘news_id’ => $row[‘news_id’], ‘added_date’ => $row[‘added_date’], ‘title’ => $row[‘title’], ‘short_content’ => $row[‘short_content’], ‘url’ => ”, //TODO: create url ‘hide_date’ => $row[‘is_date_hidden’] ); if($row[‘image’]) { $variables[$id][‘image’] = BASE_URL.’system/public/news/’.$row[‘image’]; $file = explode(‘.’, $row[‘image’]); $fileExt = array_pop( $file ); $variables[$id][‘image_thumb’] = BASE_URL.’system/public/news/’.implode(‘.’, $file).’_thumb.’.$fileExt; } } $output = $this->EE->TMPL->parse_variables($this->EE->TMPL->tagdata, $variables); return $output;

So, how i can add a pagination for it? Should i work with template or with PHP function?

Moved to Development and Programming by Moderator

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
14 years ago
Sue Crocker's avatar Sue Crocker

Hi, magneticpoint.

This would be more on topic in the Developer forum, moving there for additional community support.

       
the3mus1can's avatar
the3mus1can
426 posts
14 years ago
the3mus1can's avatar the3mus1can

You can add pagination inside of your module.

Here is a little push in the right direction: http://ellislab.com/codeigniter/user-guide/libraries/pagination.html

Also take a look at create_pagination method in the Channel module file (mod.channel.php).

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.