If statement for "frontpage"

Feel free to talk about everything related to our Joomla Products
Rate this topic: Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.
GK User
Thu Sep 26, 2013 12:16 am
How can i do true if request for homepage with gavern framework, i have tried to do a request in /templates/gk_storebox/layouts/default.php and so:
Code: Select all
if($this->layout->isFrontpage()) :
echo "homepage";
else :
echo "other content";
endif;


as result i get on every page echo "homepage", what is hier wrong?

Thanks.
User avatar
Junior Boarder

GK User
Thu Sep 26, 2013 4:47 am
Edit file: /templates/gk_storebox/lib/framework/helper.layout.php
Line: 143

Original Code

Code: Select all
    // function to check if the page is frontpage
    function isFrontpage() {
        if($this->globalMenuActive == null) {
             // get all known languages
             $languages     = JLanguage::getKnownLanguages();
             $menu = JSite::getMenu();
           
             foreach($languages as $lang){
                $menuActive = $menu->getActive();
                $menuLanguage = $menu->getDefault($lang['tag']);
                if($menuActive == $menuLanguage) {
                          $this->globalMenuActive = $menuActive;
                          $this->globalMenuLanguage = $menuLanguage;
                          return true;
                }
             }
        }
       
        if($this->globalMenuActive == $this->globalMenuLanguage) {
             return true;
        }
           
        return false;   
    }




Replace with below

Code: Select all
    // function to check if the page is frontpage
    function isFrontpage() {
        if($this->globalMenuActive == null) {
             // get all known languages
             $languages = JLanguage::getKnownLanguages();
             $menu = JFactory::getApplication()->getMenu();
           
             foreach($languages as $lang){
                $menuActive = $menu->getActive();
                $menuLanguage = $menu->getDefault($lang['tag']);
                if($menuActive == $menuLanguage) {
                          $this->globalMenuActive = $menuActive;
                          $this->globalMenuLanguage = $menuLanguage;
                          return true;
                }
            return false;
             }
        }
       
        if($this->globalMenuActive == $this->globalMenuLanguage) {
             return true;
        }
           
        return false;   
    }



See you around...
User avatar
Platinum Boarder


cron