Jump to content

page publish and unpublished scheduler


zaib
 Share

Recommended Posts

I actually have done something similar on a project using the Date/Time, and at the time, a checkbox. However, I have since moved it to 2 Date/Time fields. I simply compared the two, and used an if statement to display the page content if the condition was met. This is rough, but it is similar to what I have done:

<?php
$startdate = $page->start_date;
$expirationdate = $page->expiration_date; //you will probably need to use strtotime on these to compare.

if ($startdate <  $expirationdate) {
	//show the desired information
}
else (
	echo "We're sorry, there are currently no promotions availabe.";
)
?>

However, I guess this might not suite your needs since the page will still be visible, unless you do some checking in your navigation to show/hide the url with a conditional.

Link to comment
Share on other sites

  • 1 year later...

So I'm resurrecting this thread from the dead but are there any new ways to do this?

The two modules listed are no help...the first just wont install as I'm using processwire 3 (I get the error that dependencies are not met) and the second doesnt seem relevant at all?

I just need to be able to set a date and publish on that date as OP said.

Thanks

 

Link to comment
Share on other sites

12 minutes ago, cleanboy3000 said:

...the first just wont install as I'm using processwire 3 (I get the error that dependencies are not met)

Just checking: where / at what point of the installation process is this error coming up, and what does it say exactly? I'm currently testing this on a 3.x site and so far it seems to work.

Note that if you're installing the module from the Modules section in the Admin, it will complain that the module hasn't been marked as compatible with 3.x. This alone doesn't mean that it won't work with 3.x, though it is good to be worried when you see a message like that ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...