Textpattern Forum

You are not logged in. Register | Login | Help

#31 2008-05-28 19:21:24

hakjoon
Moderator
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,631
Website

Re: Central storage for site-wide constants: Helpful?

That’s exactly what I was thinking of.


Shoving is the answer – pusher robot

Offline

#32 2008-07-02 04:50:36

wet
Developer
From: Lenzing, Austria
Registered: 2005-06-06
Posts: 3,108
Website

Offline

#33 2008-07-02 10:06:16

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,034
Website

Re: Central storage for site-wide constants: Helpful?

Brilliant! So many possibilities…


TXPQ Examples and discussion of Textpattern CMS quality.

Offline

#34 2008-07-02 10:17:58

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: Central storage for site-wide constants: Helpful?

so is it basically this idea?

Last edited by iblastoff (2008-07-02 10:18:07)

Offline

#35 2008-07-02 10:22:16

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,914
Website

Re: Central storage for site-wide constants: Helpful?

Yes wet, very useful for those that don’t do stripes in jQuery.

In the same vein… untested but should work if I’ve understood the syntax:

<txp:variable name="plural" value='<txp:comments_count />' />
<p>
  <txp:comments_count /> comment<txp:if_variable name="plural" value="1"/><txp:else />s</txp:if_variable> so far.
</p>

Last edited by Bloke (2008-07-02 10:23:37)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#36 2008-07-02 10:25:20

wet
Developer
From: Lenzing, Austria
Registered: 2005-06-06
Posts: 3,108
Website

Re: Central storage for site-wide constants: Helpful?

iblastoff wrote:

so is it basically this idea?

I think the original base is the Registry Pattern. At least, this is what I had in mind.

Offline

#37 2008-07-02 10:49:30

uli
Moderator
From: Cologne/Köln
Registered: 2006-08-15
Posts: 3,086

Re: Central storage for site-wide constants: Helpful?

Very sweet little examples for txp_var, Robert and Stef. I’m beginning to see the light ;)


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

Offline

#38 2008-07-02 11:50:06

uli
Moderator
From: Cologne/Köln
Registered: 2006-08-15
Posts: 3,086

Re: Central storage for site-wide constants: Helpful?

Would this give just todays articles, then?

<txp:variable name="today" value='<txp:php>echo date("Y-m-d");</txp:php>' />
<txp:if_variable name="today" value="<txp:posted format="%Y-%m-%d" />"/>
<txp:output_form form="my_article" />
<txp:else />
No events today!
</txp:if_variable>

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

Offline

#39 2008-07-02 11:57:39

wet
Developer
From: Lenzing, Austria
Registered: 2005-06-06
Posts: 3,108
Website

Re: Central storage for site-wide constants: Helpful?

At first glance, this is almost working. if_variable receives a Textpattern tag as the attribute’s value, so you would need to enforce parsing with single quotes around <txp:posted format="%Y-%m-%d" />.

<txp:variable name="today" value='<txp:php>echo date("Y-m-d");</txp:php>' />
<txp:if_variable name="today" value='<txp:posted format="%Y-%m-%d" />' />
<txp:output_form form="my_article" />
<txp:else />
No events today!
</txp:if_variable>

Offline

#40 2008-07-02 14:42:59

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,399

Re: Central storage for site-wide constants: Helpful?

uli wrote:

… I’m beginning to see the light ;)

Well now I can see the light fully. It’s strange but as soon as I read wet’s odd/even example my brain switched to “php mode” and all became clear in a second. Very strange, previously I had an hard time understanding… probably it’s me being completely brain-dead.
Anyway – as ever – thanks, very appreciated

Offline

Board footer

Powered by FluxBB