SimplePortal

Support => English Support => Topic started by: Anaksimandar on October 03, 2008, 06:14:15 AM

Title: PHP block issue
Post by: Anaksimandar on October 03, 2008, 06:14:15 AM
SMF version 1.1.6
Theme Grunge
SimplePortal version 2.0.4
Forum link: http://veselaekipa.net

Issue:
I'm trying to set a block that will display team speak server status with channels and players, so I decided to go with PHP block as it is most convenient way since it is a PHP script :). Anyway I've first tried to input whole PHP script in the block contents, but when done like that it is just producing parse errors since there are html parts at the begining of the mentioned PHP script.

So than I tried just to include the script tsdisplay.php which is the one that I need parsed, it worked, but with an confusing issue, it does not include any of the images or .css files that are called by that script even though when tsdisplay.php is directly opened it works like a charm:
direct link to working thing: http://veselaekipa.net/tsdisplay/tsdisplay.php
You can check the not working properly block at: http://veselaekipa.net its the left block after who's online

Here are the contents of that PHP block:
Code: [Select]
include("/home/vekipa/public_html/tsdisplay/tsdisplay.php");
So I'm really confused why it doesn't pull images and .css files at all.

Any ideas?

If anything else is needed like for example tsdisplay code I'll be happy to pack it and attach it.
Title: Re: PHP block issue
Post by: Nathaniel on October 03, 2008, 06:37:06 AM
It doesn't pull the css or images, because you use relative paths to show/include them. That means that if you load the file from the outside page, then it will pull the file/image from the correct place, but if you try to pull it from the forum the path will be different so it won't work.

So by using this path in your html code 'tsdisplay.css', from the outside file it tries to pull the css file from this url:
"http://veselaekipa.net/tsdisplay/tsdisplay.css", which works.
For the forum page it tries to pull it from this url: "http://veselaekipa.net/tsdisplay.css", which doesn't work because its the wrong location.

To fix this, add 'http://veselaekipa.net/tsdisplay/' to the start of each the 'href' or 'src' value for the css includes and images. ;)
Title: Re: PHP block issue
Post by: Anaksimandar on October 03, 2008, 07:50:00 AM
/me banging head against the wall

LOL, well i was really dumb there, thank you for pointing that out, works like a charm ofcourse, thank you again :)
SimplePortal 2.3.8 © 2008-2024, SimplePortal