Tuesday, May 26, 2009

Re: [phpXperts] Re: Codeigniter Pagination help



CodeIgniter has nice buildin pagination system. Please read User Guide. There you get simple example and details.

Anyway Here I found you use
$data = $this->m_search->search($cat_id, $offset);

Please use $data as an array variable like below
$data['result'] = $this->m_search->search($cat_id, $offset);

then pass the $data to your view

In the view page $result variable will available as array. Then you can iterate the result as follows

foreach($result as $row)
{
//Your code
}

Another thing is I guess you try to use smarty templating engine with CodeIgniter. I suggest it will be bulky for your application.

Regards
Abser


On Fri, May 22, 2009 at 1:45 AM, Amzad Hossain <amjad.hossain@gmail.com> wrote:


Here you can find the ajax pagination example of ajax_jquery library. Though it integrates ajax using jquery but the basic idea of using pagination is similar.

I hope this comes helpful.

http://tohin.wordpress.com/2008/10/07/codeigniter-ajax-pagination-exampleguideline/

Mohammad Amzad Hossain
www.jhoroTEK.com
Blog: tohin.wordpress.com



--- In phpexperts@yahoogroups.com, "jewel_1700" <jewel_1700@...> wrote:
>
> another link...
> http://codeigniter.com/user_guide/libraries/pagination.html
>
> --- In phpexperts@yahoogroups.com, Abu Saleh Muhammad Shaon <srabon_iiuc@> wrote:
> >
> > Hi,
> >
> > I need pagination code for codeigniter.
> >
> > My MODEL code Is
> >
> > function search($cat_id, $offset)
> > {
> > $sql = "SELECT * FROM Cat_details WHERE cat_id='".$cat_id ."' LIMIT $offset, 5";
> > //some code
> > retrun result;
> > }
> >
> > My CONTROLLER code Is.
> >
> > function search()
> > {
> > $rarr = $this->uri->segment_array();
> > $cat_id = $rarr[3];
> > $data = array();
> > $offset = 0;
> >
> > $data = $this->m_search->search($cat_id, $offset);
> >
> > $this->my_smarty->my_display('search/search_jobs_by_category.html', $data);
> > }
> >
> > help me please, i have seen user guide already.
> >
> >
> > Best wishes
> > =======
> > Shaon
> > ====================
> > = Web developer, Future Group =
> > ====================
> >
>




--
Nurul Abser
abser-bd.blogspot.com

__._,_.___
Visit phpXperts website at www.phpxperts.net
Recent Activity
Visit Your Group
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Yahoo! Green

Make It Green

Submit ideas to

better our planet

Need traffic?

Drive customers

With search ads

on Yahoo!

.

__,_._,___

No comments: