Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

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

Open different template


Reply


13 Posts   1644 Views

Avatar
steve_nyhof

Community Member, 224 Posts

6 January 2010 at 4:44pm

Edited: 06/01/2010 4:49pm

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');
   }

Avatar
steve_nyhof

Community Member, 224 Posts

6 January 2010 at 4:53pm

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.

Avatar
steve_nyhof

Community Member, 224 Posts

6 January 2010 at 4:57pm

Hi AdamJ,

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

"...after the URLsegment of each page"

Where should I have the URLsegment?

Avatar
steve_nyhof

Community Member, 224 Posts

6 January 2010 at 6:13pm

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?

Avatar
steve_nyhof

Community Member, 224 Posts

6 January 2010 at 6:46pm

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