Indexhibit
Index + Exhibit

Login:

Created by
Daniel Eatock
Jeffery Vaska
And You

Pre-nav random image

 

Indexhibit version: Legacy
Thread is not resolved.

bille2630
DENMARK
3 year(s) ago
Permalink Post

My homepage is http://www.msoerensen.dk
I have been able to put my logo in the pre-nav text,
but i have more styles of the logo, so I was wondering
if it is possible to make a random image selecter ?
So it just takes a radom style of my logo ?
I have look, and tried the javascript kind of it but couldn't
get it working.

Hope you can help me

bille2630
DENMARK
3 year(s) ago
Permalink Post

the homepage msoerensen.dk

Vaska A
UNITED STATES
3 year(s) ago
Permalink Post

The big MGS logo at the right?

What I often recommend that people do is create an exhibit and leave it unpublished. Then, they can upload their random images to it.

If you were to create a simple plugin that grabbed images from that particular exhibit you could do what you wanted. Something along these lines...

  1. <plug:random_logo />

And the code...

  1. function random_logo()
  2. $OBJ =& get_instance();
  3. $background = $OBJ->rs->fetchRecord("SELECT * FROM ndxz_media 
  4. WHERE media_ref_id = '25' 
  5. ORDER BY RAND() LIMIT 0,1");
  6. return "<img src='" . BASEURL . "/files/$background[media_file]' />";

25 is made up - that should be whatever the 'id' is of the unpublished exhibit.

I am sure this needs more work but give it a try and we'll walk you through the rest.

;)

bille2630
DENMARK
3 year(s) ago
Permalink Post

Thanks, i will try that and report back of how it goes..

bille2630
DENMARK
3 year(s) ago
Permalink Post

I don't quite understand it
As far as i understand, i am supposed to make a plugin with this code:

function random_logo()
$OBJ =& get_instance();
$background = $OBJ->rs->fetchRecord("SELECT * FROM ndxz_media
WHERE media_ref_id = '25'
ORDER BY RAND() LIMIT 0,1");
return "";

I don't quite understand which parts of the text i shall write in..

And then in my pre-nav text i direct it to the plugin i make ?

Vaska A
UNITED STATES
3 year(s) ago
Permalink Post

In pre-have you put this for the image...

  1. <plug:random_logo />

Then, you create a plugin in a file called "plugin.random_logo.php" and put the contents above in it. Open up another plugin to see how it works (you also need to add the opening PHP line.

Luis_Silva
PORTUGAL
2 year(s) ago
Permalink Post

hello :)

my site is kunsthalle-lissabon.org/ and I'm trying to use this to randomize the logo. My only question is I don't know what is the id of the unpublished exhibit. Do you know where to find it?

Thanks!
Luis

Showing 1 - 7 of 7 posts in Forum » Customize » Pre-nav random image
 

This thread has been closed, thank you.