Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-10-06 12:46:18

flyingbuddha
New Member
Registered: 2006-10-06
Posts: 2

<txp:php> not working?

Hi all,

I’m new to using textpattern and have only come across it as I’m taking over someone else’s coding who used it.
I need to include some php, I think I’ve followed all instructions on the textpattern site, and mooched around on here and the web in general but can’t seem to find any answers.

When I put < txp:php>echo ‘Hello World’;< /txp:php> (minus the space) into an article, it doesn’t get displayed on the page (nor in the source code).

The client is running version 4.0.2 and has ‘allow_page_php_scripting’ and ‘allow_article_php_scripting’ set to 1 in both lib/admin_config.php and in the database (txp_prefs)

The user that I’m logging in as has ‘privs’ set to 3, this id is enabled for article.edit in admin_config and the db.

What I do find is that I can run the code if I put it into a ‘page’, but I really need to be able to put it into an ‘article’
Can anyone tell me what I’m doing wrong?

I’m afraid I can’t provide a url as the site is live, but if you need more information, please tell me :)
Cheers.

Offline

#2 2006-10-06 13:19:48

Sencer
Developer emeritus
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: <txp:php> not working?

When troubleshooting, you should set production status to debugging (or at least test), that way errors get displayed (which are obviously hidden when production status is set to live). I am sure you would have gotten an error that indicated, that those single-quotes were converted by textile and php threw an error.

Or, you have skimmed the FAQ http://textpattern.com/faq/151/problems-with-code-in-article-bodies

;)

Offline

#3 2006-10-06 13:32:33

flyingbuddha
New Member
Registered: 2006-10-06
Posts: 2

Re: <txp:php> not working?

Hey Sencer,

Cheers for the reply.
I missed that faq, please excuse me, I struggle to find needles in haystacks when I’m after an answer.
There were no errors thrown for using apostrophes, if I change the status to debugging (or test), will it effect the front-end of the site, I can’t afford to have any down time.

I changed my article to read:
< txp:output_form form=“mh-test” />

And I created a form called ‘mh-test’ that read:
< txp:php>echo “Hello”;< /txp:php>

Again, I have no output on the front-end. Any more suggestions are welcome :)

Last edited by flyingbuddha (2006-10-06 13:32:53)

Offline

#4 2006-10-06 14:55:13

Sencer
Developer emeritus
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: <txp:php> not working?

There were no errors thrown for using apostrophes, if I change the status to debugging (or test), will it effect the front-end of the site, I can’t afford to have any down time.

This is explained in http://textpattern.com/faq/225/what-does-the-production-status-setting-do

Advice: If you cant afford down-time on a live-site, then you shoudln’t try to develop on a live-site either. Use a development/staging installation of textpattern where you build and experiment.

As long as you hide the error-messages (that’s what production-status live does), it’ll be incredibly hard to help you.

Offline

Board footer

Powered by FluxBB