hi,
As I read this site ( http://ubdc.net/ ) that each pages is showing their own header image, how can I do that? many thanks
angus
Custom template with different header image
Re: Custom template with different header image
Check this post. It holds some info and also a link to another solution.
http://forum.cmsmadesimple.org/index.ph ... 547.0.html
Ronny
http://forum.cmsmadesimple.org/index.ph ... 547.0.html
Ronny
Re: Custom template with different header image
Hi Ronny,RonnyK wrote: Check this post. It holds some info and also a link to another solution.
http://forum.cmsmadesimple.org/index.ph ... 547.0.html
Ronny
I've read the link through the link you provided.
( http://wiki.cmsmadesimple.org/index.php ... y-position )
But I still don't understand where to put those code. Can you show me some more details for it.
eg: which file? (and also put in which directory?) I don't know what UDT is.
Thanks.
Re: Custom template with different header image
UDT stands for User Defined Tag, which can be put under "Extensions -> User Defined Tags". You can create some code there that you can call in the templates to have the logic there.
Ronny
Ronny
Re: Custom template with different header image
I see.RonnyK wrote: UDT stands for User Defined Tag, which can be put under "Extensions -> User Defined Tags". You can create some code there that you can call in the templates to have the logic there.
Ronny
After I understand those ideas, it looks pretty stupid that every page title needs a unique css header.
So I make an automatic script that my client not needed to type css himself (he knows nth on the code).
all header image (using .jpg here) stored in the folder "images/cms/header/" and rename as the value of {$page_name} of that page.
The file "showHeaderImage.php" is stored in the root path.
ie: the same path as config.php
Code: Select all
<?php //showHeaderImage.php
function LoadJpeg($imgname)
{
$width = "1000";
$height = "300";
$im = @imagecreatefromjpeg($imgname); /* Attempt to open */
if (!$im) { /* See if it failed */
$im = imagecreatetruecolor(386, 590); /* Create a black image */
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, $width, $height, $bgc);
/* Output an errmsg */
imagestring($im, 1, 5, 5, "Error loading $imgname", $tc);
}
return $im;
}
$path = "./images/cms/header/"; // you have to create this folder yourself
if (isset($_REQUEST['page']) && file_exists($path . $_REQUEST['page'] . ".jpg"))
$printImage = $_REQUEST['page'];
else
$printImage = "home"; // this is the default header image
header("Content-Type: image/jpeg");
$img = LoadJpeg($path . $printImage . ".jpg");
imagejpeg($img);
?>
Code: Select all
<img src="showHeaderImage.php?page={$page_name}" width="1000" height="300" />
Angus