Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Keep header from refreshing

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1538 Views
  • sonicparke
    Avatar
    74 Posts

    Keep header from refreshing Link to this post

    I'd like to use an swf file for the header but I'd really like it to keep looping constantly and not refresh as user navigate through the site. I'm not sure how to achieve this with SS templates.

    Another idea I'd like to get working is what Panic has done with their Coda site. I really like the sliding pages as you navigate through the sections.
    http://www.panic.com/coda/

    I'm not much of a coder so I'm not exactly sure how to make this happen using SS. Anybody got any smart & easy ideas?

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: Keep header from refreshing Link to this post

    Not wanting the header (thus page) to 'refresh' means not going to another page, and that can only be achieved through ajax afaik.


    In that way you'll stay on the same page and your flash animation can loop/do whatever you want, but you'll load in the new content on a certain part of the page. So you'll update only part of the page instead of going to a whole new page.


    There's a few ways to achieve this, but you'll need javascript to catch the events of the links, and adapt yr SS coding to it possibly (Director::is_ajax()). You might want to use the built-in prototype framework or look at other js libs such as mootools, jquery, yui...


    However, having a site that works only with ajax definitely has a lot of drawbacks as well, so make sure it works without it first.


    This would be a drastic thing to do though just to keep a looping header , so maybe there is a way to pass some variables from one page to another in flash, so that the animation starts at the correct position everytime - thus creating a loop. Google?


    Re the coda thing: well, it's basically just javascript as well, so look at some frameworks and their demo's. Almost all of them have some animation stuff in them.


    Hope this somehow helps.

  • sonicparke
    Avatar
    74 Posts

    Re: Keep header from refreshing Link to this post

    Thanks. That does help. It could be that the header thing isn't worth it.

    As far as the Coda effect. I know you can use javascript to do that but what I'm trying to wrap my head around is how to have SS output every page to one specific page that can be "slid" via the javascript. It's just one page that javascript moves around to different anchors.

  • adiwidjaja
    Avatar
    Community Member
    14 Posts

    Re: Keep header from refreshing Link to this post

    > but what I'm trying to wrap my head around is how to have SS output every page to one
    > specific page that can be "slid" via the javascript.

    Oh, that part is really easy: Just make something like an ArticleHolder (Tutorial 2) that lists all subpages. Then use something like this: http://stilbuero.de/jquery/tabs_3/ for the effect.

    For this specific library, you need an unordered list and a div for each content. Something like this should work (beware, untested code):

    <ul>
    <% control AllChildren %>
    <li><a href="#$URLPart">$Title</a></li>
    <% end_control %s>
    </ul>
    <% control AllChildren %>
    <div id="$URLPart">
    $Content
    </div>
    <% end_control %>

    I'm using "AllChildren" above, so you can uncheck the "show in menus" to suppress the display of the subpages in the tree. The sliding effect is implemented by the JS.

    Cheers,

    Andy

    1538 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.