5.7 pages under external links
Permalink
I am using C5 5.7 and I am trying to create collapsible sub menus in an autonav however this requires in the sitemap to have an external link linking to '#' with pages under it.
This is so I can apply JS to the top # link to toggle the view of its subpages.
Is this possible and if so how can I achieve this?
This is so I can apply JS to the top # link to toggle the view of its subpages.
Is this possible and if so how can I achieve this?
Thanks, this seems to work however the sub pages are also set to have a href of # which is a problem. I only want the top page to have a href of # if it has sub pages.
I hope that makes sense.
I hope that makes sense.
@wbargent
I am attaching an example custom template and screenshot of the HTML it outputs.
- unzip top_level_hash.zip into application\blocks\autonav\templates (create the folders if they do not already exist)
- after unzipping, you should have this path available
application\blocks\autonav\templates\top_level_hash\view.php
- apply the Top Level Hash custom template to the Auto-Nav block
Click on the Auto-Nav block and choose Design & Custom Template from the popup menu. A new menu bar will appear, choose the gear icon "Custom CSS Classes, Block Name, Custom Templates and Reset Styles" on the right side. From the Custom Template drop down menu, select Top Level Hash.
I am attaching an example custom template and screenshot of the HTML it outputs.
- unzip top_level_hash.zip into application\blocks\autonav\templates (create the folders if they do not already exist)
- after unzipping, you should have this path available
application\blocks\autonav\templates\top_level_hash\view.php
- apply the Top Level Hash custom template to the Auto-Nav block
Click on the Auto-Nav block and choose Design & Custom Template from the popup menu. A new menu bar will appear, choose the gear icon "Custom CSS Classes, Block Name, Custom Templates and Reset Styles" on the right side. From the Custom Template drop down menu, select Top Level Hash.
I still have the same problem.
@wbargent
What settings are you using for the Auto-Nav?
I am attaching a screenshot of the settings I am using for my example.
What settings are you using for the Auto-Nav?
I am attaching a screenshot of the settings I am using for my example.
The same, only difference is I am selecting the page I want the nav to display.
@wbargent
You need to change the level to match the page you selected. The top most level is 1.
You need to change the level to match the page you selected. The top most level is 1.
$ni->level == 1
This is what my autonav outputs. The 4 items under the IT services menu are my submenu items. I want them to have a link however I want the IT services button to have a link of # and the buttons above to also have their original links.
When the Level is set to 1 the submenu and its parent gets a # link; when its set to 2 only the submenu get a link set to #.
When the Level is set to 1 the submenu and its parent gets a # link; when its set to 2 only the submenu get a link set to #.
@wbargent
This will check if the page name is "IT Services". If true, the href value will be "#". If false, it will be the regular URL.
This will check if the page name is "IT Services". If true, the href value will be "#". If false, it will be the regular URL.
echo '<a href="' . ($ni->name == 'IT Services' ? '#' : $ni->url) . '" target="' . $ni->target . '" class="' . $ni->classes . '">' . $ni->name . '</a>';
In the future I will have more drop down's and I would rather not modify the code each time.
I don't believe you can add subpages to an external link.
An alternative to this might be to make a custom template for the Auto-Nav block.
Here is an example using the Responsive Header Navigation custom template:
concrete\blocks\autonav\templates\responsive_header_navigation\view.php
https://github.com/concrete5/concrete5/blob/develop/web/concrete/blo...
This makes the top most level pages, that have subpages, link to "#".
Can you offer more details about what you are trying to make.