1
PocketLnt
Strange error in custom PHP blocks
  • 2006/4/19 15:38

  • PocketLnt

  • Just popping in

  • Posts: 4

  • Since: 2006/4/19


I run the sitehttp://www.teamhackaday.com and I must say that I'm very happy with the XOOPS portal system. It's very flexible and the PHP blocks allow for some very interesting customizations.

I was originally running the site on a webhost donated by an acquaintance of mine, but as the group grew our needs for beefier and more reliable hosting grew. Thus, we moved the site to dreamhost.com and are very happy with their rates and services. (Not a plug, just personal backstory)


Everything is working wonderfully save for a strange error that I'm getting with the custom PHP blocks that I've written to display stats and other information. While on the personal host all was working well, but the same code doesn't want to work with the new host.

With PHP debugging enabled the error that I'm getting on the block is:

Parse error: syntax error, unexpected T_STRING in /homedirectoryisactuallyhere/modules/system/blocks/system_blocks.php(40) : eval()'d code on line 78

When I try to edit the block the code in error comes up as:

printf("<tr><td align="right">Team Rank:</td><td>%s</td></tr>n", number_format(return_val( $myFile->data[0]['child'][0]['child'], 'RANK')) );

Obviously this is due to the fact that the quotes around "right" are not escaped, so I escape these characters and submit the form. I get a message telling me that all went well, but no! The crass program has lied!

I get the same error and upon checking the source of the block again it shows the same line as before. In fact, further checking shows that all my escape charaters "/" are gone! I checked the database and sure enough the escape characters are there in the table, but they do not show up in the edit box of the custom block editor.

Like I said, very strange indeed.. but any help that anyone can offer will be most appreciated.

The setup is almost identical from host to host, the only difference being that the MySQL version changed from 4.1 to 5.0, but all tables check out A-OK. Any ideas?

2
Liliplanet
Re: Strange error in custom PHP blocks
  • 2006/4/19 16:12

  • Liliplanet

  • Just popping in

  • Posts: 31

  • Since: 2006/4/16


Hi.

I've got exactly the same problem. Have rss feeds in the custom block, yet nothing appears. html and plain text is fine.

Also on Dreamhost, have you perhaps found the solution?

Look forward to your reply.
Lilian

3
Liliplanet
Re: Strange error in custom PHP blocks
  • 2006/4/19 18:15

  • Liliplanet

  • Just popping in

  • Posts: 31

  • Since: 2006/4/16


Just to mention .. when I use php includes or rss on Dreamhost it works fine, it is just in XOOPS custom blocks.

When I look in MySQL file it's all there, but the output in html deletes the top line, i.e. <?PHP thus script does not execute.

Anyone perhaps have an idea how to fix this please?

Lilian

4
Will_H
Re: Strange error in custom PHP blocks
  • 2006/4/19 19:51

  • Will_H

  • Friend of XOOPS

  • Posts: 1786

  • Since: 2004/10/10


When creating a custom block you can select the content type just above the submit button.

I have found that auto-format works the best.

5
Liliplanet
Re: Strange error in custom PHP blocks
  • 2006/4/19 19:54

  • Liliplanet

  • Just popping in

  • Posts: 31

  • Since: 2006/4/16


Thank you for your reponse. I tried all the 3 (or 4?) options, to no avail.

I'm now upgrading to 2.2, maybe that will work.

Again, thank you.
Lilian

6
shank
Re: Strange error in custom PHP blocks
  • 2006/4/19 19:58

  • shank

  • Not too shy to talk

  • Posts: 144

  • Since: 2004/8/17


In your custom php block put this before your code

?><?php


See if that works
s l s h a n k l e @ b e l l s o u t h . n e t

7
Liliplanet
Re: Strange error in custom PHP blocks
  • 2006/4/19 20:07

  • Liliplanet

  • Just popping in

  • Posts: 31

  • Since: 2006/4/16


thanx, ... thought of that as well ... did <?<? and that's what it deletes .. <? .

bizarre, still busy upgrading, hope that works.

soon I hope with success.
Lilian

8
Will_H
Re: Strange error in custom PHP blocks
  • 2006/4/19 20:16

  • Will_H

  • Friend of XOOPS

  • Posts: 1786

  • Since: 2004/10/10


yes well i was under the impression that if you selected it as a php script it automatically added <? around the script.

9
Liliplanet
Re: Strange error in custom PHP blocks
  • 2006/4/19 20:38

  • Liliplanet

  • Just popping in

  • Posts: 31

  • Since: 2006/4/16


maybe I did something wrong or it was not possible?

in a custom block I added:

<?PHP
$number=3;
$category=5;
include("/home/mysite/edition/show_news.php");
?>

and all I could see when published was:

$number=3;
$category=5;
include("/home/mysite/edition/show_news.php");
?>

basically bringing in news from my existing news application. It generally works in any php file.

was this perhaps incorrect ... or is this not possible? Surely to include rss files would be the same?

Thank you so much for your guidance.
Lilian

10
shank
Re: Strange error in custom PHP blocks
  • 2006/4/19 22:21

  • shank

  • Not too shy to talk

  • Posts: 144

  • Since: 2004/8/17


I meant put a closing php tag then reopen php again.
s l s h a n k l e @ b e l l s o u t h . n e t

Login

Who's Online

175 user(s) are online (100 user(s) are browsing Support Forums)


Members: 0


Guests: 175


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits