Fork me on GitHub

Watch

GitHub Core

Show your support for Zikula! Sign up at Github account and watch the Core project!




GitHub Modules

Forum Activity

Forum feed

» Visit forum | » View latest posts

Add 'themecolor' to Globals!  Bottom

  • I have today finished a hack to change logo and topicimages between themes and laguages.

    I have created a new $global called 'themecolor'

    The reason I did not use the themename wich would be more easy, because I didnt have to make a new $global, was that I wanted to change some images within the theme as well.

    Since the site is not up and running yet I can not give you a link to show it.

    Here is what I did (the hack can be put to more modules, here I only show it for Downloads - I have used an old hack to change pnTitles and/or images to images from the themedir):

    In 'modules/Downloads/dl-navigation.php'

    I added these lines:

    Code

    $language = pnUserGetLang();
    $modlogo = "<center><a class=\"pn-logo\"  href=\"".$GLOBALS['modurl']."\">".pnConfigGetVar('sitename').' -- '._DLOADPAGETITLE."</a>";
    if (file_exists("themes/$GLOBALS[thename]/modlogos/".$themecolor.$GLOBALS['ModName']."-$language.gif")) {
    $modlogo = "<center><img src=\"themes/$GLOBALS[thename]/modlogos/".$themecolor.$GLOBALS['ModName']."-$language.gif\" border=\"0\" align=absmiddle>"; }
    elseif (file_exists("themes/$GLOBALS[thename]/modlogos/".$GLOBALS['ModName']."-$language.gif" )) {
    $modlogo = "<center><img src=\"themes/$GLOBALS[thename]/modlogos/".$GLOBALS['ModName']."-$language.gif\" border=\"0\" align=absmiddle>"; }
    elseif (file_exists("themes/$GLOBALS[thename]/modlogos/".$themecolor.$GLOBALS['ModName'].".gif" )) {
    $modlogo = "<center><img src=\"themes/$GLOBALS[thename]/modlogos/".$themecolor.$GLOBALS['ModName'].".gif\" border=\"0\" align=absmiddle>"; }
        echo $modlogo ;


    In '/themes/mythemename/theme.php'
    I added one line:

    Code

    $themecolor ="blue";


    In '/includes/pnAPI.php'
    I added one line:

    Code

    global $themecolor;
    (after the line: global $thename;)

    In the folder '/themes/mythemename/modlogos/'
    I added a file called

    Code

    'blueDownloads-eng.gif' or 'Downloads-eng.gif' or 'blueDownloads.gif


    Optional:

    Since I use AutoTheme I can change the globals per different pages viewed by the visitor.

    So in my theme.cfg i create a few extra lines:

    Code

    switch($_GET['sid']) {  
    case 1:
    $custom_module['Downloads'] = array (
            'themecolor' => "green",
    );
    break;
    case 2:
    $custom_module['Downloads'] = array (
            'themecolor' => "green",
    );
    break;
    case 3:
    $custom_module['Downloads'] = array (
            'themecolor' => "green",
    );
    break;
    case 4:
    $custom_module['Downloads'] = array (
            'themecolor' => "green",
    );
    break;
    }


    AutoTheme already have a logo-changer built in, so it is possible to use just that, but that give no controll over the modules, just 1 image somewhere in the theme.

    I do not know how to change globals per module in normal themes or in Xanthia themes.

This list is based on users active over the last 60 minutes.