Mmmm.. sorry, that should've been "am I right to thinK the element
creates a new instance of the helpers?!"

... so after a bit more investigation, it seems to be the case. Now
what I did to fix it... if anyone wonders is adding an init() function
to the pagination helper, and making sure the helper was initialised
before any other function would proceed...


code: (goes in the pagination helper)

var $initialized = false;

function init() {
        if(!$this->initialized) {
                if ( !empty($this->view->_viewVars['paging']) ) {
                        $this->setPaging($this->view->_viewVars['paging']);
                }
                $this->initialized = true;
        }
}

then in every other function of the helper, I added $this->init();

Hope this helps anyone else! Anyhow... if somebody could confirm how
right or wrong I am.. I'd appreciate!

Cheers,

Seb.

On Dec 13, 5:06 pm, "Seb" <[EMAIL PROTECTED]> wrote:
> Mmmmm...
>
> The pagination helper requires to be initialised... with
> $pagination->setPaging($paging);
>
> Interesting fact... if I duplicate that initialisation to add it to the
> element... it works. In other words... am I right to thing the element
> creates a new instance of the helpers?!
>
> I might drill down the pagination component and helper tomorrow morning
> to see if I could make that a bit more seemless... surely there is a
> way...
>
> still.. any thoughts welcome!
>
> Seb.
>
> On Dec 13, 4:22 pm, "Seb" <[EMAIL PROTECTED]> wrote:
>
> > Hi everyone...
>
> > I've been pulling my hair out for the past 2 hours and I can't see
> > what's wrong; am I missing something... or am I trying to do the
> > impossible.. please... if you know... tell me!!
>
> > I use the Pagination helper, which works like a charm in any view. I
> > also use the html and the form helpers which also, you guessed it, work
> > like a cham in any view.
>
> > Now... there is this piece of html I'd like to move in an element. When
> > I do, the html and form helpers work like a charm still, whereas the
> > pagination doesn't.
>
> > I debugged it pretty deep only to find out what doesn't make it though
> > is the helper config...
>
> > am I going crazy??!
>
> > some code?
>
> > these, from within the view, work perfect;
> > <?php echo $pagination->pageNumbers(); ?>
> > <?php echo $html->submit('Create');?>
>
> > whereas from the element, this returns only the submit(Create) button.
> > <?php echo $pagination->pageNumbers(); ?>
> > <?php echo $html->submit('Create');?>
>
> > I call the element like this;
> > echo $this->renderElement('index' /*no parameters*/ ) );
>
> > Both of the helpers are defined in the app_controler.php
>
> > again.. am I going crazy?!!
> 
> > Cheers for any input!
> 
> > SEb.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Cake PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to