Forums » Announcements
Plugin: Random Background main page
  • Pages:
  • 1
  • 2
Vaska
I WROTE THIS
2007-07-15 12:32:59
 

I've released the random background for the main page plugin. This is a slightly advanced plugin, but is not difficult to use.

What does it do?
It places a random image into the background on the main page of your site.

How to install?
Download and add the plugin into your /ndxz-studio/site/plugin folder.

You need to edit your template in a text editor. Replace the 'backgrounder' plugin with:

<plug:ndxz_rand_bg folder_name,tiling />

folder_name: name of the folder which holds your images (you need to use ftp to place them).

tiling: 'true' for tiling...'false' for no tiling (big images).

Save your changes, test it. Be sure you have the name of the folder correct.

This is a slightly experimental plugin. If it does not work the first place you should check is on the name of the path to your images folder. Some servers may have difficulty finding this folder...if this is the case, use a hard-coded path.

Download @: plugin.ndxz_rand_bg.php.zip

Vaska
I WROTE THIS
2007-07-15 12:46:32
 

Demo page

Refresh the page a few times.

moodie
AUSTRALIA
2007-07-16 11:36:43
 

Hey Vaska,

I've played around with this, but so far no luck. this is my code:

I made a folder in the files folder called 'random' which has my images in it, but am unsure as to where I am referencing the folder from? is it from the template file (which i am assuming is my index file in with the theme), or the index.php in the root directory?

thanks, aaron

moodie
AUSTRALIA
2007-07-16 11:37:38
 

code isn't posting

(plug:ndxz_rand_bg files/random,false /)

Vaska
I WROTE THIS
2007-07-16 11:47:56
 

Something really isn't right there. It's not even producing the output. You sure the plugin is loaded into the plugin folder?

moodie
AUSTRALIA
2007-07-16 12:06:51
 

i don't know what i did, but the plugin wasn't there ... its working now, though its tiling body bg and the 'false' isn't working ...

moodie
AUSTRALIA
2007-07-16 12:56:45
 

vaska, couldn't get the image to stop tiling, so ended up editing the plugin and setting the css in there to 'no-repeat'. also found the image went into the right place by placing the x & y co ordinates in the 'background' css, as opposed to the 'background-position'.

Vaska
I WROTE THIS
2007-07-16 13:04:39
 

Niiiiiiiiiiiiice....

I made a note about the positioning...it seems you've adjusted your css so that adjustment is necessary. I'll fix the problem with true and false...I see where that is wrong.

Thanks for messing with that...we nabbed a bug in the process. ;)

moodie
AUSTRALIA
2007-07-17 09:38:15
 

no problems! now I just got to get some images together to make it work properly .. :)

mejo
UNITED KINGDOM
2007-07-31 10:05:56
 

Hi Vaska,

Followed all instruction carefully.
Images in ndxz-studio/rnd-images
updated template (the index.php in my template folder) so it says

and still nothing.

Ive tried playing with bits of the code and different alternatives but really not that sure what I'm doing.. will keep having a go though! Any ideas would be greatly appreciated.

Thanks,
Will

mejo
UNITED KINGDOM
2007-07-31 10:06:49
 

to recap on the missing code:

...updated template (the index.php in my template folder) so it says.. plug:ndxz_rand_bg rnd-images,false /

W

Vaska
I WROTE THIS
2007-07-31 12:04:11
 

Nope...the name of the folder is fine, but the folder should exist in the ROOT of your site. Where you put your 'files' folder...place your 'rnd-images' folder at that level.

Gorcika
FRANCE
2007-09-11 12:45:47
 

Hi,
sorry but it doesn't work for me I did everything fine but now when I go to my website I have:

Parse error: syntax error, unexpected '(', expecting T_STRING in /home/wb55221/ndxz-studio/site/plugin/plugin.ndxz_rand_bg.php on line 17

and in the 'plugin.ndxz_rand_bg.php (which is the plugin folder), I wrote this:

