Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP code within CMS

Am I missing something?

7:48 pm on Jan 20, 2005 (gmt 0)

10+ Year Member

I have been looking into using a CMS to help reduce my workload some. One thing I don't really seem to understand about most CMS is if they are able to render/execute php.

For example when I make a new piece of content (or article, or page, or whatever the CMS calls it), I can add in my own HTML formatting and stuff, but when I try to add in php code it just spits it out as raw text.

The only CMS that I've found (that is free and open source anyway) that has an option to render a page with php code on it is Drupal. Am I right in assuming that the other CMS's simply can't/don't do this?

8:19 pm on Jan 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Usually a CMS will take what you input via a browser (where you're putting your HTML formatting and stuff, I presume) and save it into a database - and then later output the stuff it gets from the database. It outputs this content, it doesn't parse it, or execute it.

If you want to add your php code, you need to do this in the php files themselves. Most often, basic type php you want to add will go in the 'template', the 'style', or the 'theme'. Watch out for templates - not all of them allow php input.

This is all for some very good reasons - the basics of security in separation of coding and content, and sometimes the separation of code and design.

Some CMS's will allow you to add, via the browser, snippets of php which will be plopped somewhere on the page (using the php function eval()). This is frequently a bit of a gimmick, and not such a good idea security-wise; unless you trust the programmers implicitly, it's best to stay away from this kind of modules / blocks.

3:34 pm on Jan 28, 2005 (gmt 0)

10+ Year Member

Some CMS do have a wrapper : may be useful for you?
(just a suggestion, me not a guru).