Textpattern Forum

You are not logged in. Register | Login | Help

#51 2008-07-03 15:33:42

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

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

You’ve set yourself an interesting goal! :)

The following is meant like placing a bet ;)
As far as I understand the variable value is taken from the individual article. You don’t use your article custom as opening/closing tag and but don’t have a variable tag in between these, so the variable value is only set once and therefore should remain the same.

Last edited by uli (2008-07-03 22:17:30)


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

Offline

#52 2008-07-03 19:55:55

thebombsite
Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

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

I was going to try and get this “variables” thing sorted in my head before I started confusing myself with combining it with the new “tags-within-tags” thing (which I do understand). So correct me if I’m wrong, but I thought that variables were set once only and you could have as many of them as you liked. These could probably be contained in their own form but you don’t want the form to be visible “on-screen” so it would be called to the <head></head> section of the page with the normal <txp:output_form form="variables" /> tag assuming you had called the form “variables”. Then you just call them into your code as required. Is that correct?

Last edited by thebombsite (2008-07-03 20:24:06)


Stuart – The BombsiteProText ThemesTextgarden

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#53 2008-07-03 20:25:05

thebombsite
Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

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

And further, assuming what I said above is correct, you could wrap the <txp:output_form /> tag with <txp:if_section> tags or <txp:if_category> tags calling different forms into the <head></head> for different site conditions??


Stuart – The BombsiteProText ThemesTextgarden

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#54 2008-07-03 21:07:14

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 746
Website

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

Stuart – I’m still trying to wrap my head around it too, but from Wet’s example, I think you (using the tag in tag you didn’t want to get into), and conditionals, you can set and reset the variables dynamically.

Those who “get it” – is my understanding correct?

Offline

#55 2008-07-03 22:00:50

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,380
Website

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

maverick wrote:

Stuart – I’m still trying to wrap my head around it too, but from Wet’s example, I think you (using the tag in tag you didn’t want to get into), and conditionals, you can set and reset the variables dynamically.

Those who “get it” – is my understanding correct?

I still don’t feel that I really ‘get it’ ;) but that’s how I interpreted wet’s ‘even/odd’ example as well.

uli wrote:

You don’t use your article custom as opening/closing tag and don’t have a variable tag in between these

Now I don’t follow… do you mean I don’t (I just did, didn’t I?) or I can’t or shouldn’t? I used article_custom as a container tag mainly to shorten the code I needed to post for my example, but as soon as we can use variables we will also be able to use article and article_custom as container tags, don’t we? And I do have a variable tag inside (which of course also could have been in a form if I’d used <txp:article_custom form="blah" />), I’m just not setting a value so I assume it will keep the value that was set before. But I’m still not sure if I’m right…


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

#56 2008-07-03 22:14:25

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

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

Oh dear, today’s not my day, Els. Should have seen me in the Howdy forum this afternoon :/
What I meant is the sentence without the negative “don’t”, must be a remainder from re-writing my post.


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

Offline

#57 2008-07-03 22:23:03

thebombsite
Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

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

I think the only way to sort this out is to install a vanilla txp and just start coding to see what the hell works and what doesn’t. :)

How long have we got?

And this would be a prime case for opening up the “How to’s and examples” forum. Yes I know it was supposed to end up in the wiki but I don’t think we can wait that long quite frankly. No disrespect intended to the wiki developers.

Last edited by thebombsite (2008-07-03 22:26:18)


Stuart – The BombsiteProText ThemesTextgarden

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#58 2008-07-03 22:49:32

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

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

thebombsite wrote:

So correct me if I’m wrong, but I thought that variables were set once only

I’d never correct you ;) At the moment I’m just presuming. I tried to find an evidence for my theory but admit I didn’t find one, yet. I’m rather sure, though, you can change variables values according to conditions met.

<txp:if_category name="people"><txp:variable name="menu_group" value="people" /></txp:if_category>
[ ... menu content based on «people» ... ]

and later

<txp:if_author name="photographer"><txp:variable name="menu_group" value="portrait" /></txp:if_author>
[ ... menu content based on «portrait» ... ]

and you could have as many of them as you liked.

By all means.

And yes, if you like, please set up a pre 4.0.7 and look what works and what doesn’t. I’m curious :)

Edit: I could have used tags in tags, but didn’t want to overheat my brain today ;)

Last edited by uli (2008-07-03 22:53:23)


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

Offline

#59 2008-07-03 22:53:43

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 746
Website

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

Els wrote:

I expect to see 99 lines that are sometimes a permlink (if the category matches) and sometimes a line ‘not related’.

I threw your example up for a quick test run on one of my sites where I have an svn copy of 4.0.7 and a number of articles. I don’t have much time to play around before I have to leave for the day, but what it returned was an alternating list of articles’ permalinks and not related.

as in:

  • permalink
  • not related
  • permalink
  • not related
  • permalink
  • not related

and so on.

Mike

Offline

#60 2008-07-03 23:01:13

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,380
Website

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

Alternating??? I guess that means I still don’t ‘get it’… I’m going to sleep on this and tomorrow I’m going to set up a test install to figure it out once and for all!


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

Board footer

Powered by FluxBB