Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-06-28 00:58:56

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

Community conditionals plugin?

I’ve been looking at the problem finding appropriate conditional tags for special purposes in Textpattern. The requests for conditionals to meet specific needs happen fairly often. The requests to have conditionals already available moved into TXP core or improved upon if they are already there happen as well.
I’ve looked around the resources site and find the pickings sparse, that may have to do with how some plugins there are categorized, but many condition plugins aren’t posted there. I have been careful up until now to only post what I have time to support and I am sure many feel the same way; you hate to have something out there looking abandoned.
What may be an all around solution is a community developed plugin for conditional tags, it would make choices available that may not be solutions suitable for core TXP (there are often circumstances where conditionals aren’t developed because they aren’t the “best” solution). The community developed option would have the advantages of: a standard tag prefix, standardized use of attributes, standard layouts for help files, and a reasonable assurance that the tags you are using are up to date with the current release.
It would also solve the problem of searching forums and sites for what you need, and having a variety of plugins installed for different tags.

I’d be happy to start things off with the following, it would be a productive project if enough people are interested.

bc.. function lfx_if_article_id($atts,$thing) { global $thisarticle; extract(lAtts(array( ‘select’ => ‘’, ),$atts)); return parse(Evalelse($thing, in_list($thisarticle[‘thisid’] , $select))); }

bc.. function lfx_if_days_passed($atts,$thing) { global $thisarticle; extract(lAtts(array( ‘offset’ => ‘14’, ),$atts)); return parse(Evalelse($thing, $thisarticle[‘posted’] <= mktime() – $offset * 86400)); }

bc.. function lfx_if_days_not_passed($atts,$thing) { global $thisarticle; extract(lAtts(array( ‘offset’ => ‘14’, ),$atts)); return parse(Evalelse($thing, mktime() – $offset * 86400 <= $thisarticle[‘posted’])); }

bc.. function lfx_if_article_category1($atts, $thing) { global $thisarticle; extract(lAtts(array( ‘name’ => ‘’, ),$atts)); return parse(EvalElse($thing, in_list($thisarticle[‘category1’] , $name))); }

bc.. function lfx_if_article_category2($atts, $thing) { global $thisarticle; extract(lAtts(array( ‘name’ => ‘’, ),$atts)); return parse(EvalElse($thing, in_list($thisarticle[‘category2’] , $name))); }

bc..

The prefix used here is temporary of course.

Offline

#2 2006-06-28 15:41:58

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: Community conditionals plugin?

Rick,

I think some can be inferred from other threads on the forum too. For example, an if_posted_within tag from M_I’s request.

There are probably a lot more. Will try to remember to post here as I come across them.


Steve

Offline

#3 2006-06-29 00:00:16

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

Re: Community conditionals plugin?

net-carver:

If I understand what is being asked for in the thread you mention the if_days-passed and if_days_not_passed tags above would have suited the need, and they were around in one form or another well before those dates; they just weren’t recognizable for what they did or were good for – or easily findable.
Its where this idea would be valuable.
But rather than simply grab ideas from different threads or use already offered plugins arbitrarily, it would be best if tags were contributed by the authors. Of course it wouldn’t hurt to ask them either.

Offline

#4 2006-06-29 03:50:27

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: Community conditionals plugin?

Thanks for pointing that out Rick, I didn’t check for coverage in your examples first.


Steve

Offline

Board footer

Powered by FluxBB