Using other portal code in a Mambo php module

Started by weightman, March 19, 2009, 11:26:43 PM

Previous topic - Next topic

weightman

Hi, I have a php module installed on my mambo. It is good for including SMF SSI as modules. I had the treasury/donation TinyPortal code working in the Mambo module but had to make a change and now it is not working. I am not sure why. And, I can't make the similar looking SMG TP block work either, with similar errors produced.

For instance, this works fine (from gallery I am preparing to uninstall):

<?php ssi_galleryrandom(); ?>

But, this donations/treasury block does not and produces the errors below:

<?php include($sourcedir/DonationBlock.php");
global 
$sourcedir;
?>


Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/xxxxx/public_html/modules/mod_php/tmp/html5M7NPN on line 1

Parse error: syntax error, unexpected '"' in /home/xxxxx/public_html/modules/mod_php/tmp/html5M7NPN on line 1

This code also does not work and produces the error below:

<? global $sourcedir;
php include($sourcedir/DonationBlock.php");
?>


Parse error: syntax error, unexpected T_INCLUDE in /home/xxxxxx/public_html/modules/mod_php/tmp/htmlnzhNGO on line 2


Some help would be most appreciated!

Thanks!

capabmx

<?php include($sourcedir/DonationBlock.php");
global 
$sourcedir;
?>
Might help if it were changed to
<?php include("$sourcedir/DonationBlock.php");
global 
$sourcedir;
?>
Notice the quotations added behind the $ in the parenthesis
Always looking to take on a web design/ programming job :], PM me if interested.

weightman

That code produces this error:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/xxxxxx/public_html/modules/mod_php/tmp/htmlMDYRL2 on line 1

Parse error: syntax error, unexpected $end in /home/xxxxxx/public_html/modules/mod_php/tmp/htmlMDYRL2 on line 3

Thanks for trying to help! Please keep it up!

Orstio

First, you need to global the variable BEFORE you use it.

Second, the code should look like this:

<?php 

global $sourcedir;

include(
$sourcedir "/DonationBlock.php");

?>

weightman

Still didn't work. Maybe the php module is buggy?

Orstio

If this is inside a pre-built Mambo module, perhaps it is escaping certain characters?

<?php 

global $sourcedir;

include(
$sourcedir '/DonationBlock.php');

?>

weightman

#6
Quoteperhaps it is escaping certain characters?

That sounds possible. When I publish a module that doesn't work, the code I used gets a bunch of slashes added to it on the refresh. That code didn't work either- very similar errors including unexpected character for a /. So, I removed the slashes and the home page didn't crash but the module still didn't work displaying code in the spot it was supposed to be displayed:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/xxx/public_html/modules/mod_php/tmp/htmlEuSfRx on line 5

Warning: Unexpected character in input: ''' (ASCII=39) state=1 in /home/xxx/public_html/modules/mod_php/tmp/htmlEuSfRx on line 5

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/xxx/public_html/modules/mod_php/tmp/htmlEuSfRx on line 5

Warning: Unexpected character in input: ''' (ASCII=39) state=1 in /home/xxx/public_html/modules/mod_php/tmp/htmlEuSfRx on line 5

Warning: include(/home/xxx/public_html/smf/SourcesDonationBlockphp) [function.include]: failed to open stream: No such file or directory in /home/xxx/public_html/modules/mod_php/tmp/htmlEuSfRx on line 5

Warning: include() [function.include]: Failed opening '/home/xxx/public_html/smf/SourcesDonationBlockphp' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxx/public_html/modules/mod_php/tmp/htmlEuSfRx on line 5


It looks like the module removed the . between the filename and its extension DonationBlock.php...

Thanks for the help!  :D

Orstio

Seems to be a bug, either in the module, or in Mambo.  It's adding slashes to input where it should not.

weightman

Okay, thanks. Maybe I will try to uninstall and reinstall the module.....it used to work!

Cheers

Advertisement: