Jump to:

23459 Posts in 18906 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Open different template

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1 2
Go to End
Author Topic: 1570 Views
  • steve_nyhof
    Avatar
    Community Member
    224 Posts

    Re: Open different template Link to this post

    When I did the popup thing, it did bring up the right template - it has errors, but I'll work through that.

    Just so I know, is the /popup calling the function that is set in the Page.ss file?

    This is the error I am getting...
    [Warning] None of these templates can be found: PagePopop.ss

    I have a PagePopop.ss in the templates folder under themes...

    This is my PagePopop.php file

    <?php

    class PagePopup extends Page {
       static $db = array(
       );
       static $has_one = array(
    );

    }

    class PagePopup_Controller extends Page_Controller {
       function init() {
          parent::init();
          
          Requirements::themedCSS("layout");
          Requirements::themedCSS("typography");
          Requirements::themedCSS("form");
       }
    }

    ?>

    My function looks like this in the Page.php file

    function popup() {
       return $this->renderWith('PagePopop');
       }

  • steve_nyhof
    Avatar
    Community Member
    224 Posts

    Re: Open different template Link to this post

    I got the PagePopup.ss to load without errors, but it is blank. How do I now get the content from the page I am loading...

    mysite.com/disclaimer/popup - needs to get the content from disclaimer

    I'm getting close, I will continue.

  • steve_nyhof
    Avatar
    Community Member
    224 Posts

    Re: Open different template Link to this post

    Hi AdamJ,

    Can you expand on what you are saying here...

    "...after the URLsegment of each page"

    Where should I have the URLsegment?

  • steve_nyhof
    Avatar
    Community Member
    224 Posts

    Re: Open different template Link to this post

    How can I add an <% if ??? %> to this to find out what page the control is calling?

    When I hardcode this in the page I can bring up the content of the other page - this is a great step forward.

    <% control Page(disclaimer) %>
    $Content
    <% end_control %>

    In my Page.php file I have..

    class Page_Controller extends ContentController {

    function popup() {
    return $this->renderWith('PagePopup');
    }

    ---

    I then call up my template called PagePopup.ss

    mysite.com/disclaimer/popup

    When I click on another page link, like mysite.com/terms/popup - how can I render the PagePopup.ss template with the "terms" pages $Content?

  • steve_nyhof
    Avatar
    Community Member
    224 Posts

    Re: Open different template Link to this post

    I got it all working by making separate pages. I would still like to get an if statement into one page - any ideas?

    1570 Views
Page: 1 2
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.