function plug:ndxz_rand_bg files/image fond/fond boisA.jpg, false /
{
global $rs;

if ($rs['url'] == '/')
{
// get our images
$path = DIRNAME . "files/image fond/fond boisA.jpg";

if (is_dir($path))
{
if ($fp = opendir($path))
{
while (($module = readdir($fp)) !== false)
{
if ((eregi("jpg$", $module)) || (eregi("gif$", $module)) || (eregi("png$", $module)))
{
$images[] = $module;
}
}
}
closedir($fp);
}

$image = count($images);
$rand = rand(0, $image-1);

$show = BASEURL . "/$folder/" . $images[$rand];

$tile = ($tile == true) ? 'repeat' : 'no-repeat';

// this 215px setting may need to be adjusted if you have altered your Index in the template
$style = "body { background: url($show) $tile;\nbackground-position: 215px 0; }\n";
return $style;
}
else
{
return backgrounder($rs['color'], $rs['bgimg'], $rs['tiling']);
}

return;
}
WHAT'S WRONG ?
Thanks

Vaska
I WROTE THIS
2007-09-11 13:57:38
 

Don't touch the plugin itself in the plugin.ndxz_rand_bg.php file. When you add the plugin to your template...in to the space I say to do so...add it like...


<plug:ndxz_rand_bg 'files/image',false />

This is assuming that your images are going into the 'files' folder in another folder called 'image'.

Hope this helps.

alexkickham
UNITED KINGDOM
2007-10-12 08:52:21
 

Instead of random uploaded images is it possible to use random url's? e.g. ones from your flickr account?

Vaska
I WROTE THIS
2007-10-12 08:57:59
 

If you write a plugin to do that it's possible. But, not with this one. Although you could try editing it up.

needlnerdz
SWITZERLAND
2007-10-22 10:21:30
 

Of course I have to want to alter the way things are... and have such little knowledge as to how to do it. Could someone suggest how I might go about limiting the random background selection to only files with 'th-' in the front of them? I am using the main gimgs folder.. however the tiling only really works when it is from the thumbnail.. thus I'd like to filter the plugin to only look at those files. I came close in my altering- but was only able to get it to use the th- then add it to any other file.. so the 'sys' ones caused a blank background.

Any advice would be grand.

cheers

Markuz
UNITED KINGDOM
2007-11-02 13:03:34
 

moodie said:

vaska, couldn't get the image to stop tiling, so ended up editing the plugin and setting the css in there to 'no-repeat'.

I'm having probs with the image repeating horizontally on wider screens.

Is this something I can edit?

mellotone
UNITED STATES
2007-12-20 15:33:52
 

Hi Vaska,

I installed the random image plugin and it seems to work no problem.However, now in the very upper left corner of my site is a piece of code showing that looks like the greater than/less than symbols

Here's my site www.russellaustin.com

Seems like this might be an easy fix I'm just not sure where to do this at.

thx

Vaska
I WROTE THIS
2007-12-20 16:43:37
 

I don't see a link to Indexhibit on your site...sorry...can't help you until you have one.

mellotone
UNITED STATES
2007-12-20 18:16:11
 

It was not intentional, that exhibit was hidden and now it is not.
Is that the link back to indexhibit that you were referring to?

Thx!

On a side note, I would like to be added to the participants list, if possible.

; )

Vaska
I WROTE THIS
2007-12-20 18:33:31
 

Whoa...first of all...what version are you using? That's oolllllddd...

Thanks for the link...your links make this project worthwhile for us and everybody.

The problem is pretty simple...in your template it appears that you have something leftover that should note be there...I see this...

I can't show it because I need to upgrade this forum...blah.

Between your '/script' tag and your 'head' tag there are the brackets that you should remove from the template.

The empty brackets should be removed.

;)

mellotone
UNITED STATES
2007-12-20 18:51:55
 

Right on.

I know, I've been reluctant to run the upgrade out of fear that it might lead to more problems. I just need to get on with it.

Thanks for the bracket tip.

Respect as always!

Vaska
I WROTE THIS
2007-12-20 18:52:57
 

Yes, wait on the upgrade though...new version soon. Big fundamental changes.

plugimi
UNITED KINGDOM
2008-01-19 20:49:55
 

hm, where's that template? do you mean 'template.php'? or 'exhibit.backgrounded.php'? cheers, sascha

Showing 1 - 25 of 40 posts in Forum > Announcements > Plugin: Random Background main page
 
  • Pages:
  • 1
  • 2