Header Nav not being written
Permalink 1 user found helpful
I have the "Header Nav" code in my header.php file for the theme I have created but it is not being written to the page.
I have three pages in my site including the Home page and the "Add To Header Nav" shows when I am in Edit mode. I can't click on this and when looking at in in Firbug there is no content in it.
Any ideas what I am doing wrong?
Cheers
Bob
I have three pages in my site including the Home page and the "Add To Header Nav" shows when I am in Edit mode. I can't click on this and when looking at in in Firbug there is no content in it.
Any ideas what I am doing wrong?
Cheers
Bob
Bob
The code looks ok, can you copy all the code in your header.php to this post. Also is the header in a folder called 'elements' in your theme?
Sorry if this is obvious stuff but I am just trying to see where it may have gone wrong.
The code looks ok, can you copy all the code in your header.php to this post. Also is the header in a folder called 'elements' in your theme?
Sorry if this is obvious stuff but I am just trying to see where it may have gone wrong.
Thanks!!
The code for header.php is below. The theme is in root/themes/cakes and is working
header.php is in /elements along with footer.php and both are pulling in.
I have 2 templates, default.php and full.php and they seem to be working
I must be doing something wrong but I'm totally blind to it.
Bob
The code for header.php is below. The theme is in root/themes/cakes and is working
header.php is in /elements along with footer.php and both are pulling in.
I have 2 templates, default.php and full.php and they seem to be working
I must be doing something wrong but I'm totally blind to it.
<?php defined('C5_EXECUTE') or die("Access Denied."); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <!-- Site Header Content //--> <link rel="stylesheet" media="screen" type="text/css" href="<?php echo $this->getStyleSheet('master.css')?>" /> <link rel="stylesheet" media="screen" type="text/css" href="<?php echo $this->getStyleSheet('typography.css')?>" /> <?php Loader::element('header_required'); ?> <!--[if lte IE 6]> <script src="/concrete/js/unitpngfix.js" type="text/javascript"></script> <![endif]--> <script type="text/javascript" src="<?php echo $this->getThemePath(); ?>/master.js"></script> </head> <body>
Viewing 15 lines of 28 lines. View entire code block.
Bob
Hi Bob
To be honest I can't see anything wrong with the code you are using. I am hoping that wiser heads may read this post and come up with something.
My only idea is to change the way you add the Nav to the page. Instead of an editable area maybe embed it in the header, see the link below for a How To
http://www.concrete5.org/documentation/how-tos/developers/hardcode-...
or
Maybe try adding the Header Nav to a scrapbook and call it using:
<?php
$b = Block::getByName('Header Nav');
if( is_object($b) ) $b->display();
?>
I know that neither suggestion fixes your problem but hopefully it gives you an alternative.
Hope that helps
Alex
To be honest I can't see anything wrong with the code you are using. I am hoping that wiser heads may read this post and come up with something.
My only idea is to change the way you add the Nav to the page. Instead of an editable area maybe embed it in the header, see the link below for a How To
http://www.concrete5.org/documentation/how-tos/developers/hardcode-...
or
Maybe try adding the Header Nav to a scrapbook and call it using:
<?php
$b = Block::getByName('Header Nav');
if( is_object($b) ) $b->display();
?>
I know that neither suggestion fixes your problem but hopefully it gives you an alternative.
Hope that helps
Alex
Shucks, I thought you were going to save me!
Thanks for looking into it and I'll try the code you linked to. I may try a re-install first jsut to see if something has corrupted.
Your help is appreciated
Thanks
Bob
Thanks for looking into it and I'll try the code you linked to. I may try a re-install first jsut to see if something has corrupted.
Your help is appreciated
Thanks
Bob
I can get a nav by adding an Auto Nav to each page within the Header Nav block but if I add this as a block under the PageTypes ti doesn't show up either. There seems to be a problem with a site-wide navigation being written to the pages.
Hi, thanks for looking but no joy, still won't appear. It's like it's not recognising the reserved 'Header Nav' handle.
has anyone had any luck figuring this out? I think I'm having the same issue, only it works fine for my home page, but for all subsequent pages I create there is no Auto Nav information showing and the code for my inside pages is exactly the same as my default.php page!!
I've stil no solution to this, ended up having to put an AutoNav on every page. It's working now but really not how I want it to be, for the clients' sake!
Hey Bob
The best way I found for adding a navigation that's going to be on every page is to do madeforspace's second suggestion by adding the code to call the block from your scrapbook (or any other scrapbook you may have). I found that by creating a general scrapbook for just "site elements" like header and footer blocks makes it easy to find/edit them later.
Once you put the code in the div you want it to appear in the header
add the block to your scrapbook and make sure to change the name (c5 will automatically assign it a block number) to whatever is placed in the parenthesis above (ie: Header Nav). It MUST match exactly for this to work.
Hope this helps!
The best way I found for adding a navigation that's going to be on every page is to do madeforspace's second suggestion by adding the code to call the block from your scrapbook (or any other scrapbook you may have). I found that by creating a general scrapbook for just "site elements" like header and footer blocks makes it easy to find/edit them later.
Once you put the code in the div you want it to appear in the header
<?php $b = Block::getByName('Header Nav'); if( is_object($b) ) $b->display(); ?>
add the block to your scrapbook and make sure to change the name (c5 will automatically assign it a block number) to whatever is placed in the parenthesis above (ie: Header Nav). It MUST match exactly for this to work.
Hope this helps!
Thanks for the tip, cyandesigns... I actually had tried using the scrapbook method before but it didn't work for me.. come to find out I had given the block the wrong name. if you look at the scrapbook it says the name of the scrapbook item, but that isn't necessarily the name of the scrapbook block to call.. I clicked on view and it gave me "Auto-Nav: 'Main Nav 76'" whereas when I just look at the scrapbook it says just "Main Nav". I put the "Main Nav 76" in the code instead of "Main Nav" and it worked beautifully!! thank you so much.. :)
Mike
Mike
SMASHING! That has worked a treat, thank you! and thanks to vertext21 for the extra tip. At last a solution!
Bob
Bob
Hi there,
This happens to me all the time. This is how I fix it...
(Assuming you're in Edit Mode) > *click* on the "Add to Header nav" then *click* "Add Block" and then *click* on "Auto nav" then *click* the "Add" button.
Now you have a normal (ugly looking) nav.
*click* on the newly added nav (the "Auto Nav" you have just added) and when the little menu pops up *click* on the last link "Custom Template" - select "Header nav" from the select box and *click* the "Update" button. Done :)
This happens to me all the time. This is how I fix it...
(Assuming you're in Edit Mode) > *click* on the "Add to Header nav" then *click* "Add Block" and then *click* on "Auto nav" then *click* the "Add" button.
Now you have a normal (ugly looking) nav.
*click* on the newly added nav (the "Auto Nav" you have just added) and when the little menu pops up *click* on the last link "Custom Template" - select "Header nav" from the select box and *click* the "Update" button. Done :)
This solution helped me just partly!
This way I could add a block to all my sites but I couldn't edit it! :/
So the better solution is maybe even more simple:
1. Go to Dashboard -> Scrapbook and make a new Scrapbook.
2. On your site now go to the block you want to copy to every page.
3. In edit mode select the block and copy to Scrapbook, In the drop-down menu choose your new Scrapbook you created. Now two options appear:
- New copy to Scrapbook
- Alias original to Scrapbook
Choose the second one: Alias!
4. Now go to another page on your site, where you also want to have this block, select Past from Scrapbook and choose your block.
Do this for every page you want your block to appear.
5. That's it! Since your block are now connected all your changes in this block appear across the entire site :)
Hope I could help somebody.
Live consciously!
This way I could add a block to all my sites but I couldn't edit it! :/
So the better solution is maybe even more simple:
1. Go to Dashboard -> Scrapbook and make a new Scrapbook.
2. On your site now go to the block you want to copy to every page.
3. In edit mode select the block and copy to Scrapbook, In the drop-down menu choose your new Scrapbook you created. Now two options appear:
- New copy to Scrapbook
- Alias original to Scrapbook
Choose the second one: Alias!
4. Now go to another page on your site, where you also want to have this block, select Past from Scrapbook and choose your block.
Do this for every page you want your block to appear.
5. That's it! Since your block are now connected all your changes in this block appear across the entire site :)
Hope I could help somebody.
Live consciously!
This is the code I have used in header.php
header.php is showing but not the nav - I now have 4 pages!
Thanks
Bob