Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-01-21 17:38:34

lozmatic
Member
From: Melbourne, Australia
Registered: 2006-08-27
Posts: 259
Website

ras_enable_links tweak

ras_enable_links (http://textpattern.org/plugins/711/ras_enable_links) allows you to display a set of links for a particular lenght of time from when they were created.

Instead, I would like to publish only links that have been created on the day an article has been posted.

The only other way to achieve this is to create a new link category for each article post, which I would like to avoid.

Thanks in advance.

Loz

Offline

#2 2007-01-21 17:50:19

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

Re: ras_enable_links tweak

Hmm… your right, its wrong for that. The plugin is written to compare creation time against current time, with an offset. To do what you would like would require a new plugin. Given, of course, that you compare link creation time to article posting time (would require being in individual article mode for TXP), it might not be too difficult to rework it to do that, I’ll post a link here if I can come up with something that will work.

Offline

#3 2007-01-21 19:28:59

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

Re: ras_enable_links tweak

Try this out: ras_if_links_today

I’ve kept the time zone offset in the code for $thislink[‘date’] in order to match the displayed posting time, wether or not either posting time or link creation time need this is something I’m a little unsure of. Given a context I can probably tweak it in to what you need.

Last edited by rsilletti (2007-01-21 19:29:34)

Offline

#4 2007-01-21 21:42:16

lozmatic
Member
From: Melbourne, Australia
Registered: 2006-08-27
Posts: 259
Website

Re: ras_enable_links tweak

Thanks for this :)

For some reason I always get the ‘else’ text.

I’ve tested with a link and an article added today.

So I put setdate=“2007-01-21”

And also tried

setdate=”“ or not have any setdate attribute at all.

The linklist works as I’ve included the same out of the tag and it produces the list.

It’s probably me doing something wrong. I’ll test on another installation too.

Offline

#5 2007-01-21 22:10:43

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

Re: ras_enable_links tweak

I’ve found the time zone offsets to be confusing with these, and that may have to do things, personally I find them a little slippery when I’m testing things on a localhost install. This tag works for me there however.

try setdate=“2007-01-20” to see if the tz_offset is pushing the link creation date back into yesterday?

Live Example

The true test should still read “Today” after the date has expired.

Last edited by rsilletti (2007-01-22 03:06:45)

Offline

#6 2007-01-22 21:46:59

lozmatic
Member
From: Melbourne, Australia
Registered: 2006-08-27
Posts: 259
Website

Re: ras_enable_links tweak

Got it working (problem was with my coding).

One thing isn’t working (and it could be my error again)… whatever is put as ‘else’ is repeated many times. I think it’s repeated by the number of the links that are not displayed because of the condition.

I hope that makese sense.

Loz

Offline

#7 2007-01-22 23:25:52

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

Re: ras_enable_links tweak

It will repeat the evaluate to false statement for each iteration the links form does, it isn’t required to use the else clause however. If you just use the double tag without the else clause it will only return enclosed code for true conditions. Also, due to the nature of linklist, if you include wraptag and break attributes in the tag it will return these with or without an evaluation to true.

If you set up your links form this way: Example it will clean things up some, otherwise it will leave undesirable gaps in some layouts.

Offline

#8 2007-01-23 14:52:15

lozmatic
Member
From: Melbourne, Australia
Registered: 2006-08-27
Posts: 259
Website

Re: ras_enable_links tweak

OK, cool.

I’ve got a form that controls how the links are formatted, so output is nice and clean :)

Thank you very much for this.

Offline

#9 2007-01-23 15:29:35

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

Re: ras_enable_links tweak

:)

Offline

Board footer

Powered by FluxBB