Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-02-07 07:33:27

janw
Member
From: Groningen
Registered: 2005-11-18
Posts: 47

pass variables into txp-tags?

I want to pass variables to my txp-tags.

I use something like this:

<code><txp:php>global $film;$film = $_GET[“id”]</txp:php>

<txp:bas_flvplayer id=<txp:php>global $film;echo ‘\’‘ . $film . ‘\’‘;</txp:php> /></code>

But it doesn’t work…
What am I doing wrong?

Offline

#2 2006-02-07 14:40:07

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: pass variables into txp-tags?

The parser does not support tags inside of tags. Since a TXP tag is nothing but a pointer to a function you could probably do

<code>
<txp:php>
global $film;
$film = $_GET[“id”];
bas_flvplayer([‘id’ => $film]);
</txp:php>
</code>

I haven’t tested this, just thinking out loud.

Last edited by hakjoon (2006-02-07 14:40:33)


Shoving is the answer – pusher robot

Offline

#3 2006-02-07 18:51:51

janw
Member
From: Groningen
Registered: 2005-11-18
Posts: 47

Re: pass variables into txp-tags?

Thanks a lot but this doesn’t work.
It says expect ‘)’instead of ‘[’

Any more ideas?

Offline

#4 2006-02-07 18:58:06

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: pass variables into txp-tags?

Sorry getting my languages mixed up. If this works any better.

<code>
<txp:php>
global $film;
$film = $_GET[“id”];
bas_flvplayer(array(“id” => $film));
</txp:php>
</code>


Shoving is the answer – pusher robot

Offline

#5 2006-02-07 19:05:23

janw
Member
From: Groningen
Registered: 2005-11-18
Posts: 47

Re: pass variables into txp-tags?

Parse error: parse error, unexpected ‘=’, expecting ‘)’

Another language? :-)

Offline

#6 2006-02-07 20:47:32

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: pass variables into txp-tags?

Oh well I’m out of ideas. That’s how I pass variables to the functions when I use them in plugins. Maybe it works differently inside the <txp:php> tags (I’ve honestly never used them).

I think I was giving you perl there for minute. :)


Shoving is the answer – pusher robot

Offline

Board footer

Powered by FluxBB