Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

if the home page is not the Elefant's home

edited October 2013 in Framework

I had to add a splash page (say index.html) through which you access to the Elefant's home; unfortunately the "home" button in the Elefant's menu goes to the splash page, but I would like it goes to the Elefant's home (index.php). Is that possible? Thanks.

Comments

  • You would have to link explicitly to /index because links to / will hit the index.html instead. Alternately, if it's just a splash page you could add a couple lines of Javascript to the index.html file to redirect if the referrer is an internal page. Something like this should work:

    <script>
    function redirect_interal () {
        var ref = document.referrer.split ('/'),
            loc = window.location.href.split ('/'),
            refhost = typeof (ref[2]) != 'undefined' ? ref[2] : false,
            lochost = typeof (loc[2]) != 'undefined' ? loc[2] : false;
    
        if (refhost == lochost) {
            window.location.href = '/index';
        }
    }
    </script>
    <body onload="redirect_interal()"></body>
    
  • Thank you.

    Wanting to implement the first solution, how can I explicitly link home to /index?

  • Since the built-in navigation all renders links to /index as just /, it would take a bit of customization. The easiest way would be to write a filter for ="/" and replace it with ="/index" like this:

    <?php
    
    echo str_replace ('="/"', '="/index"', $this->data['html']);
    
    ?>
    

    Save this to a file such as apps/mysite/handlers/indexfilter.php, then add this line to the [Hooks] section in conf/config.php:

    page/render[] = mysite/indexfilter
    

    This tells Elefant to call your mysite/indexfilter handler to transform the final HTML output before sending it to the user. page/render is the name of the hook that triggers your handler. Elefant passes the HTML to the handler as $this->data['html'].

    Hope that helps!

  • As always your support exceeds expectations. Thank you very much.

Sign In or Register to comment.