PDA

View Full Version : Addon: Random Banner (gif, jpg)


Florid
08-02-2006, 12:44 AM
Random Banner (gif, jpg) addon for Pixelpost
Version 1.0
Displays random banner (gif, jpg) on your site.

Example here (http://greatitaly.com) and here (http://albumtravel.com). download it! (http://photoblogonline.com/upload/random_banner.zip)

================INSTALL=========================

1) UnZip archive
2) Copy your images in banner\ folder
3) Open banner\banner.txt file and edit it:

[URL]|[image path]|[description]

for example

http://photoblogonline.com|banner/photoblogonline.gif|Photos of the most beautiful places of a planet
http://greatitaly.com|banner/italy.gif|Photos of Italy

4) Upload folder 'banner' in your root dir
5) Upload 'random_banner.php' in yor addons dir
6) Use <SHOW_BANNER> in your template.htm
7) Enjoy!

Addon works (see example). But there is one mistake (it is visible in addons menu):

Warning: file(banner/banner.txt): failed to open stream: No such file or directory in /var/www/vhosts/photoblogonline.com/httpdocs/addons/banner.php on line 19

line 19: $array_bann = file ('banner/banner.txt');
:confused: If it can correct somebody, write to me, I shall correct a code and re-upload this addon
ok, now addon work with no error message :rolleyes:

GeoS
08-02-2006, 07:41 AM
Make some conditional statement for opening to use this file.

In 1.5 Final there should be global (for admin panel) variable $admin_panel set to 1 so it is enough to do it like that:

if($admin_panel != 1) $array_bann = file ('banner/banner.txt');

Florid
08-02-2006, 12:06 PM
Just replace this line? Has not helped :-(

GeoS
08-03-2006, 06:58 PM
Do you have PP 1.5 Final?

Oh and one more thing. If your addon is based on functions then you must add:
global $admin_page
at beginning of this function (otherwise this variable wont exist for function).

Florid
08-04-2006, 02:47 PM
Again 'Has not helped' :-(
if I use
file ('../banner/banner.txt');
than error message don't show in admin addons panel, banner-image don't show too :rolleyes:
maybe need to use $siteurl in file() ... or something like this?:confused:
On blog - OK, in admin addons - show error, not so it is terrible, but simply not beautifully looks :-)

Florid
08-05-2006, 09:29 AM
I put '@' before 'file' and addon work with no error-massage :rolleyes:
$array_bann = @file ('banner/banner.txt');
ZiP updated