Navigation Bar Help

Permalink
Okay, I know the code to get the auto-navigation bar to work on the my website:

<?php
$nav = BlockType::getByHandle('autonav');
$nav->controller->orderBy = 'display_asc';
$nav->controller->displayPages = 'top';
$nav->controller->displaySubPages = 'none';
$nav->render('templates/header_menu');
?>


However I want to customise it. Now I already have the CSS for the navigation bar coded, however when I surround the above code in the <DIV CLASS="Nav"> </DIV>

a.) Only one page link shows
b.) The navigation bar still has the bullet points
c.) I believe it to still be vertical.

Can anyone help me out? I heard you have to use templates, however I can't find any step by step tutorial on how to create templates.

 
codingpenguins replied on at Permalink Reply
Steevb replied on at Permalink Reply
Steevb
Hi,

To learn how to build a template you need to watch Andrews video.

http://www.concrete5.org/documentation/how-tos/designers/make-a-the...

Watch it couple of times and pause, makes notes and then your away....

BTW. I wouldn't put that code in your website or surround it with a div, it does not belong there. You call the block in edit mode on your webpage or sometimes paste it from your scrapbook.

Hope that helped
jordanlev replied on at Permalink Best Answer Reply
jordanlev
Create a new directory on your server here:
YOURSITE/blocks/autonav/templates/


Then copy this file:
YOURSITE/concrete/blocks/autonav/templates/header_menu.php

... to that new directory you created above (so the new copied file should be YOURSITE/blocks/autonav/templates/header_menu.php).

Now edit that new copy of the file and modify the html in there. Note that it's fairly messy, so it might take some tinkering to get working right.

It sounds like maybe your CSS is not set up to handle the menu as an unordered list (<ul> and <li> tags), and if that's the case, you'll need to change out the various <ul>, <li>, </ul>, and </li> tags in the template with whatever <div> and </div> tags (or whatever) it is you need.

In the future, I'd recommend sticking with the default output of the autonav block (<ul> and <li> tags) and creating your CSS to work with that, instead of the other way around -- it's a lot easier to change CSS than it is to work with the autonav templates.

-Jordan
admin replied on at Permalink Reply
Got my navigation bar to work now, thanks!
I used a block and surrounded the navigation code within a div, edited the div css, and then edited the li tags inside the css file to position the navigation bar correctly.
Thanks once again!
jordanlev replied on at Permalink Reply
jordanlev
Cool!
By the way, in the past few days (since I posted my response above), I've actually created a new template for the autonav block that is *much* easier to modify than the built-in one:
https://raw.github.com/jordanlev/c5_clean_block_templates/master/aut...

This is really for the default menu though (the "view.php" template, not "header_menu.php"), so I'm only mentioning it here for future reference -- not because you should change what you already have which works just fine.