Timed publication of pages
Permalink 3 users found helpful
I wanted a way to only make some pages available after a certain datetime, e.g. Events, Registrations, etc
Here's how I did it, nice and simple. Probably duplicating something someone else has already done but it can't hurt!
1. Create a new attribute in Pages/Themes in the Dashboard, make it a datetime data type and call it e.g. 'start_publishing'
2. Edit your header element (in my case) to include the following PHP:
3. For any pages you want to self-publish after a certain datetime just add the attribute and set its start_publishing value.
Job done!
Stop Publishing can obviously be achieved in the same way, plus any number of other actions you may wish to take based on an attribute value. Self-Publishing was what I wanted in this case.
Hope this is useful to people!
G
Here's how I did it, nice and simple. Probably duplicating something someone else has already done but it can't hurt!
1. Create a new attribute in Pages/Themes in the Dashboard, make it a datetime data type and call it e.g. 'start_publishing'
2. Edit your header element (in my case) to include the following PHP:
if($c->getCollectionAttributeValue('start_publishing') and strtotime($c->getCollectionAttributeValue('start_publishing'))>time()) { ob_end_clean(); header('Location:/page_not_found'); }
3. For any pages you want to self-publish after a certain datetime just add the attribute and set its start_publishing value.
Job done!
Stop Publishing can obviously be achieved in the same way, plus any number of other actions you may wish to take based on an attribute value. Self-Publishing was what I wanted in this case.
Hope this is useful to people!
G
Kind of related, but you'll probably also want to make sure your auto-nav (as well as page list, or anything which dynamically generates links to pages on your site) also uses the same logic to prevent users from discovering links before they are ready to go live.
Yeah, I realise it's not a tidy solution as in menuing and everything but my
purpose is for a simple sign-up/RSVP page which 'Opens' at a certain
datetime.
Yep, full integration is a different matter!
G
On 30 March 2011 18:39, Concrete5 Community <discussions@concretecms.com>wrote:
purpose is for a simple sign-up/RSVP page which 'Opens' at a certain
datetime.
Yep, full integration is a different matter!
G
On 30 March 2011 18:39, Concrete5 Community <discussions@concretecms.com>wrote:
To do this, you'd want to do in your pagetype controller
another way to skin that cat.
All that code is just from memory but it is the general gist of what you'd want to do.
-Scott