Random Logo

Hi again,



Now that i have my logo placed where i want it. Ideally i would like to be able to load a random logo image each time i refresh the site or click on to a new page.



Simply my logo name will stay the same but the image to the right of it will vary in colour and i want that to be random each time a page loads.



I can do this quite easily in a HTML file using javascript. But since CScart uses all these TPL files and other such wonderful bits and pieces, i really dont know how to get this to work.



All i can think of doing so far is creating several logo images and copying them to the image folder where they should be.



Can anyone help?



Thanks



Tom

simple way:

upload transparent image to your logo, in styles.base find this part of code:

.logo-image {

insert width and height parameters, and background-image path (wich will be yours logo)

then create in admin area some HTML block, for example “styles” and copy this code:

.logo-image {
width:width of your new logo;
height: height of your new logo;
background-image:path to your new logo;
background-repeat:no-repeat;
}


and then change this parameters on each page, where you want to change your logo

Hmm, although that would work, it requires quite a bit of work to edit every page. I was hoping to add some code into the top.tpl file that would randomly load the images from a selection.



That way even when the same page is reloaded it may change the logo at the top of the page.



I am not overly familiar with TPL files having only been introduced to them with cscart. Is it possible to add html code to them or is there some other programming type language used.



Thanks



Tom

Create a addons/my_changes/controllers/customer/init.post.php.

Use PHP to establish the logic you want to randomly select from some set of filenames of your logos.

Then set a template variable like:

Registry::get('view')->assign('logo_filename', $filename);



Then you can use {$logo_filename} as the href attribute of the logo image.

This is the easiest way:

http://javascript.internet.com/miscellaneous/random-image.html

[quote name='snorocket' timestamp='1312784226' post='119094']

This is the easiest way:

http://javascript.internet.com/miscellaneous/random-image.html

[/quote]



Whereabouts would i put this code though?? would i need to create a JS file and link to it??



Thanks



Tom