Page 1 of 2
Processing PHP code in Content Area?
Posted: Tue Jul 29, 2008 8:53 pm
by CWebguy
Hello, thanks for all your help! I am looking for a way to process PHP code in the content area, so that in each individual page I can add unique PHP code, and have it parsed by the server. Right now (I turned off WSIWYG) it copies the code fine unto the page but it won't parse it. So looking at the source code, the tags and everything are still there, they are all intact, but just not parsed. Do I need a built in tag or something to tell it to parse the code?
Thanks a bunch!
Lance
Re: Processing PHP code in Content Area?
Posted: Tue Jul 29, 2008 8:59 pm
by CWebguy
Basically what I mean is I am copying the PHP code into the page-edit content section, (similiar to writing a post on this forum) but it's not parsing the PHP. Not sure what to do
Any help is greatly appreciated!
Thanks!
Lance
Re: Processing PHP code in Content Area?
Posted: Tue Jul 29, 2008 9:02 pm
by Nullig
You need to use smarty tags {php} your code here {/php} and edit the config.php file to allow php code in content - dangerous, but possible.
Nullig
Re: Processing PHP code in Content Area?
Posted: Tue Jul 29, 2008 9:06 pm
by CWebguy
Dangerous? Care to explain
Lance
Re: Processing PHP code in Content Area?
Posted: Tue Jul 29, 2008 9:41 pm
by CWebguy
ahhhhh, where do I change it in the config file? Thanks!
Re: Processing PHP code in Content Area?
Posted: Tue Jul 29, 2008 10:04 pm
by CWebguy
ok, I went to where it says $config['use_smarty_php_tags'] and changed it to true so "$config['use_smarty_php_tags'] = true" but it's still not working. Am I missing something?
Re: Processing PHP code in Content Area?
Posted: Tue Jul 29, 2008 10:14 pm
by CWebguy
haha, ok, the problem was I needed to get rid of opening php tags. But now it's saying, URL file-access is disabled in the server configuration, and throwing up an error. I'll keep looking in the config file for this setting. thanks!
Lance
Re: Processing PHP code in Content Area?
Posted: Wed Jul 30, 2008 1:12 am
by Dr.CSS
Aren't you better off using a UDT?...
Re: Processing PHP code in Content Area?
Posted: Wed Jul 30, 2008 1:31 am
by Nullig
Can you post you code, so w can see what you're trying to do?
Have you enclosed the code in the {php} ... {/php} smarty tags?
Nullig
Re: Processing PHP code in Content Area?
Posted: Wed Jul 30, 2008 1:54 am
by CWebguy
mark wrote:
Aren't you better off using a UDT?...
UDT, sorry, never heard of it
The error I'm getting is "URL file-access is disabled in the server configuration in C:\wamp\www\cms3\tmp\templates_c\%%D9^D9B^D9BE697E%%preview%3Acms130.tmp.php on line 113" . I'm failrly certain the problem is not in the code, just in the settings (config) file. Looks like a security thing, just need to turn it off (or back on, haha
Thanks!
Lance
Re: Processing PHP code in Content Area?
Posted: Wed Jul 30, 2008 2:00 am
by Nullig
That's a temp/cached file, which needs to be deleted. Clear your cache in Admin.
A UDT (User Defined Tag, under Extensions in Admin) is a convenient way to use PHP code, without having to put it into your content block. Just create a UDT and name it whatever you want, like "myudt". Enter the PHP code you want into the tag content. Then call the UDT in your content page like {myudt}.
Simple.
Nullig
Re: Processing PHP code in Content Area?
Posted: Wed Jul 30, 2008 2:01 am
by Dr.CSS
The path it is pointing to is a tmp folder, you may need to clear the site cache and set the page your code is in to non cache mode...
These are temp files for caching pages...
C:\wamp\www\cms3\tmp\templates_c\
Re: Processing PHP code in Content Area?
Posted: Wed Jul 30, 2008 2:01 am
by Nullig
Should I answer here???
Re: Processing PHP code in Content Area?
Posted: Wed Jul 30, 2008 2:02 am
by Dr.CSS
Lets keep going back and forth, tag your it...

Re: Processing PHP code in Content Area?
Posted: Wed Jul 30, 2008 2:05 am
by Nullig
Don't pay any attention to the guy in the other thread, he doesn't know what he's talking about.