Results 1 to 10 of 10

Thread: Need some help with Ajax Tabs Content Script (v 2.2)

  1. #1
    Join Date
    Apr 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need some help with Ajax Tabs Content Script (v 2.2)

    1) Script Title: Ajax Tabs Content Script (v 2.2)

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...tent/index.htm

    3) Describe problem:

    I have my Ajax Tabs Content Script setup and it works great, but I am having trouble with Dynamically selecting a tab using a remote link

    I am using the ajax tab content with Vbulletin, same one used here, lol. on index.php, I've put tabbed content inside forumhome template, using the following code:


    <div id="forumhome_header">
    <div class="shadetabs">
    <ul id="forumtabs">
    <if condition="$show[member]"><li class="myfourm"><a class="seleted" href="/myforum.php?page=forumhome" rel="forumajax">tab0</a></li></if>
    <li class="citycenter"><a href="/tabs/tab_hot1.php" rel="forumajax" rev="tcontent1">tab1</a></li>
    <li class="youth"><a href="/tabs/tab_hot5.php" rel="forumajax" rev="tcontent2">tab2</a></li>
    <li class="lifestyle"><a href="/tabs/tab_hot6.php" rel="forumajax" rev="tcontent3">生活小叙</a></li>
    <li class="ent"><a href="/tabs/tab_hot2.php" rel="forumajax" rev="tcontent4">tab3</a></li>
    <li class="univer"><a href="/tabs/tab_hot3.php" rel="forumajax" rev="tcontent5">tab4</a></li>
    <li class="gen"><a href="/tabs/tab_hot4.php" rel="forumajax" rev="tcontent6">tab5</a></li>
    <br class="clearfloat" />
    </ul>
    </div><br class="clearfloat" />
    </div>


    <div id="forumajax" class="forumajax"></div>


    <script type="text/javascript">
    var forumhome_forumtab=new ddajaxtabs("forumtabs", "forumajax")
    forumhome_forumtab.setpersist(true)
    forumhome_forumtab.setselectedClassTarget("link") //"link" or "linkparent"
    forumhome_forumtab.init()
    </script>


    Then from a different page (forumdisplay.php) I want to use a remote link to go back to the index.php and have one of the tab to be selected. However, that didn't work...

    Based on my setup, what should I do to make things work?

    Thank you in advance for you help.

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    If you look at this page:

    http://www.dynamicdrive.com/dynamici...suppliment.htm

    you could use the expandit function to expand based on what is passed in the url. Not sure how you would implement in vb, but just an idea to get you moving in the right direction.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Apr 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanx for your reply!

    Based on my setup, I wrote my remote link like this :
    Code:
    <a href="/bbs.php?forumtabs=2">Go to Forumhome and open up tab2</a>
    however, it doesn't work.

    note I renamed index.php to bbs.php

  4. #4
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    If you are doing that, then you will need to find a way to be able to get that data (the get variable for forumtabs) and pass that along to the expandit function in the script. Normally it would be something like this:

    Code:
    ajaxtabs_instance.expandit(<?php echo $_GET['forumtabs'];?>);
    Although, being that this is vb and you are not able to parse php in your templates, I'm at a loss.
    Hope this helps nonetheless.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  5. #5
    Join Date
    Apr 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by thetestingsite View Post
    If you are doing that, then you will need to find a way to be able to get that data (the get variable for forumtabs) and pass that along to the expandit function in the script. Normally it would be something like this:

    Code:
    ajaxtabs_instance.expandit(<?php echo $_GET['forumtabs'];?>);
    Although, being that this is vb and you are not able to parse php in your templates, I'm at a loss.
    Hope this helps nonetheless.
    Ok, I can define something like $tabid in vb's core php file which is bbs.php and have that passed to template forumhome, so I could put something like

    Code:
    ajaxtabs_instance.expandit($tabid);
    in my forumhome template

    That shouldn't be hard.

    The question is, where should I put above code on my page...???

  6. #6
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    it would go just beneath the instance.init() function.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  7. #7
    Join Date
    Apr 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I am guessing I should put the code inside

    Code:
     <script type="text/javascript">
    var forumhome_forumtab=new ddajaxtabs("forumtabs", "forumajax")
    forumhome_forumtab.setpersist(true)
    forumhome_forumtab.setselectedClassTarget("link") //"link" or "linkparent"
    forumhome_forumtab.init()
    </script>
    so I have somethin look like

    Code:
     <script type="text/javascript">
    var forumhome_forumtab=new ddajaxtabs("forumtabs", "forumajax")
    forumhome_forumtab.setpersist(true)
    forumhome_forumtab.setselectedClassTarget("link") //"link" or "linkparent"
    forumhome_forumtab.init()
    forumhome_forumtab.expandit($tabid)
    </script>
    am I right?

  8. #8
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    That is correct.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  9. #9
    Join Date
    Apr 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Great, I will give it a try and let you know if it works

    Thank you for taking ur time here

  10. #10
    Join Date
    Apr 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That works, thanx!

    This thread might be helpful for other vb users

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •