|
Hello everyone.
I'm trying to do a Twitter style auto- load more when scrolling : <?php if (!$isAjax):?><div id="postList"> This should updates only the div "postList" but it returns the whole page in the view. In my controller, I have public $components = array('RequestHandler'); activated, and $this->set('isAjax', $this->RequestHandler->isAjax()); in my function. What am I doing wrong ? Thanks a lot ! Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php |
|
just use $this->request->is('ajax')
you don't need to include RequestHandler component. OFC, you have to be on 2.x cake that will work this :)
<?php echo $this->element('posts'); ?></div>
why si "</div>" there ?
-- Lep pozdrav, Tilen Majerle
2012/7/1 JonStark <[hidden email]> Hello everyone. Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php |
|
Thanks for the head up !
But still, doesn't solve my problem :( Whenever I try to paginate a update just a given div, I get the full layout in response....
-- Le dimanche 1 juillet 2012 20:18:10 UTC+2, MaJerle.Eu a écrit : just use $this->request->is('ajax') Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php |
|
I can't speak to the example code you provided as I don't use Cake's
JSHelper for AJAX. Does the full layout include the data you wanted? Or does it just have what you'd see when first arriving at the page? Does your controller action have a redirect? Does the returned HTML include an error or notice of any kind? On Sun, Jul 1, 2012 at 2:27 PM, JonStark <[hidden email]> wrote: > Thanks for the head up ! > > But still, doesn't solve my problem :( > > Whenever I try to paginate a update just a given div, I get the full layout > in response.... > > Le dimanche 1 juillet 2012 20:18:10 UTC+2, MaJerle.Eu a écrit : >> >> just use $this->request->is('ajax') >> >> you don't need to include RequestHandler component. >> OFC, you have to be on 2.x cake that will work this :) >> >> <?php echo $this->element('posts'); ?></div> >> >> why si "</div>" there ? >> >> -- >> Lep pozdrav, Tilen Majerle >> http://majerle.eu >> >> >> >> 2012/7/1 JonStark >>> >>> Hello everyone. >>> >>> I'm trying to do a Twitter style auto- load more when scrolling : >>> >>>> <?php if (!$isAjax):?> >>>> >>>> <div id="postList"> >>>> <?php endif;?> >>>> >>>> <?php echo $this->element('posts'); ?></div> >>>> >>>> <?php if (!$isAjax):?> >>>> </div> >>>> <?php endif;?> >>>> >>>> <?php if (!$isAjax):?> >>>> <?php >>>> echo $this->Html->script('jquery', false); >>>> $maxPage = $this->Paginator->counter('%pages%'); >>>> ?> >>>> <script type="text/javascript"> >>>> var lastX = 0; >>>> var currentX = 0; >>>> var page = 1; >>>> $(window).scroll(function () { >>>> if (page < <?php echo $maxPage;?>) { >>>> currentX = $(window).scrollTop(); >>>> if (currentX - lastX > 300 * page) { >>>> lastX = currentX; >>>> page++; >>>> $.get('posts/page:' + page, function(data) { >>>> $('#postList').append(data); >>>> }); >>>> } >>>> } >>>> }); >>>> </script> >>>> <?php endif;?> >>>> >>>> <?php echo $this->Js->writeBuffer(); ?> >>> >>> This should updates only the div "postList" but it returns the whole page >>> in the view. In my controller, I have public $components = >>> array('RequestHandler'); activated, and $this->set('isAjax', >>> $this->RequestHandler->isAjax()); in my function. What am I doing wrong ? >>> Thanks a lot ! >>> >>> -- >>> Our newest site for the community: CakePHP Video Tutorials >>> http://tv.cakephp.org >>> Check out the new CakePHP Questions site http://ask.cakephp.org and help >>> others with their CakePHP related questions. >>> >>> >>> To unsubscribe from this group, send email to >>> [hidden email] For more options, visit this group >>> at http://groups.google.com/group/cake-php >> >> > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > [hidden email] For more options, visit this group at > http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php |
|
In reply to this post by JonStark
Did you fix it? I'm facing the same issue :S
On Sunday, July 1, 2012 12:27:27 PM UTC-6, JonStark wrote: Thanks for the head up !-- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [hidden email]. To unsubscribe from this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/cake-php?hl=en-US. |
|
Try this one..
-- Add this code starting.. <?php if ($isAjax): $this->layout = '';endif; ?> On Fri, Aug 31, 2012 at 4:29 AM, darkangel <[hidden email]> wrote: Did you fix it? I'm facing the same issue :S Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [hidden email]. To unsubscribe from this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/cake-php?hl=en. |
| Powered by Nabble | Edit this page |
