Random logo images in my header code
Posted: Fri Jul 08, 2011 10:33 am
I want to have a randomised header image (logo) on my website, http://onemansweb.org, and also have that image hyperlinked back to the home page. I have the images working (code from Calguy) but cannot get a working link.
My code works in a plain html file.
I've run it in a dummy file which has no spreadsheets and templates attached.
I can also run it in the body of a page on my website, where the image is randomly dispayed, and the link works:
It will not run in my website when it is placed in a template header.
I can run the code without issues if I leave out the hyperlink:
I can only assume I have conflict with something else.If I include the hyperlink, I get the hyperlink working in the page header, but no picture.
Can anyone spot where the conflict occurs? My coding skills are limited.
Many thanks,
Andrew Prior
To clarify: I get a random logo, I have no hyperlink to home.
The code below is from a LAMP installation of CMS Made Simple⢠1.9.4.1 "Faanui"
The original template and stylesheet code is stock CMS since about 1.4, I think.
This is the original template code
This is the original stylesheet code
My code works in a plain html file.
I've run it in a dummy file which has no spreadsheets and templates attached.
I can also run it in the body of a page on my website, where the image is randomly dispayed, and the link works:
It will not run in my website when it is placed in a template header.
Code: Select all
{capture assign='headnum'}{1|rand:20}{/capture}
<h1>
<a href="http://onemansweb.org"><img src="uploads/images/headers/header_{$headnum}.jpg" alt="Australia" title="Australia" /></a>
</h1>
I can run the code without issues if I leave out the hyperlink:
Code: Select all
{capture assign='headnum'}{1|rand:20}{/capture}
<h1>
<img src="uploads/images/headers/header_{$headnum}.jpg" alt="Australia" title="Australia" />
</h1>
Can anyone spot where the conflict occurs? My coding skills are limited.
Many thanks,
Andrew Prior
To clarify: I get a random logo, I have no hyperlink to home.
The code below is from a LAMP installation of CMS Made Simple⢠1.9.4.1 "Faanui"
The original template and stylesheet code is stock CMS since about 1.4, I think.
This is the original template code
Code: Select all
<div id="header">
<h1>{cms_selflink dir="start" text="$sitename"}</h1>
<hr class="accessibility" />
</div>
I now have this in the template:div#header {
height: 201px; /* adjust according your image size */
background: #385C72;
}
div#header h1 a {
/ you can set your own image here */
background: #385C72 url(uploads/images/headers/header_02.jpg) no-repeat 0 1px; */
display: block;
height: 201px; /* adjust according your image size */
text-indent: -999em; /* this hides the text */
text-decoration:none; /* old firefox would have shown underline for the link, this explicitly hides it */
}
I now have this stylesheet<div id="header">
{* Random Headers follow *}
{capture assign='headnum'}{1|rand:20}{/capture}
<h1>
<img src="uploads/images/headers/header_{$headnum}.jpg" alt="Australia" title="Australia" />
</h1>
<hr class="accessibility" />
</div>
div#header {
height: 201px; /* adjust according your image size */
background: #385C72;
}
div#header h1 a {
}