Navigation problem converting html to theme
Permalink
Hi,
I converted a html page into a c5 theme. It all works fine except for the navigation:
The main nav is hard coded into my default.php:
<div id="menu">
<?php
$bt_nav = BlockType::getByHandle('autonav');
$bt_nav->controller->displayPages = 'all';
$bt_nav->controller->orderBy = 'display_asc';
$bt_nav->controller->displaySubPages = 'all';
$bt_nav->render('view');
?>
</div>
On this page all menu items show up (it is a second level page)
http://www.arnold-wolf.at/uber-mich/texte/...
On this page only the current page shows up (top level page)
http://www.arnold-wolf.at/aktuelles/...
I tried changing the display values (top, all, second level)
I also had
$bt_nav->render('templates/header_menu')
I got this code from this tutorialhttp://www.concrete5.org/documentation/how-tos/designers/making-a-t...
maybe it is too old?
I also tried not to hard code the nav but add an editable area.
I tried:
<div id="menu">
<?php
$a = new Area('Header Nav');
$a->setBlockLimit(1);
$a->display($c);
?>
</div>
and also
<?php
$ga = new GlobalArea('Header Nav');
$ga->display();
?>
The area is shown and looks like a normal editable area but it is not editable.
I then found a post that havin a z-index in your CSS can meddle with editable areas. So I removed the z-indexes with the result that the nav disappeared comletely and the main area was not editable anymore.
Next I tried just adding an autonav block to the main area but it is displayed like a listing with points and vertically, not horizontally, even if I change the custom template to header menu
Can somebody help me?
I converted a html page into a c5 theme. It all works fine except for the navigation:
The main nav is hard coded into my default.php:
<div id="menu">
<?php
$bt_nav = BlockType::getByHandle('autonav');
$bt_nav->controller->displayPages = 'all';
$bt_nav->controller->orderBy = 'display_asc';
$bt_nav->controller->displaySubPages = 'all';
$bt_nav->render('view');
?>
</div>
On this page all menu items show up (it is a second level page)
http://www.arnold-wolf.at/uber-mich/texte/...
On this page only the current page shows up (top level page)
http://www.arnold-wolf.at/aktuelles/...
I tried changing the display values (top, all, second level)
I also had
$bt_nav->render('templates/header_menu')
I got this code from this tutorialhttp://www.concrete5.org/documentation/how-tos/designers/making-a-t...
maybe it is too old?
I also tried not to hard code the nav but add an editable area.
I tried:
<div id="menu">
<?php
$a = new Area('Header Nav');
$a->setBlockLimit(1);
$a->display($c);
?>
</div>
and also
<?php
$ga = new GlobalArea('Header Nav');
$ga->display();
?>
The area is shown and looks like a normal editable area but it is not editable.
I then found a post that havin a z-index in your CSS can meddle with editable areas. So I removed the z-indexes with the result that the nav disappeared comletely and the main area was not editable anymore.
Next I tried just adding an autonav block to the main area but it is displayed like a listing with points and vertically, not horizontally, even if I change the custom template to header menu
Can somebody help me?
Hi lexbi,
thxs for taking the time to answer.
I put in the global area as you suggested with the result that now the Add to Sitewide Header Nav is there but still not editable and there is an output of the navigation up there that couldn't be there at all really. ??
thxs for taking the time to answer.
I put in the global area as you suggested with the result that now the Add to Sitewide Header Nav is there but still not editable and there is an output of the navigation up there that couldn't be there at all really. ??
I think I found out what the trouble was, in main CSS there was #menu and
#menu li.nav-selected with some attributes. I removed these and left only
text-decoration:underline; in the second one so now it works.
Still haven't got the hang of the areas in the menu that were not editable though.
#menu li.nav-selected with some attributes. I removed these and left only
text-decoration:underline; in the second one so now it works.
Still haven't got the hang of the areas in the menu that were not editable though.
Hi rrtiz,
No problem,
I would suggest making sure your styles are not conflicting with other by using developer tools. Chrome's are fantastic, you can see what styles are applied to an element, enable/disable them.
Good luck :)
No problem,
I would suggest making sure your styles are not conflicting with other by using developer tools. Chrome's are fantastic, you can see what styles are applied to an element, enable/disable them.
Good luck :)
I would suggest using a global block as a header if it's not going to change, alternatively a normal area and a stack would work pretty much the same it's up to you.
Myself, I would just use:
After that's in, make sure that caching is turned off (it's a pain in the arse).
Now in regard to your z-index issue, I have seen this a few times myself on concrete sites, basically concrete5 creates it's own div elements in your code to create the editable block look. If your z-indexing is weird it might interfere with what concrete is trying to do. Sometimes it's a matter of "position:relative" on the body element of your page.
I would suggest putting this in your css, and keeping your other z-index values below what is set here (you can obviously amend these values to suit you, but be aware large numbers throw out some browsers), also stay away from negative z-index (it's just a pain I've found):
Lastly in regard to the list not looking right, it's just a matter of css, maybe it's just added an ID/class in that template that you've already got styled, I would suggest creating your own "autonav" template with new IDs/classes using jordan_lev's template here:https://github.com/jordanlev/c5_clean_block_templates/blob/master/au...