PHP?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
SN3

PHP?

Post by SN3 »

How can I put PHP codes in CMS made simple? I was able to put a simple time code by creating a plug in, but what about other simple codes like PHP includes? I also want to put in a translate code, but that won't work either. Here is the php translate code:

Code: Select all

<?
$currenturl = $_SERVER["PHP_SELF"];
if ( $_SERVER['QUERY_STRING'] <> '') {
   $currenturl .= "?" . $_SERVER['QUERY_STRING'];
   }
$currenturl = 'http://' . $_SERVER["SERVER_NAME"] . $currenturl;
$currenturl = str_replace(":", "%3A", $currenturl);
$currenturl = str_replace("/", "%2F", $currenturl);
$currenturl = str_replace("&", "%26", $currenturl);
?>

That's just some simple php code that won't work when I put it in. Even when I put in in as a plugin, the code never shows up when I go to view the source, and it never replaces the:

Code: Select all

 <?echo 
$currenturl;?>

in the links with the address.

The PHP code works fine when it is not in CMS made simple. I really love this software, but if I can't get php includes to work, I can't use it. Thanks so much for working so hard to create this - I've been looking for months now, and this is so simple to use! Just what I wanted (except for the PHP problems)! 8)
SN3

PHP?

Post by SN3 »

I get an error:


Parse error: parse error, unexpected '<' in /home/stealth/public_html/invisionmicro/smarty/cms/templates_c/%%F9^F9E^F9E10D84%%preview%3Acmspreview4ALXNJ.php on line 218
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm
Location: Fairless Hills, Pa USA

PHP?

Post by Ted »

Make a user defined plguin as outlined in http://wiki.cmsmadesimple.org/pmwiki.ph ... sicPlug-In
SN3

PHP?

Post by SN3 »

Patricia wrote:remove opening and closing ?>

they are replaced by {php} and {/php}


I did that, it still won't work.
SN3

PHP?

Post by SN3 »

wishy wrote:Make a user defined plguin as outlined in http://wiki.cmsmadesimple.org/pmwiki.ph ... sicPlug-In


I tried that before but it wouldn't work.

It did work with the date thing though, and it worked. Now it won't. :cry:
Last edited by SN3 on Wed Dec 29, 2004 1:19 am, edited 1 time in total.
SN3

PHP?

Post by SN3 »

I'm talking about the code when I put it in the WYSIWYG editor. I did the date thing directly in the PHP template file (the {curdate} tag, the actual code was a plugin). I want to be able to do this in the content area (somehow):

text..blah..blah
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm
Location: Fairless Hills, Pa USA

PHP?

Post by Ted »

I made a user plugin called currenturl. It's code was:

Code: Select all

$currenturl = $_SERVER["PHP_SELF"];
if ( $_SERVER['QUERY_STRING'] <> '') {
   $currenturl .= "?" . $_SERVER['QUERY_STRING'];
   }
$currenturl = 'http://' . $_SERVER["SERVER_NAME"] . $currenturl;
$currenturl = str_replace(":", "%3A", $currenturl);
$currenturl = str_replace("/", "%2F", $currenturl);
$currenturl = str_replace("&", "%26", $currenturl);
echo $currenturl;


and put it in my page. Worked fine for me.
SN3

PHP?

Post by SN3 »

wishy wrote:I made a user plugin called currenturl. It's code was:

Code: Select all

$currenturl = $_SERVER["PHP_SELF"];
if ( $_SERVER['QUERY_STRING'] <> '') {
   $currenturl .= "?" . $_SERVER['QUERY_STRING'];
   }
$currenturl = 'http://' . $_SERVER["SERVER_NAME"] . $currenturl;
$currenturl = str_replace(":", "%3A", $currenturl);
$currenturl = str_replace("/", "%2F", $currenturl);
$currenturl = str_replace("&", "%26", $currenturl);
echo $currenturl;


and put it in my page. Worked fine for me.


Ok it works now. And that's exactly what I had before!

What about the PHP includes? :shock:
SN3

PHP?

Post by SN3 »

They are different. The one you just got working goes in the template file, the one I need to get working (includes) goes in the content part. Is this possible? I really appreciate your help!
iNSiPiD

PHP?

Post by iNSiPiD »

I also have a bunch of complex PHP for our conference site which includes conference registration and abstract submissions.

I would LOVE to be able to easily use this code for pages inside CMS.

Wishy, in the Contentment Management > Edit Content section for each page you have a Head Tags section. Would it be a terribly difficult task to allow the pasting of PHP code into either that section, or a new one called Raw Code...or something?

Sorry if I come across as a little ignorant but I've not had the time to test all these things myself.
Locked

Return to “Modules/Add-Ons”