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:
[/#0000ff]<p>
<?php include("en/includes/states-closing.php");?>
</p>[/#0000ff]

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

Hi,

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
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

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 http://wiki.moxiecode.com/index.php/TinyMCE:FAQ#TinyMCE_strips_away_or_alters_my_server-side_code]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:
http://sourceforge.net/tracker/index.php?func=detail&aid=2859676&group_id=103281&atid=738747

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
interactivetools.com

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!