Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-03-11 14:25:11

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Regarding txp's parsing of php

I have an issue I need to solve. Since this ratin plugin doesn’t work for me, I have to resort to a simple php script I have found elsewhere on the web. It uses a flat database, but no biggie, and here’s the problem.

In order for the script to differentiate between “my articles” it needs and ID. It can be anything, and i have tried something like:
<code>
id = “<txp:title />”;
</code>
as well as:
<code>
id = “<txp:article_id />”;
</code>

and they both don’t produce any output because the whole piece of code is wrapped around txp:php tags, and then textpattern ignores it’s generic tags inside my php code.

Does anyone have an idea how could I go around this?

Offline

#2 2006-03-11 16:15:37

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: Regarding txp's parsing of php

I ran into the same problem recently when I had to work around a Firefox 1.5 bug using some PHP. It turns out you can get the same information by calling one of Textpattern’s global variables.

More information:

Offline

#3 2006-03-12 00:25:17

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Regarding txp's parsing of php

PHP code and Textpattern template tags are two different things. You’ll need to call functions and/or fetch variables, as L says.


Alex

Offline

#4 2006-03-12 01:35:23

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: Regarding txp's parsing of php

Use caution when taking this approach. I just discovered one way to shoot yourself in the foot by using Txp’s global variables, and there are probably others.

If you can’t avoid using PHP (I know I couldn’t find a way around it), try it on a development machine first and have “Production Status” set to Debug on the Admin tab. Watch for odd error messages, and come back for another round in the forum if you get stuck. Over the last couple of days, Sencer and Andrew have helped me out of a trio of jams that had me completely stumpped. The folks here are nothing if not helpful. :-)

Offline

Board footer

Powered by FluxBB