Jump to:

3447 Posts in 1032 Topics by 872 members

Template Questions

SilverStripe Forums » Template Questions » renderWith() and $Layout

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1146 Views
  • Vegas Rob
    Community Member
    5 Posts

    renderWith() and $Layout Link to this post

    I was trying to replicate the functionality in this old example: http://doc.silverstripe.org/old/recipes:ajax_basics (couldn't find a similar example in the new docs)

    Page.php contains the following index method which will render Templates/Ajax.ss as expected.

    public function index()
       if($this->isAjax || $_GET['isAjax'] == '1')
          return $this->renderWith('Ajax');
          return array();

    The issue I'm having is that it seems that when using renderWith() the $Layout "special include" no longer behaves has it would when rendering templates normally. I even stripped it down so that $Layout was all that was left in Ajax.ss. As a result I can't seem to optionally wrap my Layout content for XHR delivery.

    Any help in getting past this roadblock will be much appreciated. Thanks for your time and thoughts.

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.