Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Bottom
Insert a logo-image instead of module-header-text - Topics -
  • Posted: 25.06.2003, 17:20
     
    franz.skaaning
    rank:
    Helper Helper
    registered:
     December 2002
    Status:
    offline
    last visit:
    24.11.08
    Posts:
    176
    I made this hack for more modules, but to make it easier to overview I will start by documenting only the "Topics" and the "Submit_News" modules. (Version 0.723)

    I also posted this as "News" Here

    Find a demo here: LEXeBus.NET

    What this hack does is to give you the option of having a imagelogo instead of the modulename as header text "Current active topics", or what ever you changed it to.
    When creating this I wanted to have a solution that was Theme-dependant so when ever changing colors in my theme, the logo skould also be different - and as working on this a guy asked me to make it multilingual as well - so I did. I was also using 2 modules that already had a logoimage (Members_List + I-mod Downloads hack) - and I was tired of not having a imagelogo to go with the more and more different themes I created and used.

    After implementing the hack:
    If you want a logoimage in the header, make a folder called "modlogos" in your themedirectory. Put the gif, jpg og png file in there and call it "modulename.languagecode.filetype".
    Example: "Topics-eng.gif" or "Topics-dan.png"

    If you have used the hack but you dont want a imagelogo, then dont put an image in there. The original text will then be used instead.

    The Hack:

    Open the file: "modules/Topics/index.php"

    Find and replace this:

    Code

    echo "<center><font class=\"pn-title\">"._ACTIVETOPICS."</font><br>\n"
        ."<font class=\"pn-normal\">"._CLICK2LIST."</font></center><br>\n"
        ."<table border=\"0\" width=\"100%\" align=\"center\" cellpadding=\"2\"><tr>\n";


    to this:

    Code

    $language = pnUserGetLang();
    $modlogo = "<center><font class=\"pn-title\">"._ACTIVETOPICS."</font>";
    if (file_exists("themes/$GLOBALS[thename]/modlogos/$ModName-$language.gif")) {
       $modlogo = "<center><img src=\"themes/$GLOBALS[thename]/modlogos/$ModName-$language.gif\">"; }
    elseif (file_exists("themes/$GLOBALS[thename]/modlogos/$ModName-$language.png")) {
       $modlogo = "<center><img src=\"themes/$GLOBALS[thename]/modlogos/$ModName-$language.png\">"; }
    elseif (file_exists("themes/$GLOBALS[thename]/modlogos/$ModName-$language.jpg")) {
       $modlogo = "<center><img src=\"themes/$GLOBALS[thename]/modlogos/$ModName-$language.jpg\">"; }
    echo $modlogo ;
    echo "<br>"."<font class=\"pn-normal\">"._CLICK2LIST."</font></center><br>\n"
        ."<table border=\"0\" width=\"100%\" align=\"center\" cellpadding=\"2\"><tr>\n";



    Open the file: "modules/Submit_News/index.php"

    Find and replace this:

    Code

    echo "<center><font class=\"pn-pagetitle\">"._SUBMITNEWS."</font><br><br>";


    to this:

    Code

    $language = pnUserGetLang();
    $modlogo = "<center><font class=\"pn-pagetitle\">"._SUBMITNEWS."</font><br>";
    if (file_exists("themes/$GLOBALS[thename]/modlogos/$ModName-$language.gif")) {
       $modlogo = "<center><img src=\"themes/$GLOBALS[thename]/modlogos/$ModName-$language.gif\">"; }
    elseif (file_exists("themes/$GLOBALS[thename]/modlogos/$ModName-$language.png")) {
       $modlogo = "<center><img src=\"themes/$GLOBALS[thename]/modlogos/$ModName-$language.png\">"; }
    elseif (file_exists("themes/$GLOBALS[thename]/modlogos/$ModName-$language.jpg")) {
       $modlogo = "<center><img src=\"themes/$GLOBALS[thename]/modlogos/$ModName-$language.jpg\">"; }
    echo $modlogo ;
        echo "<br>";


    As you can see the hack does not care what the module or the theme is called, so the same code can be used in almost any module, granting the option of having a theme-color-based image.
  • Posted: 25.06.2003, 17:24
     
    franz.skaaning
    rank:
    Helper Helper
    registered:
     December 2002
    Status:
    offline
    last visit:
    24.11.08
    Posts:
    176
    When using the "if"'s - how much more CPU, RAM or just time is used to showing the page?

    How much more time does it take to show a page with the code and without the code - not using an image?

Extensions Moderation

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula