Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2006-09-14 06:09:53

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: ras_if_expired (conditional, expiration, date)

Ok, This is what I have for a starting point.
The if_days and if_days_not tags are a good one size fits all approach, but they are cumbersome and complicated to use, maybe include them for special situations but they are in there best final form as is.

I agree. Past, Today, and Future is the best direction to go.
For picking articles for a specific date and/or time, the “month” attribute could be used with an article tag.

Offsets, I take it, would be offsets from the present until a time in the past or future when you would begin selecting article content. I haven’t looked carefully at both hours and days as attributes, I tend to like a single measure, but that ends in calculating seconds. With the proper tag arrangements, a lot can be done with what you already have.

I’ll post what I come up with as a text file as I find time to work on it. Let me know if you have any suggestions.

Offline

#17 2006-09-14 12:22:50

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: ras_if_expired (conditional, expiration, date)

I tend to like a single measure, but that ends in calculating seconds.

rick, if you see possible anyhow, please don’t let the end users calculate fractions of days in order to achieve punctuality on the dot. i myself took much time in the testing phase, correcting the many mistakes i made on calculations, because dealing with txp is kinda fun for me. but the end users will not be this eager and willing, it’ll be their work, it’ll have to work. they’ll clearly prefer integer units ;)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#18 2006-09-15 01:22:26

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: ras_if_expired (conditional, expiration, date)

Hi Uli, Good point, after looking at this for a bit it occured to me that we are after all using computers here. This upgrade should give you what I think you are looking for.

enable_articles.v04.3

I haven’t found any problems with this version, but I haven’t had much time to test either. Let us know if it works well for you.

Last edited by rsilletti (2006-09-25 05:10:36)

Offline

#19 2006-09-15 11:48:44

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: ras_if_expired (conditional, expiration, date)

it occured to me that we are after all using computers here.

:) an uli-understander.

yep, at least it should feel like that. even if it costs your, i.e. rick “robin hood” siletti’s, [edit: i mean it honestly] time, that you give to the poor/ user without even mentioning. ;) thank you for that, rick!
the help text looks like it really fulfills all end users desires. i’ll tell you how it works for the current site when i find the time for testing and, before, adjusting mary’s automation snippet above. hopefully, this’ll be this weekend.
thanks, once again, rick!

Last edited by uli (2006-09-15 12:19:52)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#20 2006-09-15 13:57:27

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 726
Website Mastodon

Re: ras_if_expired (conditional, expiration, date)

rick, thanx for your update!
nice new features!
one thing icouldn’t grasp is: is your plug now judging article posted by days or exact posted time down to the second (still)? it’ll be good to make this switchable somehow.
help files: yessir, they look good here now aswell.

as of your plug.txt link before:
i looked into it, but only briefly yet, since i have a customer flood on my back.
they all WANT stuff.
when is 4.0.4 due to be released?
and can we discuss some of your php in detail? i can’t follow you on <code>assert_article();</code> aswell as <code>tz_offset()</code>…

(it would be really helpful f.i., if an offset to today’s date could also mean, that the qualifying starting time or day remains the same, but the expiration could be shifted to the future in integer hours.
that way one could have todays date being displayed in tomorrow’s morning hours still. i oftenly have events coming up which are f.i. announced for saturday, 23.00, but in reality they start on sunday 03.30 in the morning – berlin is a nighttime city…)

best greets and thanx very much for your efforts. we’ll have a major cool plug in the end, simple as hell.!

Last edited by jayrope (2006-09-15 14:03:36)


A hole turned upside down is a dome, when there’s also gravity.

Offline

#21 2006-09-16 03:17:39

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: ras_if_expired (conditional, expiration, date)

rick – when I activate your plugin (not call it, just make it active) my site doesn’t load and this error is displayed:
Fatal error: Call to undefined function assert_article() in /users/home/name/domains/domain.tld/public_html/textpattern/lib/txplib_misc.php(459) : eval()'d code on line 21

Offline

#22 2006-09-16 13:38:56

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: ras_if_expired (conditional, expiration, date)

Yep, same thing here with v0.4.3. [had to change the post several times, chaotic afternoon]

Last edited by uli (2006-09-16 14:30:21)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#23 2006-09-16 23:52:17

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: ras_if_expired (conditional, expiration, date)

uli-nardo:
assert_arrticle() is recently added error checking, the link above wasn’t intended to be released until 4.0.4 was available. This 4.0.3 plugin should work for Ver 4.0.3, or you could edit the plugin you already have installed by removing the line that reads “assert_article();” from both functions. They will work properly in both versions of TXP without the error checking.

jayrope:
The tz_offset() function is a textpattern function that returns the time zone settings (in seconds) that you have set in TXP`s preferences. Its inclusion in the functions moves the zero point for them to the users perspective rather than the servers.

Last edited by rsilletti (2006-09-30 02:05:49)

Offline

#24 2006-09-17 23:10:36

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: ras_if_expired (conditional, expiration, date)

thanks rick – still having trouble getting just posts timestamped ‘today’ (whether past or future today)

also confused about how posts are dated, etc – within Txp – because I developed this site locally, entered content locally, then uploaded to a site in another timezone, etc … the articles have the correct date and time but – eg – rss_suparchive doesn’t seem to check time zone settings so I have to make sure events start after 10am (I am GMT +10) … and with your plugin I’m getting some events from yesterday listed under the heading of today! (not sure how that could happen)

I remember reading a post from zem explaining some of the complexities of maintaining time but right now it’s a lot easier to go back to hand coding the daily lists!

PS much appreciate your work, ain’t a diss!!

Offline

#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

Board footer

Powered by FluxBB