Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Receive a warning that articles will expire soon
I’m working on a website that has a large business directory with all businesses listed as articles.
Adverts are relevant for a set period and have an expiry date set on them.
Is there any way to generate a warning from Textpattern, that an article will expire soon, say one week previous so I could get in touch with
the business and see if they want to continue.
Here is a link to the site www.athlone.ie/business-directory
Offline
Re: Receive a warning that articles will expire soon
I don’t know about alerts, but you could make a diagnostic-esque section, perhaps with a password, with a table structure that outputs the expires
date of each article, using article_custom
to sort by ascending or descending expiry date.
Offline
Re: Receive a warning that articles will expire soon
gaekwad wrote:
I don’t know about alerts, but you could make a diagnostic-esque section, perhaps with a password, with a table structure that outputs the
expires
date of each article, usingarticle_custom
to sort by ascending or descending expiry date.
You could probably extend this idea a bit with some clever coding if your host allows you to set up cron jobs.
I’m thinking along the idea of creating a secret URL that isn’t linked anywhere else and is hidden from search engines using robots.txt.
You could then add a handler for this URL in an admin side plugin (see Gocom’s rah_sitemap plugin for how to do this) that emails you a list of articles that will expire in the next week.
Now set up a cron job to visit the secret URL once a week to trigger the emails to you.
No reason why it shouldn’t work in theory. Coding it, of course, is another matter ;-)
Offline
Re: Receive a warning that articles will expire soon
springworks wrote:
[…] is hidden from search engines using robots.txt.
robots.txt doesn’t absolutely guarantee an exclusion from search engines, especially if it’s a shady search engine. I’ve been caught by this before, sadly.
You could also craft an XML page with articles sorted by expiry and throw that into an RSS reader on your desktop.
Offline
Re: Receive a warning that articles will expire soon
I thing that springworks suggestion is excellent. You may only use meta tags instead of a robots file. Something like
<txp:if_sectrion name="hiddensection">
<meta name="robots" content="noindex,nofollow,noodp,noydir" />
<txp:else />
<meta name="robots" content="index,follow,noodp,noydir" />
</txp:if_section>
And similarly to my recent question here, you could have the section protected by a password to prevent any others from accessing it.
Last edited by colak (2013-10-30 13:37:20)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Receive a warning that articles will expire soon
If it’s a high traffic site you can also do it like this:
- Set up a Page/Form that is called on every page visit, perhaps via
<txp:output_form />
just after the DTD. - That snippet is responsible for checking some indicator — a pref, a file, anything that can be datestamped — to see if a particular timeout has been hit. Say, “has it been at least 24 hours since the last time this date was checked?”
- If so, your code in the snippet runs which uses
<txp:article_custom>
or some tag magic to grab the soon-to-expire articles and present them as a list. That can be dealt with however you like: emailed to someone, displayed on-screen if the visitor is in a particular section, whatever you wish. - The datestamp of your ‘thing’ is then set to
now
, which has the effect of delaying the snippet from running until the next time the timeout value is passed. Actually, you should do this straight away as soon as the timeout is hit to help prevent other page hits from processing it twice during the time it take for your page to collate the info it needs to mail out/display.
It’s not exactly cron because there’s no guarantee on how soon after the timeout that someone (or a bot) will hit a page, but if you have a well-crawled or well-visited site, you’ll at least know that at some point your script will be triggered by a site hit, which will then decide whether to take action or not.
I use this idea in smd_prognostics if you set ‘monitor public side clicks’ on.
Last edited by Bloke (2013-10-30 14:18:09)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Receive a warning that articles will expire soon
Yiannis, the page springworks speaks of is just a callback URL for a cron job and pinging. Metas and passwords are unrelated to it. Basically this page wouldn’t return anything and would be protected by key. Its not for humans, just for callback action. The URL should be kept private and not included in robots.txt, since that would just announce the endpoint to the whole world.
Offline
Re: Receive a warning that articles will expire soon
You could create an admin side dashboard displaying alerts. But the cron idea is more proactive.
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
Re: Receive a warning that articles will expire soon
There’s also smd_countdown
Offline
Re: Receive a warning that articles will expire soon
You could probably subscribe to some free web monitoring service, to trigger your checkups.
Offline