Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-07-06 18:49:12

renobird
Member
From: Gainesville, Florida
Registered: 2005-03-02
Posts: 786
Website

php in form help.

Hello all.

This might be complicated to explain…bear with me.

In an article form…
I’m trying to compare the value of ?c= as passed in a url (ex.www.mysite.com/?c=sample) with the <txp:category1 /> and then echo some text if they are equal.

I’m trying this with no luck.
<txp:asy_wondertag> <txp:php>global $c; if ($c == "<txp:category1 />") {echo 'current';}</txp:asy_wondertag></txp:php>

When I echo $c and output <txp:category1 /> they are the same, but for some reason the above code doesn’t produce anything.

Any ideas? thoughts on trouble shooting?

I’m trying to make a javascript expanding menu, but I want the current state to get passed from page to page.
I can make the menu work fine, but can’t seem to find a way (other than what I’m trying) to keep the menu open from page to page.

Thanks — hope that wasn’t too painful to decipher

Tom

Offline

#2 2007-07-06 20:33:09

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

Re: php in form help.

Your nesting with your php tags looks out of step? with wondertag, I might question how wondertag would work in any case with the php tags. You might try

parse(“<txp:category1 />”);

instead, it shoud return the current category 1 value in an article form.

Offline

#3 2007-07-06 21:44:19

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: php in form help.

<txp:php>
  global $c; 
  if ($c == category1(array())) echo 'current';
</txp:php>

Offline

#4 2007-07-09 14:35:48

renobird
Member
From: Gainesville, Florida
Registered: 2005-03-02
Posts: 786
Website

Re: php in form help.

rsilliti wrote

Your nesting with your php tags looks out of step

Doh!

Ruud,

Thanks a million! That worked perfectly.
Once I do a little more testing, I’m going to post this technique to the forum.
It’s pretty sweet.

Cheers Guys!

Tom

Offline

Board footer

Powered by FluxBB