Processing PHP code in Content Area?

General project discussion. NOT for help questions.
User avatar
CWebguy
Forum Members
Forum Members
Posts: 139
Joined: Thu Jul 24, 2008 3:31 am

Processing PHP code in Content Area?

Post 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
CMSMS Made
User avatar
CWebguy
Forum Members
Forum Members
Posts: 139
Joined: Thu Jul 24, 2008 3:31 am

Re: Processing PHP code in Content Area?

Post 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
CMSMS Made
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: Processing PHP code in Content Area?

Post 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
User avatar
CWebguy
Forum Members
Forum Members
Posts: 139
Joined: Thu Jul 24, 2008 3:31 am

Re: Processing PHP code in Content Area?

Post by CWebguy »

Dangerous?  Care to explain  ;D

Lance
CMSMS Made
User avatar
CWebguy
Forum Members
Forum Members
Posts: 139
Joined: Thu Jul 24, 2008 3:31 am

Re: Processing PHP code in Content Area?

Post by CWebguy »

ahhhhh, where do I change it in the config file?  Thanks!
CMSMS Made
User avatar
CWebguy
Forum Members
Forum Members
Posts: 139
Joined: Thu Jul 24, 2008 3:31 am

Re: Processing PHP code in Content Area?

Post 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?
CMSMS Made
User avatar
CWebguy
Forum Members
Forum Members
Posts: 139
Joined: Thu Jul 24, 2008 3:31 am

Re: Processing PHP code in Content Area?

Post 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
CMSMS Made
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Processing PHP code in Content Area?

Post by Dr.CSS »

Aren't you better off using a UDT?...
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: Processing PHP code in Content Area?

Post 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
User avatar
CWebguy
Forum Members
Forum Members
Posts: 139
Joined: Thu Jul 24, 2008 3:31 am

Re: Processing PHP code in Content Area?

Post 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
CMSMS Made
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: Processing PHP code in Content Area?

Post 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
Last edited by Nullig on Wed Jul 30, 2008 2:03 am, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Processing PHP code in Content Area?

Post 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\
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: Processing PHP code in Content Area?

Post by Nullig »

Should I answer here???
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Processing PHP code in Content Area?

Post by Dr.CSS »

Lets keep going back and forth, tag your it... :)
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: Processing PHP code in Content Area?

Post by Nullig »

Don't pay any attention to the guy in the other thread, he doesn't know what he's talking about.
Post Reply

Return to “General Discussion”