Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Variable for "homepage"

hi guys, what's the variable for "homepage" ?

example :

`if(hompage()){

//this that can be seen only in frontpage :D
}`

i've searched throught forums and codes, i cant find any.

Comments

  • peregrineperegrine MVP
    edited December 2012

    not really.
    play around with these variables and you should be able to figure something out.

    $qs = ($_SERVER[QUERY_STRING]);  
    $uri = $_SERVER['REQUEST_URI'];    
    $Surl = $Sender->SelfUrl;   
    $URL();
    
    
    
    
    if (($qs == "") || ( something == "youhomepage")) {
    // do something
    
    }
    
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • edited December 2012

    Ha funny! I used peregrine's ExtraPage plugin and called it my FrontPage and designated it the alternative homepage. This probably is irrelevant but my head thinks different ...

  • 50sQuiff50sQuiff ✭✭
    edited December 2012

    If you need to get your default Home page (to check what '/' actually is):

    $Routes=&Gdn::Router()->Routes;

    $DefaultHomePage = $Routes['DefaultController']['Destination'];

  • x00x00 MVP
    edited December 2012

    I think you are thinking too much like wordpress.

    You can check it like so

    if(strcasecmp(C('Routes.DefaultController').'controller',Gdn::Controller()->ControllerName)==0){
    
    }
    

    edit I changed it.

    grep is your friend.

  • I would use hooks where possible though.

    grep is your friend.

Sign In or Register to comment.