Problems, need help? Have a tip or advice? Post it here.
23 posts Page 1 of 3
I have created a news_list.html page and news.php for news stories and in the admin panel I only have a date published bar...Is there anyway to add to the date published field an end date that when the article or post reaches the end date the article or post unpublishes itself?
You can create a 'datetime' editable region to hold the expiry-date and use it in cms:pages listing to skip pages that are past that date.

To use 'datetime' region you'll need to enable the DataBound Form module first. Do the following to enable it -
Edit the 'kfunctions.php' file found in 'couch/addons' folder and uncomment (or add if upgrading from an older version) the following line

require_once( K_COUCH_DIR.'addons/data-bound-form/data-bound-form.php' );

Now define the following 'expiry_date' region in your template
Code: Select all
<cms:editable name='expiry_date' type='datetime' format='mdy'/>

Use the regions value in the existing cms:pages listing as follows
<cms:pages custom_field="expiry_date > <cms:date format='Y-m-d H:i:s' />">
...
</cms:pages>

In the code above, the <cms:date format='Y-m-d H:i:s' /> statement always produces the current date. So the code basically evaluates to - show pages that have their expiry-dates beyond the current date.

Hope it helps.
Thank you KK works great as usual...I plan on studying up on Couch when I can get a break as to use it regularly on the sites I build for clients..You guys have done a great job on this CMS and Im sure a simple thank you cant touch the time thats been put into Couch and dedication.....This Cms has been a lifesaver for me.
Thank you very much for the kind words @zerotechz :)
I'm glad you found our little CMS useful.
Hello KK Sir,


If I like to give a option drop-down 7days, 15 days, and 30 days, in a data bound form what will be the code?

Thanks
Hi I Just solve it .
How can we then list the EXPIRED pages on seperate site?
@kimheggen, You would simply make the "greater than" sign into a "less than" sign in the code @KK posted above. I know it's not obvious what's going on because the symbol sort of gets mixed up with the tags.
<cms:pages custom_field="expiry_date < <cms:date format='Y-m-d H:i:s' />">
...
</cms:pages>
Thanks tim, that works :)
KK wrote: Use the regions value in the existing cms:pages listing as follows
<cms:pages custom_field="expiry_date > <cms:date format='Y-m-d H:i:s' />">
...
</cms:pages>


Hi, KK.
What about setting up a warning on the front-end for pages that are going to expire, let's say, in the following 5 days?
Thank you!

Attila
23 posts Page 1 of 3
cron