Different part of template (image) for each subpage

How to display differt header image for each subpage in the same template

 

Include PHP Code - create code

We will use "Include PHP Code" module to manage this. . Your template will be recognized automatically by system. But it has to know, this file is a template. Your template need a name.

PHP Code:
<?php
$Header="header.jpg"; // this is default header

// now you need an URL address ID, usually it's like 1_1, 1_2, etc.
$Address = $page[0].'_'.$page[1];
if($Address=='1_1') echo 'homepage_header.jpg';
elseif($Address=='1_2')echo 'subpage_header.jpg';
else echo $Header;

?>

What this code mean? For homepage, with ID 1_1, system will use image "homepage_header.jpg", for page with ID 1_2, it'll use "subpage_header.jpg" and for any additional subpage, it'll use default image, "header.jpg"

Add code to Template

Now, edit template file. You can use built-in template editor, but we recommend HTML editor, where you have more control and you can undo your changes. Find an image's definition in your template, and if it's <img src="header.jpg" />, replace it with this code: <img src="{%include_header%}" />, then save changes and upload your template to server. Changes should be viewable in the same moment.

Your question is not listed here?

Please contact us.