Announcement

Collapse
No announcement yet.

freebie: popout section aware nav.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #46
    just replaced every block with
    Code:
    <actinic:block php="true" selectable="false" >

    Comment


      #47
      ahh...dur LOL
      suppose it makes sense that, if it fixed one, it'd fix the rest

      Thanks, Jo
      Tracey

      Comment


        #48
        The php needs a little tweaking to work on Actinic 9. Something doesn't quite work with the retrieval from the database. Changing the odbc_pconnect lines to
        Code:
        $connect = odbc_pconnect("ActinicCatalog9","","", 1);
        gets part way there, but it still doesn't like getting a text and a memo field in the same query

        Any php experts care to investigate further?

        Comment


          #49
          Actinic V9 Compatible version, for testing.

          PHP Code:
          /***************************************************************
          *
          * MakeNav for V9 -
          * PLEASE TEST BEFORE PRODCTION USE
          * @author Gabriel Crowe 3:50 PM 5/22/2008
          *
          * usage example:
          MakeNav($sectid,$recursedepth,$prestyle,$thissect)
          ***************************************************************/
          function GetParentSections($connect,$sectref)
              {

                  
          $query "SELECT [Section Text], [nParentSectionID], [nSectionID] FROM [Catalog Section] WHERE [nSectionID] LIKE '".$sectref."'";
                  
          $result odbc_exec($connect$query);
                  
          $returnstring="";
                  

                  while(
          odbc_fetch_row($result)){
                  
                      
          $SectionText =  odbc_result($result1);
                      
          $nParentSectionID odbc_result($result2);
                      
          $nSectionID odbc_result($result3);
                      
                      if (
          $nSectionID!=0) {$returnstring=GetParentSections($connect,$nParentSectionID).$nSectionID."|";}

                  }
                  
          odbc_free_result($result);
                  
          //odbc_close($connect);
              
          return $returnstring;
          }

          function 
          GetParentSectionsWrapper($sectid) {
              
          $connect odbc_pconnect("ActinicCatalog9","",""SQL_CUR_USE_ODBC);
              
          $resultage GetParentSections($connect,$sectid);
              
          odbc_close_all();    
              return 
          $resultage;
          }


          function 
          useful_odbc_num_rows($result){

             
          $num_rows=0;

             while(
          $temp odbc_fetch_into($result, &$counter))

             {
                 
          $num_rows++;
             }

          @
          odbc_fetch_row($result0);   // reset cursor

             
          return $num_rows;
          }


          function 
          SectionList($connect,$sectid,$recursedepth,$rendermode,$thispatharr,$stylecounter) {

              
          $recursedepth=$recursedepth-1;
              
          $stylecounter=$stylecounter+1;
              
          $query "SELECT [sPageName], [Section text], [nSectionID] FROM [Catalog Section] WHERE [nParentSectionID]=".$sectid." AND [bHideOnWebSite]=0 ORDER BY [Catalogue Section Sequence] ASC";
              
          $result odbc_exec($connect$query);
              
          $numrows useful_odbc_num_rows($result);

              if (
          $numrows!=0) {echo "\n\n<ul class=\"ul".$stylecounter."\">\n";}
                  while(
          odbc_fetch_row($result)){
                  
                      
          $sPageName odbc_result($result1);
                      
          $Sectiontext odbc_result($result2);
                      
          $nSectionID odbc_result($result3);

                          
          $thisstyle="";
                          
          $expandthis=false;
                          foreach (
          $thispatharr as $value) {
                              if (
          $value==$nSectionID) {
                              
          $thisstyle="_selected";
                              
          $expandthis=true;
                              }
                          }
                          
          $linkitem="<a href=\"#link#\" class=\"link".$stylecounter."\">";

                      echo 
          "\t<li class=\"li".$stylecounter."\">";
                      echo 
          str_replace("#link#",$sPageName,$linkitem);
                      echo 
          trim($Sectiontext);
                      echo 
          "</a>";
                          
          //recurse
                          
          if ($rendermode == 1) { $expandthis=true; }
                          if (
          $recursedepth>=and $expandthis==true){
                                  
          SectionList($connect,$nSectionID,$recursedepth,$rendermode,$thispatharr,$stylecounter);
                              }
                      echo 
          "</li>\n";
                  }
              if (
          $numrows!=0) { echo "</ul>\n\n"; }
          odbc_free_result($result);

          }        

          function 
          MakeNav($sectid,$recursedepth,$rendermode,$thissect) {

              
          $thispath GetParentSectionsWrapper($thissect);
              
          $thispatharr explode("|",$thispath);
              
          //sPagetitle, sPageName, sMetaKeywords, sMetaDescription, sSectionImageFile, sSectionDescription, sSectionText
              
          $connect odbc_pconnect("ActinicCatalog9","",""SQL_CUR_USE_ODBC);
                  
          SectionList($connect,$sectid,$recursedepth,$rendermode,$thispatharr,0);
              
          odbc_close_all();    

              
          $connect null;    

          Comment


            #50
            OK, thanks for that, but it's still not entirely working: all the anchor links point to the current page (no url in the href attribute). I'll investigate further.

            Solved. My Page Name fields are empty because the sections were imported.

            Comment


              #51
              Originally posted by gabrielcrowe View Post
              if you get this error in the preview, does it work if you press the single page preview button? or even upload?
              I used your code in Actinic 8.5.3, under Win XP SP2, and I get "Parse error: syntax error, unexpected '<' in main on line 1" when I use the Page Preview under the design tab only if I am looking at a section page when I select the design tab. If I select design tab when I have a brochure page or the top section of the store displayed then I do not get the error.

              All pages work fine in Page Preview under the content tab or if I preview it in 'offline page preview'.

              I setup the css code in menu.css and combined your multi block code inside the <div> which gives a neat menu system.
              Code:
               <link href="menu.css" rel="stylesheet" type="text/css">
               <div class="navcontainerment">
               ....
              </div>
              Just need to sort the colours before it goes live, great piece of code.

              Malcolm

              SellerDeck Accredited Partner,
              SellerDeck 2016 Extensions, and
              Custom Packages

              Comment


                #52
                remember that the css goes in your header, and not immidiately before the menu.

                But other than that, thanks, and good luck with your navs!

                Comment


                  #53
                  I used your code in Actinic 8.5.3, under Win XP SP2, and I get "Parse error: syntax error, unexpected '<' in main on line 1" when I use the Page Preview under the design tab only if I am looking at a section page when I select the design tab. If I select design tab when I have a brochure page or the top section of the store displayed then I do not get the error.
                  Look at post #41

                  Comment


                    #54
                    Originally posted by gabrielcrowe View Post
                    remember that the css goes in your header, and not immidiately before the menu.
                    Gabe

                    Have you tried to link your system with the freestyle menu system from Angus Turnbull. www.twinhelix.com. This menu system requires a menu list not dissimilar to the list produced by your software.

                    Malcolm

                    SellerDeck Accredited Partner,
                    SellerDeck 2016 Extensions, and
                    Custom Packages

                    Comment


                      #55
                      ALMOST got it working....?

                      hello all.

                      thanks gabe!
                      firstly i'd like to say a massssive thanks to gabe for putting this together - i've been looking to create a nav list like this for ages and had almost given up on actinic to look for another ecom software that could do it. hope those in actinic are grateful.

                      nuts n bolts
                      i have implemented this to a fairly stripped out version of v9 to test it before i go diving in and have had success aside from being able to see the nav in the checkout, contact and login pages. it can be seen at:-

                      http://trials.actinic.com/trials/trial51836/index.html

                      I've followed the thread as closely as I can and added the (v9) php script and the blocks as in post #12 plus the additional code from post #41 to get rid of those 'coding errors'. I may be missing something though...?

                      I'd love to have this working in all areas of the site... I mean I'd REALLY love to have it working(!) So if there is anyone out there who'd be happy to have a quick look for me then I'd be a very happy chappy.

                      Thanks,
                      Chris


                      Update 05.08.08 Look at the blocks Chris. It's obvious once you look at the blocks. Chris.
                      Chris Adams

                      Comment


                        #56
                        further styling...

                        I may be pushing it here but how difficult would it be to create an additional styling option in this list to include a 'current' state class on both the top section & sub-sections to create something similar to the following...?




                        Would that have to include alot more php coding...? (I know it'll take some css coding - happy with that!)
                        Chris Adams

                        Comment


                          #57
                          in the code, you'll find a block like this:
                          PHP Code:
                                          foreach ($thispatharr as $value) {
                                              if (
                          $value==$nSectionID) {
                                              
                          $thisstyle="_selected";
                                              
                          $expandthis=true;
                                              } 
                          this creates a variable $thisstyle, containing '_selected'. if the current context is selected ($value==$nSectionID).

                          though you have indeed found a buglet, since this variable was never used in the code to produce the effect your looking for, but it should ahve been

                          You can easily make this change, to have the currently selected link tagged, for css:

                          look for:
                          PHP Code:
                          $linkitem="<a href=\"#link#\" class=\"link".$stylecounter."\">"
                          and change it to:
                          PHP Code:
                          $linkitem="<a href=\"#link#\" class=\"link".$stylecounter.$thisstyle."\">"
                          level 1 links should now have a css calss thus:
                          HTML Code:
                          class="link1_selected"
                          level 2 like this:
                          HTML Code:
                          class="link2_selected"
                          and level 2 unselected like this:
                          HTML Code:
                          class="link2"
                          good luck!

                          Comment


                            #58
                            ...also, if the idea of locking onto a link tag in css doesnt float your boat, you can also, style the list item, containig it:

                            change:
                            PHP Code:
                            echo "\t<li class=\"li".$stylecounter."\">"
                            to
                            PHP Code:
                            echo "\t<li class=\"li".$stylecounter.$thisstyle."\">"
                            to get:
                            HTML Code:
                            <li class="li1_selected"></li>
                            etc.

                            Comment


                              #59
                              For anyone interested

                              I've been chatting with Gabe off-list about this as I had a slight problem with it... Being a complete novice at php scripting stuff Gabe suggested that after every change to the actinic_main.php file I restart Actinic - then it'll work better.

                              Even better than that Gabe suggested not using the php code in the actinic_main.php file but pulling into the Library and referencing that within the page (to make it more foolproof... necessary for me!). He's just emailed me this so I'll update this in a bit with instructions from Gabe (once I've got it working).

                              Chris
                              Chris Adams

                              Comment


                                #60
                                To continue...

                                OK - following on from above, do the following and you will have 'current-section-specific' nav, ready to be styled using css. You'll also have a clear actinic-main.php (as the php from Gabe's previous posts is added to WITHIN Actinic - not to Actinic's main php file)...

                                1. Go to the Library and create a new Layout Type (call it something appropriate such as NavPHP)
                                2. Within this create a new Layout and paste the contents of one of the attached files - v9 for v9, v8 for v8(!) into it - this contains the php that Gabe originally created.
                                3. Add the php layout into the top of your primary templates.
                                4. Remove the non-standard code from actinic_main.php.
                                5. Close Actinic down and re-open it.
                                6. Ensure you have added the Blocks from post #12 and the fix if required to these blocks from post #41.
                                7. Check your menu and style away.

                                All credit to Gabriel for developing this - I can't believe it's actually been done so easily (and all credit to me for asking some dumb questions and potentially confusing people with this post...)

                                Cheers,
                                Chris
                                Attached Files
                                Chris Adams

                                Comment

                                Working...
                                X