I emptied out the element and included it and tried just getting it to
show up with "test" as the content, which worked. I then rewrote the
element line by line starting with 1) HTML 2) Regular PHP 3) PHP using
Cake objects until I got a fully functioning element and never ran
into the problem again. So I have no idea what the problem was.
The other bothersome thing is that I never had to pass any variables
to it or tell it to loadHelpers despite it using both Form and
Paginator. Oh well...Rob
On Apr 28, 10:22 am, rob5408 <[EMAIL PROTECTED]> wrote:
> Thanks Joel, TherenderElementdoes work without passing anything,
> thats the strange part. In 1.1 I was used to passing in variables but
> with this I didn't and it worked, but only when paired with the code
> that was present inside the element as well (again making the desired
> output render twice).
>
> Also, the paginator is a Helper, so wouldn't passing it to the element
> work by setting the third param ofrenderElement(loadHelpers) to
> true?
>
> Thanks again! rob
>
> On Apr 25, 5:55 pm, Joel Perras <[EMAIL PROTECTED]> wrote:
>
> > You need to pass the data that you want to use in the element:
> > $this->renderElement('browser_toolbar', $data_to_be_passed);
>
> > In your case, it would be the $paginator object.
>
> > -J.
>
> > On Apr 25, 5:38 pm, rob5408 <[EMAIL PROTECTED]> wrote:
>
> > > Sorry, most recent cake 1.2
>
> > > On Apr 25, 5:25 pm, rob5408 <[EMAIL PROTECTED]> wrote:
>
> > > > I have a block of html/php i need to show twice on the page, so i
> > > > thought i'd put it in an element. The content of the element is...
>
> > > > <div class="toolbar">
> > > > <table cellpadding="0" cellspacing="5px" border="0">
> > > > <tr>
> > > > <td><a href="#">< Prev</a> | <a href="#">Next ></a></
> > > > td>
>
> > > > <td><?php echo $paginator->counter(array('format' => __('Displaying
> > > > %start%-%end% of %count%', true))); ?></td>
>
> > > > <td>Jump to page
> > > > <?php
> > > > $pages = range(0, $paginator->params['paging']['Photo']
> > > > ['pageCount']); unset($pages[0]);
> > > > echo $form->input('page_selector', array('div' => '', 'label'
> > > > => '',
> > > > 'options' => $pages));
> > > > ?>
> > > > <input type="submit" name="go_to_page" id="go_to_page" value="Go" />
> > > > </td>
>
> > > > <td><a href="#">Select All</a> | <a href="#">Select None</a></td>
> > > > <td><input name="unpublish_records" type="button" value="Unpublish
> > > > Selected" /> <input name="publish_records" type="button"
> > > > value="Publish Selected" /></td>
> > > > </tr>
> > > > </table>
> > > > </div><!-- /toolbar -->
>
> > > > AND I display it with this in my view...
>
> > > > <?php echo $this->renderElement('browser_toolbar'); ?>
>
> > > > However, it will only show up if i have both therenderElementline
> > > > ALONG with the element code, like this
>
> > > > <?php echo $this->renderElement('browser_toolbar'); ?>
> > > > <div class="toolbar">
> > > > <table cellpadding="0" cellspacing="5px" border="0">
> > > > <tr>
> > > > <td><a href="#">< Prev</a> | <a href="#">Next ></a></
> > > > td>
>
> > > > <td><?php echo $paginator->counter(array('format' => __('Displaying
> > > > %start%-%end% of %count%', true))); ?></td>
>
> > > > <td>Jump to page
> > > > <?php
> > > > $pages = range(0, $paginator->params['paging']['Photo']
> > > > ['pageCount']); unset($pages[0]);
> > > > echo $form->input('page_selector', array('div' => '', 'label'
> > > > => '',
> > > > 'options' => $pages));
> > > > ?>
> > > > <input type="submit" name="go_to_page" id="go_to_page" value="Go" />
> > > > </td>
>
> > > > <td><a href="#">Select All</a> | <a href="#">Select None</a></td>
> > > > <td><input name="unpublish_records" type="button" value="Unpublish
> > > > Selected" /> <input name="publish_records" type="button"
> > > > value="Publish Selected" /></td>
> > > > </tr>
> > > > </table>
> > > > </div><!-- /toolbar -->
>
> > > > ...making it appear twice. If I remove the non-renderElementlines, an
> > > > error occurs which makes my page just turn empty and white. I know the
> > > > code in the element works because when they are there together, they
> > > > both display fine. What am i missing? It must be small and/or stupid
> > > > or i'm going crazy. Any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---