MDN

Go Back   Mambo - Forums Closed for posting > Mambo 4.5.5 - Stable > General Questions

Reply
 
Thread Tools Search this Thread Display Modes
Old December 28th, 2004, 04:52   #111
frosty64
 
Join Date: Dec 2004
Posts: 70
frosty64 is on a distinguished road
Default

Well, 'adoration' may be a bit much, but its still a pretty neat tool. I got my pathway working with it, and slayed two more script integrations in (what is for me) record time. I have also learned some tricks for using it. I could get the "print" function back if I knew where to include my form variables. I can pass varaibles to an existing php script by using this method:
{kl_php}
$flow = $_POST["flow"];
$flow_unit = $_POST["flow_unit"];
$O_conc = $_POST["O_conc"];
$feed_gas = $_POST["feed_gas"];
$stages = $_POST["stages"];
include ("staticfiles/general.php");
{/kl_php}
Where the vars are from the user form.

If I can find where to put similar code in the "print" function, I can get that working without replacing it with a javascript call to the browser's print function. Any suggestions?
frosty64 is offline   Reply With Quote
Old December 28th, 2004, 07:54   #112
frosty64
 
Join Date: Dec 2004
Posts: 70
frosty64 is on a distinguished road
Default Parse errors in kl_php

I may be wrong, but if you get parse errors in something like:

{kl_php} include("http://localhost/directory/index.php?option=com_mtree&task=listcats&cat_id=26 &Itemid=75");{/kl_php}

try replacing the '&' with '&'

One thing I did to double check my links was to set up a dummy menu, add the content item I was trying to reference, refresh the screen and check out the source code from the browser's "View Source" . That sounds messy, but it was
easier for me than trying to find the url somewhere else or writing it in correctly from scratch.

To Mambo developers: It would be extremely handy to have content urls listed on the content editor screen.
frosty64 is offline   Reply With Quote
Old December 28th, 2004, 09:18   #113
walb
 
walb's Avatar
 
Join Date: Aug 2004
Location: Hack City, Earth.
Posts: 1,062
walb is on a distinguished road
Default

Quote:
Originally Posted by konlong
As promised i have upgraded my mosphp to be loadable in 4.5.1 I am now naming the mambots with kl_ so the 4.5.1 version of mosphp is called kl_php. This name change will help me in keeping track of my work, it gets confusing.

John

See attached for new version

Edited to ugrade kl_php so that it now takes care of output buffering internally.
Thanks John,
I did read this long thread, took notice of all problems and your advices.
Included a php file in static content and it worked like a charm!
Reading took me more time then to implement it and get it to working.

I like this gadget, it gives more dynamic to my content.

Krgds Wim.
__________________
These forum moderators keep removing my sig!
Freedom of mind and speech is not appreciated over here.
walb is offline   Reply With Quote
Old December 28th, 2004, 17:33   #114
konlong
 
konlong's Avatar
 
Join Date: Oct 2003
Location: Delaware
Posts: 457
konlong is on a distinguished road
Default

Thanks all, it is nice to share something which is appreciated.

Wim -- The twelve zone was my favorite

John
konlong is offline   Reply With Quote
Old December 29th, 2004, 05:56   #115
eintz
 
Join Date: Mar 2004
Location: ESTONIA
Posts: 20
eintz is on a distinguished road
Default

i read this thread from beginning to end, and i tried several hours, but i still have a problem to execute php in my static content.

i get an error:

Parse error: parse error, unexpected T_STRING in /myserver/mambots/content/kl_php.php(61) : eval()'d code on line 147

what does it mean?
__________________
Sorry about my English, I live in Estonia and we speak here in Estonian :)
eintz is offline   Reply With Quote
Old December 30th, 2004, 00:32   #116
philswallow
 
Join Date: Dec 2004
Posts: 5
philswallow is on a distinguished road
Default

