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

Dizkus

Bottom
Sitename , slogan , and sitelogo in different languages
  • Posted: 22.09.2003, 14:26
     
    pasokonkun
    rank:
    Freshman Freshman
    registered:
     August 2003
    Status:
    offline
    last visit:
    05.10.06
    Posts:
    33
    There might be several ways to do this and maybe there is a easier way to do that but for all who want to have different sitenames in different languages here is one way to do that:



    Step1: look for the line

    return $result;

    in pnApi.php
    insert the following code before that line:


    if ($name == "sitename" and $result == "AUTO"){
    $result = _SITNAM;
    }

    if ($name == "site_logo" and $result == "AUTO"){
    $result = _SITLOGO;
    }

    if ($name == "slogan" and $result == "AUTO"){
    $result = _SLOGNAM;
    }
    return $result;
    }

    function pnConfigGetVar2($name)
    {
    global $pnconfig;

    if (isset($pnconfig[$name])) {
    $result = $pnconfig[$name];
    } else {
    /*
    * Fetch base data
    */
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();

    $table = $pntable['module_vars'];
    $columns = &$pntable['module_vars_column'];

    /*
    * Make query and go
    */
    $query = "SELECT $columns[value]
    FROM $table
    WHERE $columns[modname]='" . pnVarPrepForStore(_PN_CONFIG_MODULE) . "'
    AND $columns[name]='" . pnVarPrepForStore($name) . "'";
    $dbresult = $dbconn->Execute($query);

    /*
    * In any case of error return false
    */
    if($dbconn->ErrorNo() != 0) {
    return false;
    }
    if ($dbresult->EOF) {
    $dbresult->Close();
    return false;
    }

    /*
    * Get data
    */
    list ($result) = $dbresult->fields;
    $result = unserialize($result);

    /*
    * Some caching
    */
    $pnconfig[$name] = $result;

    /*
    * That's all folks
    */
    $dbresult->Close();
    }

    Step 2:

    Edit admin.php of the module NS-Settings

    replace

    ._SITENAME.":<input type="\"text\"" name="\"xsitename\"" value="\"".pnConfigGetVar('sitename')."\"" size="\"50\"" maxlength="\"100\"" class="\"pn-normal\"" />"
    .''
    ._SITELOGO.":<input type="\"text\"" name="\"xsite_logo\"" value="\"".pnConfigGetVar('site_logo')."\"" size="\"50\"" maxlength="\"100\"" class="\"pn-normal\"" />"
    .''
    ._SITESLOGAN.":<input type="\"text\"" name="\"xslogan\"" value="\"".pnConfigGetVar('slogan')."\"" size="\"50\"" maxlength="\"100\"" class="\"pn-normal\"" />"
    .''

    with:

    ._SITENAME.":<input type="\"text\"" name="\"xsitename\"" value="\"".pnConfigGetVar2('sitename')."\"" size="\"50\"" maxlength="\"100\"" class="\"pn-normal\"" />"
    .''
    ._SITELOGO.":<input type="\"text\"" name="\"xsite_logo\"" value="\"".pnConfigGetVar2('site_logo')."\"" size="\"50\"" maxlength="\"100\"" class="\"pn-normal\"" />"
    .''
    ._SITESLOGAN.":<input type="\"text\"" name="\"xslogan\"" value="\"".pnConfigGetVar2('slogan')."\"" size="\"50\"" maxlength="\"100\"" class="\"pn-normal\"" />"
    .''

    (note: change pnConfigGetVar to pnConfigGetVar2)

    Step 3

    Add the following defines to your global.php for each language:

    define("_SITNAM","My Sitename");
    define("_SITLOGO","logo1.gif");
    define("_SLOGNAM","My slogan");

    Step 4

    go to settings and enter AUTO as your sitename and/or your slogan and/or your Site logo to activate the Multilanguage sitename (slogan or logo)

Extensions Moderation

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula