5121 Posts in 1527 Topics by 1119 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 837 Views |
-
Page Specific Content on Page.ss

6 October 2010 at 9:37am
Hi There,
Is there a way to add content to templates/Page.ss that will only display if a user is on a specific page?
If user is on the news page, display this <h1>Hello world</h1>
A simple work around would be the best as I am new to this.
Thanks,
plush -
Re: Page Specific Content on Page.ss

6 October 2010 at 8:26pm
A number of ways to do it, each with varying degrees of usefulness
<% if URLSegment = news %>
.. on news
<% end_if %>Do you have a php page type for news pages? Then you could do
<% if ClassName = NewsPage %>
.. on news
<% end_if %>Which is more robust. Or you could setup a NewsPage.ss template to have it
-
Re: Page Specific Content on Page.ss

7 October 2010 at 2:50am
Hey Willr,
This works great! I do have multiple news page types. NewsHolder, NewsLandingPage, NewsPage, Newsroom.
Is there a way to have the content display only on these page types?
plush
-
Re: Page Specific Content on Page.ss

7 October 2010 at 9:37am
Then you could do something like this on your Page.php
function IsNewsPage() {
$news = array('NewsHolder', 'NewsLandingPage', 'NewsPage', 'Newsroom');return (in_array($this->ClassName, $news));
And then you can use <% if IsNewsPage %>...
-
Re: Page Specific Content on Page.ss

13 October 2010 at 3:26am
Worked like a charm. Thanks very much!
| 837 Views | ||
|
Page:
1
|
Go to Top |


