Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#25 2006-09-18 01:36:28
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: ras_if_expired (conditional, expiration, date)
Thanks nardo – I can’t really tell what the problem is unless I can see the whole picture. One thing that is a problem with if_days is the way everything is calculated dynamically, the zero point for calculation moves with the present, and an offset of 2 hours in the future will always be two hours in the future, and always missing current postings until they are 2 hours old.
TXP’s time setting, to the best of my understanding, moves the time used for posts to the user time zone with an offset in the preferences panel, if you were in U.S. Mountain time, and your settings were correct for that, your posting time would reflect that.
I removed some of the post here because it was incorrect, the time zone settings are what are throwing things off, the tags that include them don’t work I don’t believe.
Thanks for your interest.
Last edited by rsilletti (2006-09-18 06:48:32)
Offline
#26 2006-09-18 21:58:36
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: ras_if_expired (conditional, expiration, date)
This plugin includes jayrope’s work and mine with some improvements on both (thanx jayrope).
ras_dates_today is used as a conditional tag and will select article content keyed to the current days postings. ras_dates_before is keyed to dates before the date set in the “date” attribute, ras_dates_after is keyed to dates after. The date attribute uses the format YYYY-MM-DD.
Other tags in this plugin take attributes as follows:
days (Integer offset in days)
hours(Integer offset in hours)
minutes (Integer offset in minutes)
They all operate as ras_if_days_passed and ras_if_days_not_passed do.
Article Forms:
ras_if_days_passed or ras_enable_articles (they are identical except in name)
ras_if_days_not_passed or ras_disable_articles (they are identical except in name)
These functions appear to me to behave as expected. I have done some limited testing on them, but not with all time setting enviroments. If anyone is willing to test, I’ll follow this thread in the forum.
Some example forms
current.txt the current state of the contained functions as text (if you don’t want to download and install the plugin)
plugin link ras_enable_articles Ver 4.0.3
plugin link ras_dates Ver 4.0.3
Last edited by rsilletti (2006-09-28 00:14:13)
Offline
#27 2006-09-19 23:37:04
- nardo
- Member
- From: tuvalahiti
- Registered: 2004-04-22
- Posts: 743
Re: ras_if_expired (conditional, expiration, date)
hi Rick – installed this one, using ras_dates_today
- I’m at GMT +10 … this plugin doesn’t show today’s articles until 10 hours into the day (i.e. right now Wed 9.30am it’s showing Tuesday’s articles, but it’ll show Wed’s articles after 10am)
- can’t confirm 100% but y’day it wasn’t showing all articles in the day (I think articles in the ‘past’ dropped off the list) – will keep an eye on it today
cheers
Offline
#28 2006-09-20 01:39:30
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: ras_if_expired (conditional, expiration, date)
Hi nardo,
I’m trying to get time relationships correct on a local install that I have changed repeatedly. :s
try changing the lines in dates_today that read:
***
- $check = strtotime(date(‘Y-m-d’, $thisarticle[‘posted’] + tz_offset()));
to:
+ $check = strtotime(date(‘Y-m-d’, $thisarticle[‘posted’] ));
***
***
- return parse(Evalelse($thing, (ceil((mktime() + $tz)/86400) (ceil(($thisarticle['posted'])/86400))) ));
+ return parse(Evalelse($thing, (ceil((mktime() + $tz + tz_offset())/86400) (ceil(($thisarticle[‘posted’])/86400))) ));
I don’t think 10 is a coincidence, but a copy of how you are using the tag will help.
You mentioned that you create things locally, then move them live. The time zone adjustment in the preferences panel is added (or subtracted ) from the posting time after it is read from the database. That would make posting time in the database for comparison correct before that adjustment.
The tz_offset in the code above is added to that posting time
in order to match displayed time, and that may not be required – though it seems to work well on my local testing.
I’ve started testing live on my own site and may be able to make sense of it then.
Thanks
Last edited by rsilletti (2006-09-25 05:15:14)
Offline
#29 2006-09-20 23:11:42
- nardo
- Member
- From: tuvalahiti
- Registered: 2004-04-22
- Posts: 743
Re: ras_if_expired (conditional, expiration, date)
rick – that second change worked – the first doesn’t seem to make any difference on my install
still picking up one date on the ‘next’ day but getting closer to the grail!!
Offline
#30 2006-09-21 00:35:31
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: ras_if_expired (conditional, expiration, date)
nardo,
The top change changes the value compared to a date attribute if it is active, the second if no value is passed. Both are incorporated in an updated plugin from the same link. Are you using the tag default or with a date attribute?
Thanks for the feedback, it helps a great deal.
Offline
#31 2006-09-23 04:12:27
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: ras_if_expired (conditional, expiration, date)
I’ve a plugin that is tested, won’t crash 4.0.3, and is much easier to use than if_days. It uses day, hours, and minutes as integer attributes and the whole picture just makes clearer sense.
Info Article
Plugin Link ras_enable_articles_v4.0.3.1.txt
Thanks Uli.
Nardo – The dates_today function, as well as the rest, still doesn’t work as defaulted to the current day. If given a date attribute all three work nicely – I’ll let you know when I can get them working in auto-mode.
Last edited by rsilletti (2006-09-23 18:00:46)
Offline
#32 2006-09-25 05:20:49
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: ras_if_expired (conditional, expiration, date)
I’ve a working copy of a ras_dates plugin that seems to be running perfectly.
Plugin Link ras_dates_v4.0.3.1.txt
Not exactly the original idea, but the combination of ras_enable_articles and ras_dates should be of practical value if they prove reliable.
Last edited by rsilletti (2006-09-28 00:14:46)
Offline
#33 2006-09-26 00:57:36
- szac
- Member
- From: Detroit-ish
- Registered: 2004-09-18
- Posts: 50
Re: ras_if_expired (conditional, expiration, date)
Hi rsillietti,
The plugin appears to need compiling. If I’m reading the thread right this plugin would work if I just wanted to show an article for duration? Like if article’s date == today then show the article. Is this correct?
thanks for your work!
Offline
#34 2006-09-26 01:31:05
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: ras_if_expired (conditional, expiration, date)
Plugins are encoded and are installed that way. Once installed, both the plugin functions (as recognizable text) and the help writeups are available.
Some good instructions on installation Here ,and yes the plugin is designed to return article content posted to the current day as well as other choices.
Some example forms , and be aware that this plugin is presently in development. I can’t, as yet, gaurantee the desired results.
Do let us know how it works if you do choose to use it.
Last edited by rsilletti (2006-09-26 01:32:48)
Offline
#35 2006-09-28 00:03:01
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: ras_if_expired (conditional, expiration, date)
Egad – sorry about that, it was in fact not a compiled version – it was the backup php. I am not having my best week here. :(
I’ll check this one to make sure this time. Plugin
Offline
Re: ras_if_expired (conditional, expiration, date)
hey rick, super, that it’s goign further and furtehr. scuse my only occassional re-appearance: loads of nasty work to do over here, mostly not programming-related.
still i am looking ofrward to anything to come and hop i can chip in something everyonce in a while.
toooot
berlin’s so warm and windy, while leaves fall. it’s got a weird, subconcious climate change feel to it, i fear, but it’s nevertheless enjoyable and maybe nicely surreal
A hole turned upside down is a dome, when there’s also gravity.
Offline