|
|
#1 |
|
Join Date: Oct 2003
Location: Delaware
Posts: 457
![]() |
My newest Module allows for processing PHP scripts, which are passed through the parameter interface. It is based on the kl_php mambot. The module was written in response to a thread in the Custom Development forum.
( http://forum.mamboserver.com/showthread.php?t=38919 ) Changes October 7th, 2005: added feature to view raw html output Wrap the output with a span, table or nothing You may now specify the class for the span or the 'module class suffix' for the table wrap. Last edited by konlong : October 7th, 2005 at 20:49. Reason: see feature list 10/7/2005 |
|
|
|
|
|
#2 |
![]() Join Date: May 2004
Location: Lexington, VA
Posts: 992
![]() |
Nice work, konlong. I'll definitely be investigating the possibilities of this addon. Can you give some suggestions?
|
|
|
|
|
|
#3 | |
|
Join Date: Oct 2003
Location: Delaware
Posts: 457
![]() |
Quote:
The thorniest issue I had with this mod was the handling of the text string returned from the textarea. It turns out that newlines are suffixed with <br /> So if you meet with problems I may offer an alternative which uses a text box. John L |
|
|
|
|
|
|
#4 |
![]() Join Date: Apr 2005
Posts: 81
![]() |
I want to use this for including a php on my site... how do you use it?!
On my main page right now I use this code in the index file: PHP Code:
PHP Code:
I'm new at this, so the more details the better! Thanks in advance. edit... actually I guess I don't even know how to use a module correctly :P |
|
|
|
|
|
#5 |
|
Join Date: Oct 2003
Location: Delaware
Posts: 457
![]() |
Modules are generally those bits that display information in the left or right columns. If what you want is to parse a php script in your content (i.e. the main body of your page) then you would do better with a mambot such as kl_php.. Look in the Mambots development forum for kl_php.
John L |
|
|
|
|
|
#6 |
![]() Join Date: Apr 2005
Posts: 81
![]() |
I am so confused here... to install a mambot, you go to mambots>install, correct? then choose your file, upload, done, right? I'm getting "xml is not for a mambot" error.
|
|
|
|
|
|
#7 |
|
Join Date: Oct 2003
Location: Delaware
Posts: 457
![]() |
you are probably using the wrong zip mod_evalphp.zip is the module version, while kl_php.zip is the mambot.
|
|
|
|
|
|
#8 |
![]() Join Date: Apr 2005
Posts: 81
![]() |
doh! ok, that worked, now I have the module and the mambot installed. How do I use the things? I'm trying to include the php in the main page, and I also want to add phpadsnew to my banners area. I'm assuming these both work the same way.
I just don't get how to create the things... For example, when I try to add the invocation code for phpadsnew I go to components>banners>...no love, I can only add banners. Then I try modules> site modules> create new... I get the optioin to create a module, but it won't let me enter my invocation code (that I can see). Thanks for your help konlong ![]() |
|
|
|
|
|
#9 |
![]() Join Date: Apr 2005
Posts: 81
![]() |
Ok, I figured the last part out, I had to enable the "NO WYSIWYG" mambot.
I don't understand how to use the kl_php command/mambot.... I have it enabled, published, and when I try to include anything php it does not work. I can see it in the source codde, so I guess it's not processing it.... I tried using Code:
{kl_php}
<?php
$number = "1";
include("../cutenews/show_news.php");
?>
{/kl_php}
|
|
|
|
|
|
#10 |
|
Join Date: Oct 2003
Location: Delaware
Posts: 457
![]() |
The module is expecting php script so leave out the <?php ?> tags
Also are you sure your file is located outside your root? John L Last edited by konlong : August 19th, 2005 at 18:25. Reason: corrected spelling error |
|
|
|
|
|
#11 |
![]() Join Date: Apr 2005
Posts: 81
![]() |
actually I made a little progress...
I am now using Code:
{kl_php}
$number = "1";
include("../cutenews/show_news.php");
return $number;
{/kl_php}
(NSFW) http://www.beerandshots.com/mambo (NSFW, I have a few adult ads on the page) This works with no errors on the main page http://www.beerandshots.com Code:
<?php
$number = "1";
include("../cutenews/show_news.php");
?>
Thanks John! |
|
|
|
|
|
#12 |
|
Join Date: Oct 2003
Location: Delaware
Posts: 457
![]() |
It looks as if you are having problems with relative paths. Is it possible to change them to absolutes?
Re: The right column --- You need to use mod_kl_evalphp as this is a module. John Last edited by konlong : April 16th, 2005 at 20:21. Reason: corrected module name |
|
|
|
|
|
#13 | |
![]() Join Date: Apr 2005
Posts: 81
![]() |
Quote:
|
|
|
|
|
|
|
#14 |
|
Join Date: Oct 2003
Location: Delaware
Posts: 457
![]() |
Yes, I forgot my sig 'kl_'
should be mod_kl_evalphp |
|
|
|
|
|
#15 |
![]() Join Date: Apr 2005
Posts: 81
![]() |
I tried it both ways...
Code:
{mod_kl_evalphp}
include('../top20.php');
{/mod_kl_evalphp}
The only real idea I have at the moment is when I click modules>all modules>kl evalPHP (that's the way it comes up in my list, or something similar) I don't get the option to edit the content. When I look at the mod_kl_evalphp.xml in my ftp though, I see where it says "Hello World", as if I should be able to ad code somewhere... and when I ad the module to my site through the site module control, it shows "hello world" on the page! I just can't figure out where to edit it or place my php code. hopefuly you can decipher what I wrote, the code and exact paths are from memory through a fair amount of alcohol consumption tonight :P Konlong, I appreciate the help! Wolfy |
|
|
|
|
|
#16 |
|
Join Date: Oct 2003
Location: Delaware
Posts: 457
![]() |
You are treating mod_kl_evalphp as if it is a mambot, which it is not. mod_kl_evalphp is a Module! Go to the module manager and place include('../top20.php'); in the PHP script parameter, then publish the module.
Note: as it is a module you may clone it and run different scripts. John L |
|
|
|
|
|
#17 |
![]() Join Date: Jun 2004
Posts: 20
![]() |
I would really like a quick demonstration for using this mod. it installed just fine (so did the mambot) but all i get are error messages. I tried
{kl_php} $number = "1"; include("oldhouse.php"); return $number; {/kl_php} and that didn't work. |
|
|
|
|
|
#18 |
|
Join Date: Oct 2003
Location: Delaware
Posts: 457
![]() |
See my previous response. Your quetion is not clear, are you asking about the Module 'mod_kl_evalphp' or the Mambot '{kl_php}'?
John L |
|
|
|
|
|
#19 |
![]() Join Date: Jun 2004
Posts: 20
![]() |
I've installed the module AND the mambot. What I need to know is how to structure the code in the module so it will display the page I'm including.
|
|
|
|
|
|
#20 |
|
Join Date: Oct 2003
Location: Delaware
Posts: 457
![]() |
In that case all you have to do is open the module using the module manager and locate the parameters. Then (using your example) place the following in the textarea box labeled PHP script.
Code:
$number = "1";
include("oldhouse.php");
return $number;
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem with admin section | sarmiento | General Questions | 16 | July 19th, 2006 23:21 |
| Problem with php script in module | mrgee | General Questions | 0 | November 26th, 2004 15:44 |
| Highlight PHP Code | Gianni_T | General Questions | 0 | November 9th, 2004 03:03 |
| Module within a Module - editor removes php tags, why? | jhdesign | General Questions | 2 | November 7th, 2004 03:34 |
| Php data in a module | lilomadio | General Questions | 0 | August 5th, 2004 10:07 |