Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#85 2008-07-08 00:03:05

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

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

Mike, thanks for sharing, BTW!

Stef, Shouldn’t nested odd/even type of quotes suffice? (Can’t escape zebras these days ;)

Just read jakob’s post in your smd_query thread and must admit that, of all examples I’ve found so far, at the moment he deserves the crown: for nesting a raw php command (into txp:php tags) into an SQL query into a value of a TXP tag! Respect!!

Sorry for not showing any response on your long code example you’ve posted in my direction some miles above. At times I get rather frustrated on not understanding so many things, and smd_each is THE secret to me, at the moment it’s the “variable of all variables”. Will have to visit you over there in the other wing ;)

Last edited by uli (2008-07-08 00:07:31)


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

Offline

#86 2008-07-08 00:22:59

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

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

uli wrote:

Shouldn’t nested odd/even type of quotes suffice? (Can’t escape zebras these days ;)

Probably. I’ll read up on it and play.

Just read jakob’s post in your smd_query thread … he deserves the crown

Yes he does. Very impressive bit of coding. Shame smd_query let him down at the end, though.

Sorry for not showing any response on your long code example you’ve posted in my direction some miles above.

No problem. I just threw it in to show what’s possible with the new tags and some smd_ mentalness.

smd_each is THE secret to me, at the moment it’s the “variable of all variables”.

Hehehe, it is rather entertaining when you start to think through the possibilities of being able to iterate over anything that’s delimited; user input, custom field, keyword… There aren’t many restrictions, and being able to walk over items without having to know how many there are gives some great scope for building, I dunno, forms that can capture and process user input from HTML widgets configured in glz_custom_fields.

Will have to visit you over there in the other wing ;)

I’ll get the coffee on :-)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#87 2008-12-02 04:39:55

damienbuckley
Member
From: Brisbane, QLD, AU
Registered: 2006-02-24
Posts: 138
Website

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

If only ‘Textpattern Solutions 2’ was on the boil… sigh

Offline

#88 2010-01-19 23:56:28

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

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

Hi, is Stef’s PHP trick for getting an author’s email address still viable, I can’t seem to get it to work…

<txp:variable name="author_email" value='<txp:php>global $thisarticle; echo safe_field("email","txp_users","name='".$thisarticle['authorid']."'");</txp:php>' />

I also tried jmd_author instead but as that returns email addresses encoded it will not do for my needs.

Thanks,
Phil

Offline

#89 2010-01-20 02:43:23

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

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

The basic code in the raw PHP snippet is fine. But my head spins at trying to sort out which, if any, quote marks would need to be escaped when using that php tag within another tag. Do you need to have this in a variable? If so, you could assign it inside the php tag. Something like:

<txp:php>
   global $thisarticle, $variable; 
   $variable['author_email'] = safe_field("email","txp_users","name='".$thisarticle['authorid']."'");
</txp:php>

Or you could html_entity_decode() the output from jmd_author.


Code is topiary

Offline

#90 2010-01-20 08:54:46

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

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

Nice one Jeff, I’ve used your version of the PHP and it now works as intended. Many thanks for the help.

Last edited by philwareham (2010-01-20 09:28:07)

Offline

Board footer

Powered by FluxBB