Could it be something as simple as a syntax error? Like a missing "}" or ";" ? I had something similar and I had missed out a semi-colon. Have you tried your code in a PHP page before trying it in Mambo content page? Dreamweaver highlights code with different colours, making it easier to spot the odd error.


Sorry about my Estonian, I live in England and we speak Meteorology
philswallow is offline   Reply With Quote
Old December 30th, 2004, 00:48   #117
BeeStar
 
Join Date: Nov 2004
Posts: 8
BeeStar is on a distinguished road
Default

Quote:
Originally Posted by penseur
Hello,
<snap />
But when i tried to insert the following link I continue to recieve parsing errors.


I need "http://localhost/directory/index.ph...id=26&Itemid=75" inserted into my content.

I inserted the following code into my content:


{kl_php} include("http://localhost/directory/index.php?option=com_mtree&task=listcats&cat_id=26 &Itemid=75");{/kl_php}

And I still recieved parsing errors?


Jay
Jay,

it would be helpful if you would include the parse error itself in your post.

In the mean time, maybe this helps.

When you include using "http://localhost/directory/path/file" you don't have access in your script to variables (like $_POST) and the like. So that might give errors in your script.

Try including without the http: "/directory/path/file".

Good luck!


Maarten
BeeStar is offline   Reply With Quote
Old December 31st, 2004, 10:29   #118
philswallow
 
Join Date: Dec 2004
Posts: 5
philswallow is on a distinguished road
Default

Firstly: thanks so much to konlong for his excellent bot - it is really helping me in my first Mambo page (I'm a new-ish PHP-er).

Secondly: thanks to everyone else for their informative questions which I might have asked if I had known enough to ask them...

Thirdly:

In a content page, I am trying to insert a database field as the before-the-@-sign part of an email address. It would then become a context-specific mailto: link in that page so that incoming mails can be sorted easily on receipt.

I have been able on my front page (currently here - look on the right-hand side) to use PHP to pull some dates from my MySQL database, parse them and format them, stick them in string variables and insert them as the name part of an email thus:
<a href="mailto:<?php echo $tla,$startdateemail; ?>@smallchangecompany.com">book</a>
So, it works lovely in a PHP page. I have tried for hours now to make the same thing work in a Mambo CONTENT page. No luck and insufficient experience to over come lack of luck.

In that page here, I am using {kl_php} to successfully populate data from the database

Can anyone tell me what I need to do to make this (or some other solution) work in {kl_php} within a Mambo CONTENT page?

I have tried (to no avail) using a single "\" to escape the ", thus:
<a href=\"mailto:<?php echo $tla,$startdateemail; ?>@smallchangecompany.com\">book</a>
Happy New Year to you all!

Phil
philswallow is offline   Reply With Quote
Old December 31st, 2004, 14:00   #119
konlong
 
konlong's Avatar
 
Join Date: Oct 2003
Location: Delaware
Posts: 457
konlong is on a distinguished road
Default

Phil, your links do not work. As to your need,try:
<a href="mailto:{kl_php}global $tla, $startdateemail; echo $tla,$startdateemail; {/kl_php}@smallchangecompany.com">book</a>

you must of course precede this with a use of kl_php to instanciate the two variables and pace them in global space.

John
konlong is offline   Reply With Quote
Old January 1st, 2005, 17:02   #120
gatman
 
Join Date: Dec 2004
Posts: 32
gatman is on a distinguished road
Default Form Code

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}

Last edited by gatman : January 4th, 2005 at 11:33. Reason: Extraneous Code
gatman 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
Selecting Preview in the Menubar displays the Index to Mambo RanZid Installation Questions 3 December 20th, 2004 09:31
Mambo + php 5.0.1 fastonion Installation Questions 4 August 26th, 2004 19:54
Multiple Mambo Sites, One Code Base? cozimek General Questions 4 August 21st, 2004 03:58
fresh install - Template Manager blank peterm Installation Questions 3 July 28th, 2004 20:20
Installing Mambo 4.5 on php suExec and CGI-mode byTe Installation Questions 1 July 6th, 2004 06:20


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


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