MDN

Go Back   Mambo - Forums Closed for posting > Mambo 3rd Party Addons > Mambots

Reply
 
Thread Tools Search this Thread Display Modes
Old April 13th, 2005, 05:14   #1
konlong
 
konlong's Avatar
 
Join Date: Oct 2003
Location: Delaware
Posts: 457
konlong is on a distinguished road
Default kl_php -- Place PHP script in Content

kl_php is a content mambot which is used to include PHP script in content. This mambot has
4 admin parameters!

"ob" ="1" "Use Output Buffering"
"entities" ="1" "Decode HTML_entities"
"span" ="0" "Set to 1 to Wrap the results in a span"
"debug" ="0" "debug"

Examples:
Code:
 {kl_php} include("http://onlinemedicalforum.com/forum/ssi.php?a=active");{/kl_php}
Code:
 {kl_php}
$collection ="http://www.mediapanic.com/swanseasucks/random/thoughts.txt";
$thoughts = file("$collection");
$thought = rand(0, count($thoughts)-1);
echo $thoughts[$thought];
{/kl_php}
Code:
{kl_php}
include("local_script_file.php");
{/kl_php}
Form code example by -- gatman
http://forum.mamboserver.com/showthr...&page=12&pp=10
Quote:
Originally Posted by gatman
Saving some time for others, here is code for passing form values to Mambo created pages - seems to work ok.

Passing Value Page
<form method="POST" action="/index.php?option=com_content&task=view&id=<XX>&Ite mid=<XX>">
<table><tr><td>
<input type="text" size="35" name="Test1">
<input type="submit">
</td></tr></table>
</form>

===============

Received by another Page Form

{kl_php}
if (empty($_POST['Test1'])) {
return "";
} else {
$begin = '<input type="text" name="Test1" size="35" maxlength="85" ';
$begin .= ' value="' . $_POST['Test1'] . '">';
return $begin;
}
{/kl_php}

===============

Received by another Page - Basic

{kl_php}
if (empty($_POST['Test1'])) {
return "";
} else {
$response = $_POST['Test1'];
return $response;
}
{/kl_php}
John L
Attached Files
File Type: zip kl_php.zip (2.7 KB, 10697 views)

Last edited by konlong : July 15th, 2005 at 03:37. Reason: added small example
konlong is offline   Reply With Quote
Old April 13th, 2005, 07:08   #2
quiquedcode
 
quiquedcode's Avatar
 
Join Date: Jun 2004
Location: San Juan, Argentina
Posts: 767
quiquedcode is on a distinguished road
Default

great tips konlong and awesome bot !
__________________
Enrique Becerra
Freelance Developer & Mambo Templater
MSN: qbecerra @ hotmail.com
www.beza.com.ar
quiquedcode is offline   Reply With Quote
Old April 16th, 2005, 13:03   #3
pixelsoul
 
pixelsoul's Avatar
 
Join Date: Nov 2003
Location: Netherlands
Posts: 1,551
pixelsoul is on a distinguished road
Default

yes very usefull bot great script konlong
__________________
Go visit my site, you know you want to ;-)
www.mech7.net
pixelsoul is offline   Reply With Quote
Old April 16th, 2005, 17:59   #4
Ankhamun
 
Ankhamun's Avatar
 
Join Date: Apr 2005
Posts: 4
Ankhamun is on a distinguished road
Default

Thanks much for your post! I've downloaded your mod_kl_php pack and it works very well.

I am having trouble with the mambot though. It seems as if it doesn't want to recognize {kl_php} as a trigger - even when I use the examples you've posted. Rather than executing the PHP between your trigger tags - it just posts it onto my site as plain text.

Being rather new to Mambo - I'm not sure if any of my troubleshooting was worthwhile - but I've tried turning on/off different mambots to see if it would make any difference. Seemed like a logical place to start but it didn't do anything to help.

Any ideas on what to do next?



*Edit* Might it be because I'm using 4.5.2?
Ankhamun is offline   Reply With Quote
Old April 16th, 2005, 19:35   #5
konlong
 
konlong's Avatar
 
Join Date: Oct 2003
Location: Delaware
Posts: 457
konlong is on a distinguished road
Default

