Drop down menu as an include?
Permalink
Hi, I'm fairly new to Concrete 5 and php, but I'm starting to get my sea legs. :) I have the code for a pure css menu that I designed and would like to use in the header nav. block. It works great if I insert the code on every page, but it sure would be a whole lot easier making edits if I could use it as an include.
How would I go about this?
Thanks,
Maria
How would I go about this?
Thanks,
Maria
Add this code in your theme file(s) where ever you want the main navigation to be.
<?php $bt = BlockType::getByHandle('autonav'); $bt->controller->displayPages = 'top'; $bt->controller->orderBy = 'display_asc'; $bt->controller->displaySubPages = 'all'; $bt->controller->displaySubPageLevels = 'custom'; $bt->controller->displaySubPageLevelsNum = '1'; $bt->render('templates/header_menu'); ?>
I'm used to creating an html file that has just my code for the the drop down menu and maybe a separate css file to attach. Then I would insert one line of html into the div where I want my html include file to be called up.
I do kinda get the inserting of the php that you wrote into my template file. But where do I put the html for the menu, and is there any special code that I'll need to add to it for the php?
Also what format should I save the html file in?
Thanks,
Maria
I do kinda get the inserting of the php that you wrote into my template file. But where do I put the html for the menu, and is there any special code that I'll need to add to it for the php?
Also what format should I save the html file in?
Thanks,
Maria
Sea legs eh? I am salty dog of 20 yrs :)
Anyway about your question. Use an include or modify the existing nav by placing it in yourdomain/blocks. Then you can modifiy it to your hearts content till its just right for you.
Bill