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
I see.
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);
?>
And then type this in your template:
Code: Select all
<img src="showHeaderImage.php?page={$page_name}" width="1000" height="300" />
But this still cannot solve the problem of page dependency. For example there's several pages under the hierarchy of "Products", all of them need to have their own custom header image or otherwise it will use the default one (home.jpg). So you may create them all or just copy and paste of the "Products" version.
Angus