WebsiteBaker Support (2.8.x) > Templates, Menus & Design

PHP - execute certain code depending on ?lang=

<< < (2/2)

pcwacht:
Cleaned it up a bit for clarity and readablitity


--- Code: ---<?php
if (LANGUAGE==SE) { 
    $section_id = 10;   //change this section_id for Your needings
} elseif (LANGUAGE==EN) {
    $section_id = 11; //change this section_id for Your needings
} else {
    $section_id = 12; //change this section_id for Your needings
}
if (isset($section_id)) { // Maker sure section isset
    $query_sec = $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE section_id = &#39;$section_id&#39; ");
    if($query_sec->numRows() > 0) {
        $section = $query_sec->fetchRow();
        $section_id = $section[&#39;section_id&#39;];
        $module = $section[&#39;module&#39;];
        require(WB_PATH.&#39;/modules/&#39;.$module.&#39;/view.php&#39;); //statt view.php die alternative eintragen!
    }
}
<?
--- End code ---

Have fun,
John

Navigation

[0] Message Index

[*] Previous page

Go to full version