I know it gets confusing but mod_kl_evalphp is a module and your php script is stored in a parameter. While kl_php is a mambot and as such the tags {kl_php} and {/kl_php} are entered into Content and they surround the PHP script.

If the text of the mambot isbeing displayed as opposed to being parsed then there are a few possibilities:

1. the mambot has not been published (turned on)
2. you have placed the mambot in a description area of either a section or a category
3. you have placed the mambot in a module

John L
konlong is offline   Reply With Quote
Old April 16th, 2005, 20:01   #6
quiquedcode
 
quiquedcode's Avatar
 
Join Date: Jun 2004
Location: San Juan, Argentina
Posts: 767
quiquedcode is on a distinguished road
Default

konlong...
your bot is only for content items, right ?
well... any ideas about how to exec some php code inside modules ?
lot of people generate php code in phpadsnew and they complain about this...
phpadsnew + mambo is becoming very popular...

thanks
__________________
Enrique Becerra
Freelance Developer & Mambo Templater
MSN: qbecerra @ hotmail.com
www.beza.com.ar
quiquedcode is offline   Reply With Quote
Old April 16th, 2005, 20:05   #7
konlong
 
konlong's Avatar
 
Join Date: Oct 2003
Location: Delaware
Posts: 457
konlong is on a distinguished road
Default

Quote:
Originally Posted by quiquedcode
konlong...
your bot is only for content items, right ?
well... any ideas about how to exec some php code inside modules ?
lot of people generate php code in phpadsnew and they complain about this...
phpadsnew + mambo is becoming very popular...

thanks
you are correct, however if you look in the Module Development forum you will find the module counterpart to kl_php, namely mod_kl_evalphp.

John L
konlong is offline   Reply With Quote
Old April 16th, 2005, 20:35   #8
quiquedcode
 
quiquedcode's Avatar
 
Join Date: Jun 2004
Location: San Juan, Argentina
Posts: 767
quiquedcode is on a distinguished road
Default

thanks John !!
awesome tip
__________________
Enrique Becerra
Freelance Developer & Mambo Templater
MSN: qbecerra @ hotmail.com
www.beza.com.ar
quiquedcode is offline   Reply With Quote
Old April 20th, 2005, 05:01   #9
MasterE
 
Join Date: Apr 2005
Posts: 1
MasterE is on a distinguished road
Default

I cannot download the mambot although I'm logged in.
Is there any alternative download address?

MasterE
MasterE is offline   Reply With Quote
Old April 27th, 2005, 05:54   #10
Scribbller
 
Join Date: Nov 2004
Posts: 43
Scribbller is on a distinguished road
Default

Konlong I am getting this error
Parse error: parse error, unexpected '<' in /home/pakpass/public_html/mambots/content/kl_php.php(65) : eval()'d code on line 1

when I try to execute includes code

Any idea why?
Scribbller is offline   Reply With Quote
Old April 27th, 2005, 05:57   #11
Scribbller
 
Join Date: Nov 2004
Posts: 43
Scribbller is on a distinguished road
Default

BTW I am trying to execute this code

{kl_php} include(http:///www.pakpassion.net/test/MainPage/WhoAreWe.html);{/kl_php}
Scribbller is offline   Reply With Quote
Old April 27th, 2005, 06:14   #12
konlong
 
konlong's Avatar
 
Join Date: Oct 2003
Location: Delaware
Posts: 457
konlong is on a distinguished road
Default

You simply need to quote the string.
{kl_php} include('http://www.pakpassion.net/test/MainPage/WhoAreWe.html');{/kl_php}

John L
konlong is offline   Reply With Quote
Old April 30th, 2005, 05:21   #13
rhapsodyfx
 
Join Date: Apr 2005
Posts: 5
rhapsodyfx is on a distinguished road
Default

Quote:
Originally Posted by MasterE
I cannot download the mambot although I'm logged in.
Is there any alternative download address?

MasterE
same for me, can't download. any other URL. Thanks
rhapsodyfx is offline   Reply With Quote
Old June 10th, 2005, 03:51   #14
Siobhan
 
Join Date: Mar 2005
Location: UK
Posts: 220
Siobhan is on a distinguished road
Default mambot and php.. How do I get the ZFlikr API running in Mambo?

Hi

I am trying to get this OS API to work in Mambo.

http://metaatem.net/words/

I installed the mambot and then dropped the code into a static content page. What happened is that it does not work! I am not sure how this works but what happens is this

http://srtcweb.co.uk/index.php?optio...13&Itemi d=28

the php code is appearing in the page along with a the form.

it does not work as an API.

I used the the source code..

http://metaatem.net/words.phps



there is also a javascript wrapper code.

http://metaatem.net/spell.phps

Tried this but it did not seem to work either.



Help would be great!
Siobhan is offline   Reply With Quote
Old June 11th, 2005, 21:22   #15
konlong
 
konlong's Avatar
 
Join Date: Oct 2003
Location: Delaware
Posts: 457
konlong is on a distinguished road
Default

From your link it is apparent that you are missing the opening few lines of his code. Check your file to see that it begins with: <?php
the second line of his code starts with: /*
konlong is offline   Reply With Quote
Old June 14th, 2005, 09:45   #16
guille
 
Join Date: Jun 2005
Posts: 17
guille is on a distinguished road
Default kl_php and mambo 4.5.2

Hi... Thanks Konlong, this is a great bot. I only have a question, what about kl_php and mambo 4.5.2? it seems to work ok.... but there is any problem that I´m missing?



.:Guille:.
guille is offline   Reply With Quote
Old June 15th, 2005, 00:11   #17
konlong
 
konlong's Avatar
 
Join Date: Oct 2003
Location: Delaware
Posts: 457
konlong is on a distinguished road
Default

If you are having trouble with the included code it may be that the code is trying to include things which are not available on your system. I would suggest that you contact the original author to see how you might run his application on your system.
konlong is offline   Reply With Quote
Old June 15th, 2005, 17:41   #18
rmirasol
 
Join Date: Jun 2005
Posts: 4
rmirasol is on a distinguished road
Default

Quote:
Originally Posted by konlong
Code:
 {kl_php}
$collection ="http://www.mediapanic.com/swanseasucks/random/thoughts.txt";
$thoughts = file("$collection");
$thought = rand(0, count($thoughts)-1);
echo $thoughts[$thought];
{/kl_php}
hi, I'm new to Mambo (on 4.5.2) and am trying to get something like this working on my site. it gives me this error:

Parse error: parse error, unexpected '<' in /home/content/r/m/i/rmirasol/html/ronmambo/mambots/content/kl_php.php(65) : eval()'d code on line 1

this example works, though:

Quote:
Originally Posted by konlong
{kl_php} include('http://www.pakpassion.net/test/MainPage/WhoAreWe.html');{/kl_php}
any idea what's going on? is it a 4.5.2 issue?
rmirasol is offline   Reply With Quote
Old June 15th, 2005, 18:41   #19
konlong
 
konlong's Avatar
 
Join Date: Oct 2003
Location: Delaware
Posts: 457
konlong is on a distinguished road
Default

rmirasol: This code works well on my system, perhaps your system is not setup to allow evals of offsite url's.
konlong is offline   Reply With Quote
Old June 16th, 2005, 09:07   #20
rmirasol
 
Join Date: Jun 2005
Posts: 4
rmirasol is on a distinguished road
Default

I don't know how to check if my system allows evals of offsite url's (real newbie) but the workaround I used was to put the first code snippet in a php file and then include it using the second code snippet.

thanks for the reply.
rmirasol is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
I still can't get Mambo to work digitalninja Installation Questions 5 October 14th, 2007 17:56
Glossary - Grammar and Spell Checked Yerg Documentation Suggestions, Modifications and Corrections 1 December 20th, 2005 22:20
PHP in content Zudl General Questions 12 August 16th, 2005 13:26
Admin login problem AGAIN... :) Please bare with me. spignataro Installation Questions 17 February 23rd, 2005 23:08
linking external php file to main content area ??? fresh@mambo General Questions 1 October 29th, 2004 05:11


All times are GMT -7. The time now is 07:21.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.