How to put PHP Includes in a page

6 posts by 4 authors in: Forums > CMS Builder
Last Post: March 26, 2010   (RSS)

By (Deleted User) - March 25, 2010

We want to put a php include on the articles pages (it is like an "ending" we want to use for several articles and after having created the include file, and put it into a wysiwyg field, when rendered, it changes the references to the external file as follows: <[/#0000ff]p[/#800000]>[/#0000ff]<!--p include("en/includes/states-closing.php")-->[/#008000]</[/#0000ff]p[/#800000]>[/#0000ff]</[/#0000ff]p[/#800000]>[/#0000ff]

instead of:
<?php include("en/includes/states-closing.php");?>

It replaces the <?php for <!--p and [/#0000ff]It doesn't show the content of the external page.

How can we do it?

Thank you.

Re: [rneube] How to put PHP Includes in a page

By Jason - March 25, 2010


It's usually not a good idea to add php code directly into the editor. The easiest way to do this is to go directly into your viewer file and add the php include directly into there.

Let me know if that works for you.
Jason Sauchuk - Project Manager

Hire me! Save time by getting our experts to help with your project.

Re: [Jason] How to put PHP Includes in a page

By (Deleted User) - March 25, 2010

Hi Jason,

It may not be a good idea, but from our perspective, it would be very important to achieve that. For instance, a call to "order here" that could be placed on the middle of the article, separating topics, or even a banner served by another application. I don't know, but everybody includes something at the articles to sell something.

Even if you use Joomla (that I don't like at all) there are add ons that you can install that would allow you to create a form or to include php code.

It would really helps us if CMS Builder could come with something like this.

Thank you anyway.

Re: [rneube] How to put PHP Includes in a page

By Dave - March 26, 2010

Hi rneube,

We don't recommend allowing php code in the wysiwyg and neither do the developers of tinymce ([url]link[/url]) and if you enable this it will mean anyone with any access to your CMS (or even access to a form that adds content to your CMS) will be able to run *any* php code they want and basically have full access to your server and databases, but...

If you really want to do it, there's a tinymce plugin here that allows it:

Another way to do it is to use placeholders (eg: #banner#, #include1#, etc) and replace those with the php code in your viewers. It would take more setup time initially but have the benefit of letting you change what #banner# included (or any other placeholder) without having to update a whole bunch of hard coded php code.

Hope that helps!
Dave Edis - Senior Developer

Re: [Dave] How to put PHP Includes in a page

By (Deleted User) - March 26, 2010

Thank you very much! excellent ideas (both posts). I will try them now.

Thanks again!