Results 1 to 5 of 5

Thread: Nesting Ajax Tabs - need help please

  1. #1
    Join Date
    Mar 2009
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Nesting Ajax Tabs - need help please

    1) Script Title:
    Nesting Ajax Tabs
    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamici...uppliment2.htm
    3) Describe problem:


    hello.

    i have got most of the script to work but i cant get the externalnested.htm to show correctly.

    if you go to this url you can see the script. if you click tab3 you can see the externalnested.htm but the links dont work.
    http://www.eventtrafik.com/member-pr...ctMemberID=65#

    i know why they dont work. the question is how to fix the problem.

    at the bottom of the code it should show this javascript:

    HTML Code:
    <script type="text/javascript">
    
    var countries=new ddajaxtabs("countrytabs", "countrydivcontainer")
    countries.setpersist(true)
    countries.setselectedClassTarget("link") //"link" or "linkparent"
    countries.init()
    
    countries.onajaxpageload=function(pageurl){
    if (pageurl.indexOf("externalnested.htm")!=-1){
    var countries=new ddajaxtabs("countrytabs", "countrydivcontainer")
    countries.setpersist(true)
    countries.setselectedClassTarget("link") //"link" or "linkparent"
    countries.init()
    }
    </script>
    however, if i use this the full script the whole page will not show.
    it only shows if i remove the bottom part of the script. shown below.

    HTML Code:
    <script type="text/javascript">
    
    countries.onajaxpageload=function(pageurl){
    if (pageurl.indexOf("externalnested.htm")!=-1){
    var countries=new ddajaxtabs("countrytabs", "countrydivcontainer")
    countries.setpersist(true)
    countries.setselectedClassTarget("link") //"link" or "linkparent"
    countries.init()
    }
    </script>

    removing this part of the script stops it from working.
    so, what can i do be make it work ?

    does it have anything to do with smarty?
    the file is
    members-profile.tpl

    thanks
    ricky
    Last edited by rickyspires; 03-10-2009 at 04:45 PM.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Based on the contents of your "externalnested.htm":

    Code:
    <ul id="provincetabs" class="shadetabs">
    <li><a href="external1.htm" rel="provincedivcontainer">Tab 1</a></li>
    <li><a href="external2.htm" rel="provincedivcontainer">Tab 2</a></li>
    <li><a href="external3.htm" rel="provincedivcontainer">Tab 3</a></li>
    </ul>
    
    <div id="provincedivcontainer" style="padding: 10px; border-top: 1px solid gray;">
    </div>
    Your second block of initialization code should look like this:

    Code:
    countries.onajaxpageload=function(pageurl){
    if (pageurl.indexOf("externalnested.htm")!=-1){
    var province=new ddajaxtabs("provincetabs", "provincedivcontainer")
    province.setpersist(true)
    province.setselectedClassTarget("link") //"link" or "linkparent"
    province.init()
    }
    In other words, the variable names used in the 2nd block should differ from the first (ie: countries versus province).
    DD Admin

  3. #3
    Join Date
    Mar 2009
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks for your reply

    it still doesn't work ?

    i used the code:
    HTML Code:
    countries.onajaxpageload=function(pageurl){
    if (pageurl.indexOf("externalnested.htm")!=-1){
    var province=new ddajaxtabs("provincetabs", "provincedivcontainer")
    province.setpersist(true)
    province.setselectedClassTarget("link") //"link" or "linkparent"
    province.init()
    }
    like you said but, no go

    any other thoughts ??

    thanks
    rick

  4. #4
    Join Date
    Mar 2009
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    WOW...

    ok . it seems to have something to do with smarty...

    there are 2 files. members-profile.php & members-profile.tpl

    if i put the code in to members-profile.php it works.
    if i put the code in to members-profile.tlp it doesn't work.

    i dont know enough about how php links with smarty to ge it working.

    if you look at this link you'll see it working at the bottom. the code is in members-profile.php
    http://www.eventtrafik.com/member-pr...actMemberID=57

    this is the code. its right at the bottom


    <?


    include_once("include/Main.class.php");
    include_once('include/user.pager.class.php');



    //var_dump($_REQUEST);

    if($ContactMemberID == '' && $SessionMemberID == '' )
    {
    include_once("include/user_authentication.php");
    }

    if($ContactMemberID != '' && $SessionMemberID == $ContactMemberID )
    $ContactMemberID = '';
    //$ContactMemberID = '';

    if($ContactMemberID > 0)
    {
    $ContactSessionMemberID = $ContactMemberID;
    }
    else
    {
    $ContactSessionMemberID = $SessionMemberID;
    }

    $sql = $objMember->SelectAllMember($ContactMemberID, $SessionMemberID);
    $objMain->getAllRecords($sql);
    $AllMemberArray = $objMain->ResultRow;
    //print_r($AllMemberArray);
    //echo $AllMemberArray[0]['MemberID'].', '.$AllMemberArray[0]['EmailID'].', '.$AllMemberArray[0]['UserType'];

    if($ContactMemberID > 0)
    {
    $SqlProfileVisit = "UPDATE $member SET ProfileVisit = ProfileVisit + 1 WHERE $member.MemberID = '".$ContactMemberID."' ";
    $UpdateProfileVisit = $objDB->ddlQuery($SqlProfileVisit);
    }


    $AllMemberImagesArray = 'NULL';
    if($ContactMemberID != '')
    $sql = "SELECT * FROM $images WHERE ItemID = '".$ContactMemberID."' AND ItemType = 'User' AND Status = 'Y' AND IsPrimary = 'Y'";
    else
    $sql = "SELECT * FROM $images WHERE ItemID = '".$SessionMemberID."' AND ItemType = 'User' AND Status = 'Y' AND IsPrimary = 'Y' ";
    $objMain->getAllRecords($sql);
    $AllMemberImagesArray = $objMain->ResultRow;
    //print_r($AllMemberImagesArray);

    $AllEventArray = 'NULL';
    if($AllMemberArray[0]['UserType'] == 'Organizer' )
    {
    # SELECT ALL EVENT LISTING
    $sql = $objEvent->SelectAllEvent($ID = 0,$AllMemberArray[0]['MemberID'],'Y');
    $sql .= " LIMIT 5 ";

    $objMain->getAllRecords($sql, 'Event', 'ID');
    $AllEventArray = $objMain->ResultRow;
    }
    $smarty->assign("AllEventArray",$AllEventArray);
    //print_r($AllEventArray);

    # LIST OF ALL SERVICES THIS sp IS PROVIDING
    if($AllMemberArray[0]['UserType'] == 'SP' )
    {
    $SPArray = 'NULL';
    // echo '<br><BR>'.$sql = "
    // SELECT
    // $event_category.ID AS ECID,
    // $event_category.Name AS ECName,
    // $service_category.ParentID AS SCParentID,
    // $service_category.Name AS SCParentName,
    // $service_category.ID AS SCID,
    // $service_category.Name AS SCName
    // FROM
    // $member_ec_sc_map , $ec_sc_map , $service_category , $event_category
    // WHERE
    // $member_ec_sc_map.EcScID = $ec_sc_map.ID AND
    // $ec_sc_map.SCID = $service_category.ID AND
    // $ec_sc_map.ECID = $event_category.ID AND
    // $ec_sc_map.PID = $service_category.ID AND
    // $member_ec_sc_map.MemberID = '".$SessionMemberID."'
    // ";

    $sql = "
    SELECT
    $event_category.ID AS ECID,
    $event_category.Name AS ECName,
    (SELECT $service_category.Name FROM $service_category WHERE $service_category.ID = $ec_sc_map.PID) AS ParentName,
    $service_category.ID AS SCID,
    $service_category.Name AS SCName
    FROM
    $member_ec_sc_map , $ec_sc_map , $service_category , $event_category
    WHERE
    $member_ec_sc_map.EcScID = $ec_sc_map.ID AND
    $ec_sc_map.SCID = $service_category.ID AND
    $ec_sc_map.ECID = $event_category.ID AND
    $member_ec_sc_map.MemberID = '".$AllMemberArray[0]['MemberID']."'
    ORDER BY
    ECName, ParentName, SCName
    ";

    $objMain->getAllRecords($sql);
    $SPArray = $objMain->ResultRow;
    //print_r($SPArray);
    }
    # End - LIST OF ALL SERVICES THIS sp IS PROVIDING


    # CHECK IF ALREADY ADDED WATCHLIST
    $SqlIfXistWL = "SELECT ID FROM $watchlist WHERE ItemID = '".$ContactMemberID."' AND ItemType = 'User' AND MemberID = '".$SessionMemberID."' ";
    $ResIfXistWL = $objDB->ddlQuery($SqlIfXistWL);
    $NumIfXistWL = $objDB->numberRow($ResIfXistWL);
    if($NumIfXistWL == 0)
    $WLAdded = 'N';
    else
    $WLAdded = 'Y';

    $smarty->assign("WLAdded",$WLAdded);
    # End - CHECK IF ALREADY ADDED WATCHLIST

    # NO OF EVENT PROMOTED
    $SqlNOEP = "SELECT ID FROM $event_promoter WHERE ApplyStatus = 'Approved' AND PromotedBy = 'Promoter' AND PromoterID = '".$ContactSessionMemberID."' GROUP BY EventID ";
    $ResNOEP = $objDB->ddlQuery($SqlNOEP);
    $NumNOEP = $objDB->numberRow($ResNOEP);
    $smarty->assign("NumNOEP",$NumNOEP);
    #

    # SELECT ALL LISTING OF THE IMAGES
    if($ContactMemberID != '')
    $sql = "SELECT * FROM $images WHERE ItemType='User' AND ItemID=".$ContactMemberID." AND Status = 'Y' AND IsPrimary = 'N' ";
    else
    $sql = "SELECT * FROM $images WHERE ItemType='User' AND ItemID=".$SessionMemberID." AND Status = 'Y' AND IsPrimary = 'N' ";

    $objMain->getAllRecords($sql);
    $ImagesArr = $objMain->ResultRow;
    $TotalNumRows = count($ImagesArr);

    $PerColoumn = ceil($TotalNumRows/4);
    $temp = $PerColoumn;

    for($i = 0; $i < $TotalNumRows; $i++)
    {
    if($i == $PerColoumn)
    {
    $ImagesArr[$i]['Change'] = 'Change';
    $PerColoumn = $PerColoumn + $temp;
    }
    }
    //print_r($ImagesArr);
    # End - SELECT ALL LISTING OF THE IMAGES


    $smarty->assign("WLAdded",$WLAdded);
    $smarty->assign("SPArray",$SPArray);
    $smarty->assign("AllMemberArray",$AllMemberArray);
    $smarty->assign("AllMemberImagesArray",$AllMemberImagesArray);
    $smarty->assign("ImagesArr",$ImagesArr);
    $smarty->assign("ContactMemberID",$ContactMemberID);
    $smarty->assign("ThisMemberUserType",$AllMemberArray[0]['UserType']);

    $smarty->assign("FromPageEventID",$FromPageEventID);
    $smarty->assign("FromPage",$FromPage);
    $smarty->assign("paramSC",$paramSC);
    $smarty->assign("EventCategoryID",$EventCategoryID);

    # MAIN BODY TPL PAGE - Setting the TPL PAGE NAME
    $smarty->assign("tpl_page","member_profile.tpl");
    # DISPLAYING THE TPL PAGE NAME
    $smarty->display("container.tpl");


    ?>


    <ul id="countrytabs" class="shadetabs">
    <li><a href="external1.htm" rel="countrycontainer" class="selected">Tab 1</a></li>
    <li><a href="external2.htm" rel="countrycontainer">Tab 2</a></li>
    <li><a href="externalnested.htm" rel="countrycontainer">Tab 3</a></li>
    </ul>

    <div id="countrydivcontainer" style="border:1px solid gray; width:450px; margin-bottom: 1em; padding: 10px">
    </div>

    <script type="text/javascript">

    var countries=new ddajaxtabs("countrytabs", "countrydivcontainer")
    countries.setpersist(true)
    countries.setselectedClassTarget("link") //"link" or "linkparent"
    countries.init()

    countries.onajaxpageload=function(pageurl){
    if (pageurl.indexOf("externalnested.htm")!=-1){
    provinces=new ddajaxtabs("provincetabs", "provincedivcontainer")
    provinces.setpersist(true)
    provinces.setselectedClassTarget("link") //"link" or "linkparent"
    provinces.init()
    }

    }

    </script>



    thanks
    rick

  5. #5
    Join Date
    Mar 2009
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default It works

    IT WORKS

    ALL YOU NEED TO DO IS PUT THE SCRIPT CODE IN THE PHP FILE.

    like this

    members-profile.php
    <script type="text/javascript">

    var countries=new ddajaxtabs("countrytabs", "countrydivcontainer")
    countries.setpersist(true)
    countries.setselectedClassTarget("link") //"link" or "linkparent"
    countries.init()

    countries.onajaxpageload=function(pageurl){
    if (pageurl.indexOf("externalnested.htm")!=-1){
    provinces=new ddajaxtabs("provincetabs", "provincedivcontainer")
    provinces.setpersist(true)
    provinces.setselectedClassTarget("link") //"link" or "linkparent"
    provinces.init()
    }

    }

    </script>



    members-profile.tpl

    <ul id="countrytabs" class="shadetabs">
    <li><a href="external1.htm" rel="countrycontainer" class="selected">Tab 1</a></li>
    <li><a href="external2.htm" rel="countrycontainer">Tab 2</a></li>
    <li><a href="externalnested.htm" rel="countrycontainer">Tab 3</a></li>
    </ul>

    <div id="countrydivcontainer" style="border:1px solid gray; width:450px; margin-bottom: 1em; padding: 10px">
    </div>





    thanks

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
  •