3212 Posts in 847 Topics by 809 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1678 Views |
-
splash page / intro page

8 September 2010 at 1:46am
I have a question I want a splash page/intro page before normal site, the splash intro page is totally different in design from the other pages. Is this possible I want the splash page to show for 5 sec and use meta content redirect so I can redirect it to the normal page. Cant figure out how to do that.
Joakim
-
Re: splash page / intro page

8 September 2010 at 5:04pm
Course its possible! did you want the splash page to show on every page before you visit it ? eg if a visitor hits yoursite.com/news-article did you want to show the splash page or just for hits to the homepage? How I would do it is have another theme for your splash page. Then based on a cookie (or session var) set the theme to that one or the normal one.
-
Re: splash page / intro page

9 September 2010 at 8:10pm
Hi willr, I just want it when the visitors hit the homepage, i am not that familiar with programming, where would i set a session variable, i have tried to do it with a meta content redirect but that did not work
Joakim
-
Re: splash page / intro page

20 September 2010 at 5:55am
Hi Willr,
I'd also like to do this too, do you have anymore info/advice on being able to apply a separate template just to the Intro page please?
Thanks in advance!!
-
Re: splash page / intro page

20 September 2010 at 7:37pm
MarkAB / HanSolo if you have a custom page type for your homepage its easiest. How you could do it is overview the forTemplate() function to use another template for the initial load.
Not sure if both of you want exactly the same thing but you can try
// mysite/code/HomePage.php -> HomePage_Controller
function forTemplate() {
if(Cookie::get('ShownIntro') {
// already visited the intro, show t
Cookie::clear('ShownIntro');return $this->renderWith(array($this->class, 'Page'));
else {
// never visited, show the intro page
Cookie::set('ShownIntro', true);return $this->renderWith(array('Intro', 'Page'));
}
}Then have an Intro.ss template for the Intro page.
-
Re: splash page / intro page

29 November 2011 at 11:41pm
Sorry to dig out this old thread, but I thought it's better than creating a new one.
I'm exactly in need of the same thing, showing a disclaimer to people who visit the site before they see anything else.
I tried to do it with a jquery cookie method, but it doesnt seem to work inside silverstripe ...What Willr posted there seems to be the right thing:
// mysite/code/HomePage.php -> HomePage_Controller
function forTemplate() {
if(Cookie::get('ShownIntro') {
// already visited the intro, show t
Cookie::clear('ShownIntro');return $this->renderWith(array($this->class, 'Page'));
else {
// never visited, show the intro page
Cookie::set('ShownIntro', true);return $this->renderWith(array('Intro', 'Page'));
}
}3 questions about this:
1) would I have to write this in all of my page types classes (homepage.php, page.php, articleholder.php etc.) if I wanted to show it on every possible point of entering the page of the site?
2)
function forTemplate() {
if(Cookie::get('ShownIntro') {
// already visited the intro, show t
Cookie::clear('ShownIntro');do this few lines already set a fully viable cookie "shownintro", how would you let it expire after e.g. 14 days of not visiting my site?
3) Is this method working in SS 2.4.6?
I'd be happy if someone with knowledge could post an answer here
best regards, Richi
-
Re: splash page / intro page

30 November 2011 at 12:22am
Hi Richi,
1. If all your pagetypes extend the Page class (which normally they would), I think you'd only need to add it to your Page_Controller to be effective on every pagetype
2. As for the cookie: Cookie::set() accepts the following parameters:
static function set($name, $value, $expiryDays = 90, $path = null, $domain = null, $secure = false, $httpOnly = false)
3. I see no reason to believe it wouldn't work in 2.4.6 - you could always just try it out
Martine
-
Re: splash page / intro page

30 November 2011 at 10:17pm
Thx for the tip martimiz, sorry one last question, would this code be put anywhere in between of the openening { and the closing } of class Page_Controller extends ContentController because dreamweaver highlights some lines as syntax error ... ?
I think I'm in the wrong place.
class Page_Controller extends ContentController {
/**
* An array of actions that can be accessed via a request. Each array element should be an action name, and the
* permissions or conditions required to allow the user to access it.
*
* <code>
* array (
* 'action', // anyone can access this action
* 'action' => true, // same as above
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
* );
* </code>
*
* @var array
*/function forTemplate() {
if(Cookie::get('ShownIntro') { /// highligs syntax error
// already visited the intro, show t
Cookie::clear('ShownIntro');return $this->renderWith(array($this->class, 'Page'));
else { /// highlights syntax error
// never visited, show the intro page
Cookie::set('ShownIntro', true);return $this->renderWith(array('Intro', 'Page')); /// Would I substitute 'Intro' with 'DisclaimerPage' if my template is named DisclaimerPage.ss ?
}
}public static $allowed_actions = array ( /// highlights syntax error
);public function init() { /// highlights syntax error
parent::init();// Note: you should use SS template require tags inside your templates
// instead of putting Requirements calls here. However these are
// included so that our older themes still work
Requirements::themedCSS('layout');
Requirements::themedCSS('typography');
Requirements::themedCSS('form');
}
} /// highlights syntax error
| 1678 Views | ||
|
Page:
1
|
Go to Top |



