WebsiteBaker Support (2.8.x) > Templates, Menus & Design
Standard logo and changing background
Argos:
Not the same method, but the same result is to let your clients upload a header with a fixed name, for example "header-alt.jpg" to some Media-folder and call that image directly with the function below.
--- Code: ---<?php
if (file_exists('http://www.awebsite.nl/media/headers/header-alt.jpg') ) {
echo '<div style="background:url(http://www.awebsite.nl/media/headers/header-alt.jpg) 0 0 no-repeat;width:123px;height:123px;"></div>';
} else { echo '<div style="background:url(http://www.awebsite.nl/media/headers/standardheader.png) 0 0 no-repeat;width:123px;height:123px;"></div>'; }
?>
--- End code ---
Not tested :roll:
nibz:
I think this will also not work. Because it will allways try to load the alt image.
There is no check if there is or isn't a image.
I think your initial idea will work with some additional javascript to remove <img src" and ">.
To obtain only the url of the image.
But i'm no javascript expert
Argos:
--- Quote from: nibz on November 22, 2012, 02:40:58 PM ---There is no check if there is or isn't a image.
--- End quote ---
But there is a check, isn't there? IF the alternative image exists, THEN use that image as background. IF the alternative image NOT exists, THEN show the regular image as background.
nibz:
My bad. It checks for the alt file.
Hans:
Interesting question isn't it ;-)
It's now a pure academic one because the client has decided to use different images with the logo on it (can be inserted as shown in the first post), but maybe (and I hope) someone finds a way nevertheless, because it could bring a multi-face site with only one template a step nearer.
Thanks for your contributions so far!
Hans
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version