This website can use cookies to improve the user experience

This website can use cookies to improve the user experience and to provide certain services and functions to users. Cookies contain small amounts of information (such as login information and user preferences) and will be stored on your device.

Enable All Cookies Privacy Policy

Using two different header templates


avatar
mark99 9
From: -
Using two different header templates

I'm just getting use to the code but am trying to solve a small problem I have. Presently I use two slightly different style sheets in my existings sites header to manage the front page format separately from content sections.

That is to say, my index.html has one primary style sheet and a second one for some custom changes. So, for example, on my front page I might use these two. This allows me to use a radically different format on the front page without screwing up my divs and browser compatibility, while keeping the basic theme the same:

ss_main.css
ss_main_front.css

The main_front just takes some common stylesheet ID's and gives them a different format. Then for all the other content sections of my site I reverse this using another / different ss for those same ID's again:

ss_main.css
ss_main_content.css

Naturally this means that I have two header template files to call the two different CSS files and so my question is, am I able to define two different header templates for specific sections and or individual pages of the site with CT?

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.

Responses to this topic


1 Re: Using two different header templates
avatar
Editor
0
From: -
The easiest way to doing this is a small modification in the site_header template.

Click on “Add PHP part to this template” and add the following code to the PHP part:

global $ct;

$stylesheet = 1;
if ($ct == "content") $stylesheet = 2;


Basically, the first stylesheet of the first template set will be used as default. For any pages that would be called from the content module the second stylesheet will be used. You can do this with any of the other modules.

You also need to change the following in the HTML part:

 <link rel="stylesheet" type="text/css" href="https://www.contentteller.com/contentteller.php?ct=core&amp;action=css&amp;id={$insert['site_theme']}" title="Theme #{$insert['site_theme']}" />


to:

 <link rel="stylesheet" type="text/css" href="https://www.contentteller.com/contentteller.php?ct=core&amp;action=css&amp;id={$stylesheet}" title="Theme #{$insert['site_theme']}" />


If you prefer an external stylesheet instead, you need to change the PHP part like this:

global $ct;

$stylesheet = "contentteller.php?ct=core&amp;action=css&amp;id=1";
if ($ct == "content") $stylesheet = "images/ss_main_content.css";


This example would use the CSS from the first template set as default and an external CSS that is located at images/ss_main_content.css for the content page:

The HTML part must look like this:

 <link rel="stylesheet" type="text/css" href="https://www.contentteller.com/{$stylesheet}" title="Theme #{$insert['site_theme']}" />

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.