1
jusui
fetch php script not parsing right in block :(
  • 2003/10/26 16:43

  • jusui

  • Just popping in

  • Posts: 17

  • Since: 2003/9/29


I have a php fetch script that I am attempting to insert into a custom block. If I leave it set to 'php script', nothing happens and the script does not get executed (or if it does, nothing shows up in the block anyways). If I set it to HTML, the preview in the block admin works great, but when I actually submit it and then go look at the news page which is where it should show up, the entire page is completely messed up and the block content is not staying in the block or parsing correctly. whats going on??
Here is a screencap of what it looks like broken:
screencap1
and what it SHOULD look like (as the preview correctly works):
screencap 2
this is essentially what would happen if the php open and close tags were being ignored and the content just spit out like text, but why is it working in preview and not in the block?? It also works if I plop the script onto the site anywhere as a single php file and then go to the url in the browser.

I am not able to get CJay Content or Freecontent to include it correctly as a php file either.

Any help is appreciated! This is a critical piece to my site!

2
jusui
Re: fetch php script not parsing right in block :(
  • 2003/10/28 17:28

  • jusui

  • Just popping in

  • Posts: 17

  • Since: 2003/9/29


ok, an update to this question:

what about using includes in a block? why is it they will work from everywhere else except in the block itself? is there a trick to it (or a path rule?).

for now what I have done is used the TinyContent module to wrap in an html file that in turn includes the php (this is the only content module that works for this!) and then I have used the spotlight mod to enable a recent news block. With this method, is there a way to hack it to get the other news blocks (such as new news etc) to show up here? This was available in past versions of XOOPS and suddenly was taken away.

3
skalpa
Re: fetch php script not parsing right in block :(
  • 2003/10/28 20:42

  • skalpa

  • Quite a regular

  • Posts: 300

  • Since: 2003/4/16


Quote:
what about using includes in a block? why is it they will work from everywhere else except in the block itself? is there a trick to it (or a path rule?).

It's because blocks get processed through smarty...
And by default, it disables processing of php tags within templates (so you can allow someone to update some templates, he won't be able to insert code).
If you're the only one to manipulate templates on your site and you thrust yourself you can change this:

Edit /class/smarty/Smarty.class.php and find this line (in my version it's line 200):

Quote:
var $php_handling = SMARTY_PHP_PASSTHRU;

and replace it with:
Quote:
var $php_handling = SMARTY_PHP_ALLOW;

I haven't personally tested it, but it should work...

Skalpa.>

4
phanoko
Re: fetch php script not parsing right in block :(
  • 2004/3/11 3:48

  • phanoko

  • Just popping in

  • Posts: 18

  • Since: 2003/1/22


Anyone get this working? I've attempted but to no avail..I edited the Smarty.class.php file and get no love.
Here's my script.....

$ip = $_SERVER['REMOTE_ADDR'];
$fullhost = gethostbyaddr($ip);
$brw = $_SERVER['HTTP_USER_AGENT'];
$host = preg_replace("/^[^.]+./", "*.", $fullhost);
?>

Your IP address:

Host:

Browser:

5
Dave_L
Re: fetch php script not parsing right in block :(
  • 2004/3/11 10:17

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Where are you putting that code? If it's in a custom block, omit the opening and closing tags because they're inserted automatically.

There's no need to edit Smarty.class.php.

6
phanoko
Re: fetch php script not parsing right in block :(
  • 2004/3/15 0:10

  • phanoko

  • Just popping in

  • Posts: 18

  • Since: 2003/1/22


It is in a custom block an HTML block and when I remove those tags it doesn't seem to like it anymore. Meaning it just echo's the code into the block.

7
Dave_L
Re: fetch php script not parsing right in block :(
  • 2004/3/15 1:31

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


If you want the block to interpret PHP code, the block Content Type needs to be PHP Script, not HTML.

8
phanoko
Re: fetch php script not parsing right in block :(
  • 2004/3/15 16:18

  • phanoko

  • Just popping in

  • Posts: 18

  • Since: 2003/1/22


When I have done that (with or without the ) nothing happens at all. I hit preview and my blank window pops up.

9
Dave_L
Re: fetch php script not parsing right in block :(
  • 2004/3/15 16:23

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Start with something simpler. Put this (and nothing else) in a PHP Script block, and verify that it works:

echo "Hello, World!";

10
phanoko
Re: fetch php script not parsing right in block :(
  • 2004/3/15 23:55

  • phanoko

  • Just popping in

  • Posts: 18

  • Since: 2003/1/22


The echo worked.

Login

Who's Online

351 user(s) are online (224 user(s) are browsing Support Forums)


Members: 0


Guests: 351


more...

Donat-O-Meter

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

Latest GitHub Commits