Page 1 of 1

(SOLVED) [PHP] in articles?

Posted: Thu 7. May 2009, 06:04
by ExVee
Later solution: Turns out [PHP] in article content parts is originally disabled in conf.inc.php. So setting $phpwcms['allow_cntPHP_rt'] = 1; has fixed my problem. Very simple. I don't know whether this is actually documented, but if so I couldn't find it.

Original problem follows.

--

Backstory: I use Gallery for photos for my website. Currently I'm looking at using Gallery's External Image Block function to embed a selection of thumbnail images relevant to particular articles on my website. To do this, I need to execute a PHP function.

I've been testing this using a template I've reserved specifically for testing stuff, and in the template it works just fine using the [PHP] replacement tag. But when I try to test it in an article, the [PHP] tag gets stripped off and I'm left with the code rendering as plain text in the body of the article. I've tried to search on this, but when both "php" and "article" are considered too common words and can't be used as search keywords I'm clearly not going to get very far. If this is going to work at all, it has to be within the article body and not a template since I need to have different arguments in each call relevant to a given article. So I'm needing to know first if for some reason it's not possible to execute a PHP function in an article body (and if that's the case, why?!) and if it is possible, what's going wrong for me?

I'm using 1.3.9.

Re: [PHP] in articles?

Posted: Thu 7. May 2009, 08:56
by pepe
Have you tried, to put a ContentPart "HTML" into your article... and then put your [PHP].....[/PHP] in there???

Re: [PHP] in articles?

Posted: Thu 7. May 2009, 19:22
by ExVee
Thank you for your reply.

But, why would that even be necessary? I have never come upon another replacement tag that would not work correctly in a WYSIWYG environment. And I need for the PHP to work inline with the main body of the article which is a WYSIWYG content part.

Re: [PHP] in articles?

Posted: Thu 7. May 2009, 19:29
by pepe
have you tried to switched the WYSIWYG-Editor to source ... put the RT in ... and save then?

Re: [PHP] in articles?

Posted: Thu 7. May 2009, 19:38
by ExVee
Yeah. That time it either still stripped the tags off, or rendered them uselessly as plain text in the output. At the moment I cannot recall for sure. Maybe it was that the RT rendered as plain text that way, and trying to use correct HTML markup for the PHP ended up with the tags getting stripped away.

Re: (SOLVED) [PHP] in articles?

Posted: Thu 7. May 2009, 20:04
by ExVee
I found out how to make this work. Once more I bemoan the lack of good documentation on some of the inner workings of phpWCMS.

But all's well that ends well, I suppose!

pepe, thanks very much for trying to help. :)

Re: (SOLVED) [PHP] in articles?

Posted: Thu 7. May 2009, 20:14
by update
And how did you happen to make this work? I mean, for following readers such information could be of enormous value ;)

Re: (SOLVED) [PHP] in articles?

Posted: Fri 8. May 2009, 09:43
by juergen
Claus is speaking right out of my soul ;) How did he do it ? I mean, once in a while if all self helpers will be quiet the lack of docu becomes a worldwide hole :| :? :lol:

Re: (SOLVED) [PHP] in articles?

Posted: Fri 8. May 2009, 09:49
by update
found it - exvee did a little editing of the initial posting: http://forum.phpwcms.org/viewtopic.php?p=116401#p116401
but you'll need an detectives eye to discover that....