1084

Category Builder

Comments for “Category Builder”
 

Posted by MKnights on Friday 25th March 2022 at 08:58 GMT

I am using the category builder and it is currently producing the menu as a nested unordered list.
In this format (I have added the line spacing for clarity).

 <ul id="top-nav">
   <ul>

     <li> <a href="path/to/module/target">Top level A </a> </li>
     <li> <a href="path/to/module/target">Top level B </a> </li>
    
     <li> <a href="path/to/module/target">Top level C (parent) </a> </li>    
     <ul>
       <li> <a href="path/to/module/target">Child A </a> </li>
       <li> <a href="path/to/module/target">Child B </a> </li>
       <li> <a href="path/to/module/target">Child C </a> </li>
     </ul>      
      
     <li> <a href="path/to/module/target">Top level D </a> </li>      
      
   </ul>        
 </ul>


I can see from the code that DC has done some ninja magic and created all of the menu items as unordered list, removing the ul tags with a string replace where the menu item has a value greater than 0.

I have tried to modify the code to reproduce the output to match the following without success.

 <ul>
     <li> <a href="path/to/module/target">Top level A </a> </li>
     <li> <a href="path/to/module/target">Top level B </a> </li>

   <li class="dropdown">
     <a href="javascript:void(0)" class="dropbtn">Top level C (parent) </a>
     <div class="dropdown-content">
       <a href="path/to/module/target">Child A </a>
       <a href="path/to/module/target">Child B </a>
       <a href="path/to/module/target">Child C </a>
     </div>
   </li>

     <li> <a href="path/to/module/target">Top level D </a> </li> 
    
 </ul>
Founding Member

MKnights

User Level: Founding Member

Date Joined: 19/11/2018

Posted by DaFa on Friday 25th March 2022 at 09:36 GMT

Hi Martin,

I see you got the tags working in the code snippets 👍

Is this the category builder from the module market or SCA?
Founding Member

DaFa

User Level: Founding Member

Date Joined: 30/11/2018

Posted by Davcon on Friday 25th March 2022 at 13:51 GMT

Just to let you know, I have a new drag and drop tutorial series about to go up on SCA.

This new one lets you drag the sub categories of 'pages' within 'chapters'. I think it has the potential to be very useful. I may make a module out of this one for the module market.
Founding Member

Davcon

User Level: Founding Member

Date Joined: 3/11/2018

Posted by MKnights on Friday 25th March 2022 at 13:53 GMT

Hi DaFa, yes the is the Category builder from the Module Market.
I am currently using the '_draw_category_nav' and the 'fix' methods to get the results I have posted. But I have only just realised that there is a _append_sub_categories method which will create the child items.
Founding Member

MKnights

User Level: Founding Member

Date Joined: 19/11/2018

Posted by DaFa on Monday 28th March 2022 at 04:51 GMT

Does this mean you have solved the issue?
Founding Member

DaFa

User Level: Founding Member

Date Joined: 30/11/2018

Posted by MKnights on Wednesday 30th March 2022 at 19:26 GMT

Hi Dafa,
No, I have not fixed the issue. I will back track a bit as there are a couple of different issues.
After downloading the Category Builder (CB) I could not style the menu which the module created.
I want to style the menu with just css only without JavaScript, so I spent some time trying to style the menu as it was produced by the CB, in the end I copied the menu code generated by the CB module to a separate file to isolate it from everything else, to work on it.
I could only get the css styling to work by moving one of the closing </li>, see below.
<ul class="category-nav">
  <li>
  <a href="path/to/module/target"">Top level A</a>
  </li>
  <li>
    <a href="path/to/module/target"">Top level B</a>
  </li>
  <li>
    <a href="path/to/module/target"-parent">Top level C (parent)</a>

 <!--  </li> moved from here-->

  <ul>
    <li>
      <a href="path/to/module/target"">Child A</a>
    </li>
    <li>
      <a href="path/to/module/target"">Child B</a>
    </li>
    <li>
      <a href="path/to/module/target"">Child C</a>
    </li>

</li> <!-- moved to here from above  -->    

  </ul>
  <li>
    <a href="path/to/module/target"">Top level D</a>
  </li>
</ul>


So I then trying to get the CB to output the code in correct format or better still in a format I originally posted.
This is why I said the there I as a couple of things; either css code that works with the code as the CB generates it or the CB outputting the desired code.
Founding Member

MKnights

User Level: Founding Member

Date Joined: 19/11/2018

Posted by Davcon on Saturday 2nd April 2022 at 20:04 GMT

Hi,

I just noticed that you have subscribed to the Trongate Fellowship. Thank you!

Well... that changes everything. You have my Skype ID.

Message me on Skype and I'll help you one on one.

Get ready to share your screen.

I can do Monday night any time after 6pm. Is that cool? If it's uncool then I can do Tuesday or Wenesday same time.
Founding Member

Davcon

User Level: Founding Member

Date Joined: 3/11/2018

Posted by MKnights on Monday 4th April 2022 at 10:35 GMT

Hi DC thanks I can make the call tonight.
Founding Member

MKnights

User Level: Founding Member

Date Joined: 19/11/2018

Posted by Davcon on Tuesday 5th April 2022 at 13:02 GMT

Okay dude. Generally any time after 7pm will be good for me. You have my Skype ID. No need for a formal appointment.
Founding Member

Davcon

User Level: Founding Member

Date Joined: 3/11/2018

×