Invoking custom header/footer Invoking custom header/footer
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Invoking custom header/footer

Started by DaMysterious, April 25, 2009, 01:11:45 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DaMysterious

Since 1.4.x we have the ability to invoke a custom header/footer from in the theme configuration. As my themes will have a custom header/and footer for 1.5.x which suites the theme (some did already in 1.4.x), is it possible to have that link directing by default through the used/chosen theme or can this be overruled in theme.php?

Simply specify a file name like "include_custom_header.html" instead of the path info e.g. themes\prorandom\include_custom_header.html would be more logical at that place thought.


Edit: Sorry to have bothered you, after some sleep I was able to modify header and footer function in theme.php that way to display custom header/footer as I would like to have for my themes.


    $filename = './themes/' . $CONFIG['theme'] . '/include_custom_header.html';
   
    if (file_exists($filename)) {
        $custom_header = cpg_get_custom_include($filename);
    } else {
        return false;
    }
DaMysterious.

Joachim Müller

The custom header and footer are just config vars, so they can be overriden in your theme.php as any other config var. Use $config['custom_header_path'] = 'foo/bar/whatever';
$config['custom_footer_path'] = 'foo/bar/whatever';
although I'm strongly opposed to the idea of a theme designer to abuse that variable: you can easily use a regular include in your custom theme, so why remove the feature for the end user: the custom header and footer includes are meant to enable users to include their custom, dynamic content, not yours.
If you should abuse the custom header and footer variables, your theme will not be listed on our demo, as we use the feature to include the overall site navigation and the theme and language selectors in a different way than usual.
If you need includes in your theme, modify the pageheader and pagefooter functions instead of messing with the variables that is meant to provide fexibility to end users. It's not meant to provide a tool for theme designers, and I simply can not see a legitimate point in abusing the variables.

Don't get me wrong: I understand that you're exited about cpg1.5.x and we welcome your contributions. However, I find it a bit pre-mature to start creating a lot of fresh themes for cpg1.5.x as long as there is no public beta you could build against and as long as the theming section in the docs is still pretty empty (because the theming engine may still be subject of change).
This being said, I suggest developing visually and not in terms of functionality yet.

DaMysterious

#2
This is your kind of view, and possible you might have it on the right hand. I'm not busy to create a bunch of themes for 1.5.x which is in early beta I'm just playing around to get deeper into the secrets to be prepared when 1.5.x will become final, nothing more and nothing less.

The content of included custom header/footer will nothing more carry out as a theme fitting html skeleton users can put their dynamic content into. No word where written about content of my own as you are suggesting.

Your words are as always harsh and hard using therms such as pre-mature, abuse, messing etc. I personally have to watch out not to read your reply as a thread.

Thanks for the variable hint. Those variables will read the existing path info already given in theme configuration only, not the recent theme name which is needed to show custom header/footer from a certain theme automatically. A bit short sighted of you to try to prevent future users of 1.5.x from value ad feature contributions.

There is no need to discuss this further.
DaMysterious.