Announcement

Collapse
No announcement yet.

List from just one section level...

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

    List from just one section level...

    on my site, i am trying to display an unordered list of JUST items with a section level of 2...

    ... but i can't

    does anyone posess such juicy knowledge?

    #2
    Look in the Advanced Guide, page 53 "Advanced List Functionality". Then put a Conditions (something like if SectionLevel == 2) around the code inside the list block.

    E.g.
    Code:
    <ul>
    <actinic:block type="EntireSectionList">
    	<actinic:block if="%3cactinic%3avariable%20name%3d%22SectionLevel%22%20%2f%3e%20%20%3d%3d%202" >
    		<li><a href="<actinic:variable Name="SectionPageName"/>"><actinic:variable Name="SectionName"/></a></li>
    	</actinic:block>
    </actinic:block>
    </ul>
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      hi norman, i did try something like that but i think i need another block if as that displays ALL items with section level 2 (i realise now i should have said this in the op) - but i only want it to display level 2 sections that are children of the currently selected level 1 if that makes sense?

      Comment


        #4
        That's much more complicated and will probably need PHP.

        You'd have to set some sort of flag to false at the beginning.

        Then set it true when the current section is displayed and reset it false if the section-level subsequently returns to level 1.

        Now only generate list items when the flaf is true.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Hi, Does anyone have a solution for this?

          Thanks

          Comment


            #6
            Originally posted by Zest View Post
            Hi, Does anyone have a solution for this?

            Thanks
            Gabe published some PHP navigation code that can handle this on the forum. I will see if I can find the link

            EDIT
            http://community.actinic.com/showthread.php?t=35767

            Malcolm

            SellerDeck Accredited Partner,
            SellerDeck 2016 Extensions, and
            Custom Packages

            Comment


              #7
              Originally posted by malbro View Post
              Gabe published some PHP navigation code that can handle this on the forum. I will see if I can find the link

              EDIT
              http://community.actinic.com/showthread.php?t=35767
              Thanks Malbro

              I've implemented this just now but i only want it to display level 2 sections that are children of the currently selected level 1 and remove all other level 1 sections e.g.

              a-Level 1 (hidden)
              b-Level 1 (selected)
              - a-Level 2 (Visible)
              - b-Level 2 (Visible)
              c-Level 1 (hidden)
              d-Level 1 (hidden)


              This is so I can create a mini sub menu for the selected top level section.

              Have you any ideas on what code I need to change so it does not display all the other level 1 sections? Hope this makes sense! Thanks

              Comment


                #8
                Code:
                <actinic:block type="toplevelsectionlist">
                	<actinic:block if="%3cactinic%3avariable%20name%3d%22SectionName%22%20%2f%3e%20%3d%3d%20%22Cameras%22">
                		<actinic:block type="childsectionlist">
                			<br /><actinic:variable name="SectionName" />
                		</actinic:block>
                	</actinic:block>
                </actinic:block>
                Note that the second line tests for SectionName == "Cameras". Change this to suit your site.
                Norman - www.drillpine.biz
                Edinburgh, U K / Bitez, Turkey

                Comment


                  #9
                  Thanks Norman
                  Note that the second line tests for SectionName == "Cameras". Change this to suit your site.

                  How can I get this name e.g. "Cameras" automatically so its not hard coded?

                  Comment


                    #10
                    Originally posted by NormanRouxel View Post
                    Code:
                    <actinic:block type="toplevelsectionlist">
                    	<actinic:block if="%3cactinic%3avariable%20name%3d%22SectionName%22%20%2f%3e%20%3d%3d%20%22Cameras%22">
                    		<actinic:block type="childsectionlist">
                    			<br /><actinic:variable name="SectionName" />
                    		</actinic:block>
                    	</actinic:block>
                    </actinic:block>
                    Note that the second line tests for SectionName == "Cameras". Change this to suit your site.
                    Originally posted by Zest View Post
                    Thanks Malbro

                    I've implemented this just now but i only want it to display level 2 sections that are children of the currently selected level 1 and remove all other level 1 sections e.g.

                    a-Level 1 (hidden)
                    b-Level 1 (selected)
                    - a-Level 2 (Visible)
                    - b-Level 2 (Visible)
                    c-Level 1 (hidden)
                    d-Level 1 (hidden)


                    This is so I can create a mini sub menu for the selected top level section.

                    Have you any ideas on what code I need to change so it does not display all the other level 1 sections? Hope this makes sense! Thanks
                    Hi , any ideas for solution to the above examples? Thanks

                    Comment


                      #11
                      Originally posted by Zest View Post
                      Hi , any ideas for solution to the above examples? Thanks
                      To use gabes code to do what you want you would start with the current SectionId, use that to find the ParentSectionId working back until you get a ParentID of 0, your current SectionID is thus a level one section. Use this SectionId as the start point to generate the navigation code.

                      You can use a modified version of GetParentSectionsWrapper() to find the SectionID of the level 1 parent, something like

                      Code:
                      if (!function_exists('GetLevel1Section')) {
                          function GetLevel1Section($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($result, 1);
                                  $nParentSectionID = odbc_result($result, 2);
                                  $nSectionID = odbc_result($result, 3);
                                  
                                  if ($nParentSectionID!=0) {
                                     $returnstring=GetLevel1Section($connect,$nParentSectionID);
                                  } else {
                                     $returnstring=$nSectionID;
                                  }
                              }
                              odbc_free_result($result);
                              //odbc_close($connect);
                              return $returnstring;
                          }
                      }
                      
                      if (!function_exists('GetLevel1SectionWrapper')) {
                          function GetLevel1SectionWrapper($sectid) {
                              $connect = odbc_pconnect("ActinicCatalog9","","", SQL_CUR_USE_ODBC);
                              $resultage = GetLevel1Section($connect,$sectid);
                              odbc_close_all();    
                              return $resultage;
                          }
                      }
                      Then pass the returned value to the MakeNav function
                      Code:
                      MakeNav(GetLevel1SectionWrapper(SectionID),........);

                      Malcolm

                      SellerDeck Accredited Partner,
                      SellerDeck 2016 Extensions, and
                      Custom Packages

                      Comment


                        #12
                        Thanks Malbro, Im not great with coding so need a little help???

                        I've pasted your code below and added it to the existing code and then used this to pass:

                        <actinic:block php="true" selectable="false">
                        MakeNav(GetLevel1SectionWrapper(<actinic:variable name="SectionID" />,2,0,<actinic:variable name="SectionID" />));
                        </actinic:block>

                        Not sure I'm using correctly and also get errors??

                        Comment


                          #13
                          Originally posted by Zest View Post
                          Thanks Malbro, Im not great with coding so need a little help???

                          I've pasted your code below and added it to the existing code and then used this to pass:

                          <actinic:block php="true" selectable="false">
                          MakeNav(GetLevel1SectionWrapper(<actinic:variable name="SectionID" />,2,0,<actinic:variable name="SectionID" />));
                          </actinic:block>

                          Not sure I'm using correctly and also get errors??
                          Did you restart Actinic after pasting in the new code, Actinic reads the PHP at startup so the errors may be due to the new code not being included. You can often get an idea of the problem by looking at the source code of the generated page using the 'Preview Current Page'.

                          Malcolm

                          SellerDeck Accredited Partner,
                          SellerDeck 2016 Extensions, and
                          Custom Packages

                          Comment


                            #14
                            Originally posted by Zest View Post
                            Thanks Malbro, Im not great with coding so need a little help???

                            I've pasted your code below and added it to the existing code and then used this to pass:

                            <actinic:block php="true" selectable="false">
                            MakeNav(GetLevel1SectionWrapper(<actinic:variable name="SectionID" />,2,0,<actinic:variable name="SectionID" />));
                            </actinic:block>

                            Not sure I'm using correctly and also get errors??
                            1/ Make sure all references to database in PHP have correct version number 8, 9 or 10 (e.g. "ActinicCatalog8")

                            2/ use this call or similar
                            Code:
                            <actinic:block php="true" > MakeNav(GetLevel1SectionWrapper('<actinic:variable name="SectionID" selectable="false" />'),2,0,<actinic:variable name="SectionID" selectable="false" />); </actinic:block>
                            to call the code. Note the differences with yours as this works OK.

                            Malcolm

                            SellerDeck Accredited Partner,
                            SellerDeck 2016 Extensions, and
                            Custom Packages

                            Comment


                              #15
                              Originally posted by malbro View Post
                              1/ Make sure all references to database in PHP have correct version number 8, 9 or 10 (e.g. "ActinicCatalog8")

                              2/ use this call or similar
                              Code:
                              <actinic:block php="true" > MakeNav(GetLevel1SectionWrapper('<actinic:variable name="SectionID" selectable="false" />'),2,0,<actinic:variable name="SectionID" selectable="false" />); </actinic:block>
                              to call the code. Note the differences with yours as this works OK.
                              Brill, this work great! Just typed in wrong. Just one last thing to finish this off?

                              How can I now add a menu header e.g.
                              <h2><actinic:variable name="SectionName" /></h2>
                              But this stay static for the level 1 header? It would also be good to identify this so you have some code that could also fetch the brand logo?

                              Hope you can help

                              Comment

                              Working...
                              X