Coding a SubNav into Footer.php Page

Permalink
I am working on a custom website project and trying to build an "autonav" element within the footer page. I feel like I am close but not quite there... I have setup the site structure so that I can test the coding/setup as I go... I have sub-pages off of a main page "Magazine" that is to be the submenu that appears in the Footer section. I could make it static but want to set it up as an auto-nav so it may update as the site structure might change.

<div id="subnav" <?php global $cp; if (is_object($cp) && ($cp->canWrite() || $cp->canAddSubContent() || $cp->canAdminPage())) {
   echo ' style="bottom:20px;"'; }?>>
<div id="menu-wrap" class="submenu clearfix">
<div id="menu-tab" class="toggle"><img src="<?php echo $this->getThemePath(); ?>/images/menu-tab.png" alt="View Menu" /></div>
<!-- menu-tab ends -->
<div id="menu" class="items">
    <?php
   $bt = BlockType::getByHandle('autonav');
   $bt->controller->displayPages = 'beneath';
   $bt->controller->orderBy = 'display_asc';                    
   $bt->controller->choosePage = 'magazine';                   
   $bt->controller->displaySubPages = 'none';                   
   ?>
            </div><!-- #menu ends -->
       </div><!-- #menu-wrap ends -->


So what are the correct "controller" settings to make this work correctly?

Any guidance is appreciated... tga

tgadams11
 
mhawke replied on at Permalink Best Answer Reply
mhawke
I'm not sure where you found your options but here's a list from this great reference page:

http://www.weblicating.com/doku/doku.php?id=cheatsheet/...

<?php
  $bt = BlockType::getByHandle('autonav');
  $bt->controller->displayPages = 'top'; // 'top', 'above', 'below', 'second_level', 'third_level', 'custom'
  $bt->controller->displayPagesCID = Collection_ID_Number; // if display pages is set ‘custom’
  $bt->controller->orderBy = 'display_asc';  // 'chrono_desc', 'chrono_asc', 'alpha_asc', 'alpha_desc', 'display_desc'             
  $bt->controller->displaySubPages = 'none';  //none', 'enough', 'enough_plus1', 'all', 'custom'             
  $bt->controller->displaySubPageLevels = '';  //'all', 'none', 'enough', 'enough_plus1', 'custom' 
  $bt->controller->displaySubPageLevelsNum = ''; // if displaySubPages is set 'custom'
  $bt->render('view'); // for template 'templates/template_name'
?>
tgadams11 replied on at Permalink Reply
tgadams11
Thanks for the info and help... I was actually just working by trial n' error deduction based on the Concrete interface for creating an AutoNav block content within a page....

This is much more explanatory and now the trick to find the right combination of controllers to make it work...

Thanks... tga
mhawke replied on at Permalink Reply
mhawke
If you like to work by trial and error then here's a great reference for that:

http://www.merriam-webster.com/...

;-)
tgadams11 replied on at Permalink Reply
tgadams11
Ohhhhh we got jokes I see... hahaha :-p
mhawke replied on at Permalink Reply
mhawke
A little Christmas cheer.
tgadams11 replied on at Permalink Reply 1 Attachment
tgadams11
I am soooooo close it's driving me bonkers... I am displaying the first "subpage" of the Custom main menu item or in this case 116 (Magazine page)... but all I am seeing is the first sub-page (Subscribe) for it right now... but there should be 5 other pages...

<div id="subnav" >
<?php    
   $bt=BlockType::getByHandle('autonav'); 
   $bt->controller->displayPages = 'custom';
   $bt->controller->displayPagesCID = '116';
   $bt->controller->orderBy = 'display_asc';                    
   $bt->controller->displaySubPages = 'all'; 
   $bt->controller->displaySubPagesLevels = 'all'; 
   $bt->render('templates/header_menu');
   ?>
     </div><!-- #footer ends -->


What am I missing? :-\
mhawke replied on at Permalink Reply
mhawke
I'm not exactly clear what your situation is but try this:

<?php    
   $bt=BlockType::getByHandle('autonav'); 
   $bt->controller->displayPages = 'custom';
   $bt->controller->displayPagesCID = '116';
   $bt->controller->orderBy = 'display_asc';                    
   $bt->controller->displaySubPages = 'none'; 
   $bt->controller->displaySubPagesLevels = 'enough'; 
   $bt->render('templates/header_menu');
?>
tgadams11 replied on at Permalink Reply 1 Attachment
tgadams11
That didn't seem to make any difference... the site structure looks like this:

HOME
.....INSTRUCTIONS
.....STYLE
.....INFLUENCE
.....MAGAZINE
..........SUBSCRIPTION
..........NEXT PAGE
..........NEXT PAGE
..........AND SO ON....

As shown in the attachment... only the SUBSCRIPTION page/link is showing in the menu bar area... but not the rest of the pages on that level. And I want them to display from left to right (as indicated by the red arrow)...

Does this help shed some more light? ;-\
mhawke replied on at Permalink Reply 1 Attachment
mhawke
Silly question...

Do the other pages at the same level as 'Subscription' have their 'Exclude from Nav' attribute set?

As for the horizontal display, you would need to add a new template to the system. I have attached a modified 'breadcrumb.php'. To add it to your system just rename it 'horizontal.php' and upload it to '[root]/blocks/autonav/templates/horizontal.php'. Then modify your call to:

$bt->render('templates/horizontal')
mhawke replied on at Permalink Reply
mhawke
Another thought. They might be rendering vertically but not displaying because of the small height of the div. Have a look at your View Source to see if they are actually being rendered.
tgadams11 replied on at Permalink Reply
tgadams11
The view source confirms that they are being generated... so it appears that it's the fact that it's displaying vertically and not horizontally.... I was wondering if that might be the issue today... grrrrr

Let me try what you provided in the previous post... Thanks.
mhawke replied on at Permalink Reply
mhawke
Never trust your eyes. Let 'Inspect Element' be your eyes.
tgadams11 replied on at Permalink Reply
tgadams11
okay... downloaded the file, renamed... loaded into the specified location... and updated footer.php file with the modified render statement... then the menu disappeared altogether... the orange bar is still displaying but the SUBSCRIBE link (or anything else) simply vanished from view...

viewed source and saw the following at the end:

<br />
<b>Fatal error</b>:  Call to undefined method AutonavBlockController::getNavItems() in <b>/home/tgadams/readtheinstructionscarefully.com/style/concrete/blocks/autonav/templates/horizontal.php</b> on line <b>2</b><br />


????
mhawke replied on at Permalink Reply
mhawke
I think I see the issue. Did you put it in '[root]/CONCRETE/blocks/autonav/templates'.

If you did, you need to stay out of the concrete folder.

It goes in '[root]/blocks/autonav/templates'. Make those folder if they don't exist.
mhawke replied on at Permalink Reply
mhawke
That's not it because I can put horizontal.php in the core '[root]/concrete/blocks/autonav/templates' folder and it works fine so it must be something else. Double check that it's in '[root]/blocks/autonav/templates'
mhawke replied on at Permalink Reply
mhawke
Another thought... Make sure your overrides cache is off at 'Dashboard->System and Settings->Cache and Speed Settings'
tgadams11 replied on at Permalink Reply
tgadams11
what's the trick again to get into the dashboard for the site when one has trouble...?

at this point, I cannot get logged into the site in order to access the dashboard and I remember there was a round about way... *sigh*
tgadams11 replied on at Permalink Reply
tgadams11
I did fix the level... I did put it in the core... not the file is in the root but still seeing the same error message:

<b>Fatal error</b>:  Call to undefined method AutonavBlockController::getNavItems() in <b>/home/tgadams/readtheinstructionscarefully.com/style/blocks/autonav/templates/horizontal.php</b> on line <b>2</b><br />


READTHEINSTRUCTIONSCAREFULLY.COM is actually the domain for this project... The concrete site is in the .com/STYLE/ directory until I'm ready to go live, then it gets moved up a level to the "root" in this case... ;-)
mhawke replied on at Permalink Reply
mhawke
Yes I edited my post once I realized I was being an idiot in the domain name.

Another thought... Make sure your overrides cache is off at 'Dashboard->System and Settings->Cache and Speed Settings'

Try the 'Breadcrumbs' template to see if that one works. I know it's not exactly what you're after but my template is exactly the same except I left out the ">>" between the links.
tgadams11 replied on at Permalink Reply
tgadams11
what is odd is that I don't see the breadcrumbs.php or header_menu.php in the root/ area... only in the core... so I guess I will add a copy of the breadcrumb.php to the same spot as the horizontal.php template then...
mhawke replied on at Permalink Reply
mhawke
What happens if you just add a regular area to the footer and then add an autonav through the regular editing process. Set the options in there and choose 'Horizontal' as the custom template.

I wouldn't bother adding extra breadcrumb and header_nav to the root. They're supposed to be in the core. I tested it out and you can have custom templates in either the core or the root but if they are in the core, they will disappear when you update the site. I don't think that's the issue.
tgadams11 replied on at Permalink Reply 1 Attachment
tgadams11
well well well well well.... that did it... now I am seeing the the attached view.... AND my administrator menu is back!!

gonna look at doing a few minor tweaks to it... but YEA!!!!!!

thanks for your help... one module down... tomorrow's adventure is the jQuery main header piece/menu... that should be REALLY fun!

chat with you again Michael... tga
mhawke replied on at Permalink Reply
mhawke
But does 'horizontal' custom template work? I see it's set to breadcrumbs which puts the '>' separator between the links which implies that the user is deep into the website hierarchy.
tgadams11 replied on at Permalink Reply
tgadams11
that wasn't working... I copied the breadcrumb.php to the root area as you mentioned... then updated the code to render the breadcrumb instead... then it worked...
mhawke replied on at Permalink Reply
mhawke
If you want to get rid of the '>' symbol, just rename 'breadcrumb.php' to 'horizontal.php' and edit it to put spaces (a bunch of '&n b s p;'s) in place of the '>' at the top (inside the <span>></span>)

That's all I did to create my horizontal.php that worked on my system but failed on yours.
mhawke replied on at Permalink Reply
mhawke
You never told me your Admin Bar was missing. That implies something else is broken. Oh well, tomorrow's another day!
tgadams11 replied on at Permalink Reply
tgadams11
No worries man... I already edited to have "spacing" instead of the ">" in between each link... ;-)

Also, the Admin bar is showing as I indicated in the last attachment I sent... so all is well... The only minor tweak left is to make the menu links black text... I had it set that way earlier today and now it's white... so I will look at that later...

But tomorrow's adventure is the jQuery main menu header element... Don't go too far... I'm sure I'll be on here again... hahaha
mhawke replied on at Permalink Reply
mhawke
The reason you need to rename your modified 'breadcrumb.php' to something else is because now that you modified the breadcrumb template, you can't actually use it as an actual breadcrumb nav because now it's missing the '>'.
tgadams11 replied on at Permalink Reply
tgadams11
I follow you.... I made the change and everything still seems to be fine... So now I have a a file named footer_menu that I am calling in the render statement...

Thanks for the clarification... tga
mhawke replied on at Permalink Reply
mhawke
Glad to hear everything got worked out.

Just a quick question... Is there a reason you need to hard-code that nav into the template? It seems like a lot of work for something that could be added as a Global Area and tweaked from the front-end.
tgadams11 replied on at Permalink Reply
tgadams11
I view it as global because I changed/updated the Footer.php file with this modified nav... Basically, I took what only contained the Admin nav bar and added this additional nav bar to it... This way it will appaar on every page as a "global" element. Also it gave me more control over the look because of the design the client wants... if that makes sense.
mhawke replied on at Permalink Reply
mhawke
What you have done is certainly acceptable. No real criticism. I understand that this is a global and I support your desire to place it in the footer of every page. It's just that in my experience, I've regretted hard-coding things into the template files because it complicates things when the client changes their mind or if you want to freshen the site down the road.

I guess my suggestion would be to try to put the Global Area code in the footer like so:

<div class="clients_wishes">
  <?php
    $a=new GlobalArea('Footer Menu');
    $a->display();
  ?>
</div>


Then put the page in edit mode and add an autonav to this Global Area and tweak the options to show the pages you want, including assigning your footer_menu custom template. This literally takes about 2 minutes to accomplish rather than going back and forth experimenting with different hard-coded options.

I guess I've learned to use all the features offered by the concrete5 development environment and only dig in to hard-coding when the front-end is not equipped to solve your specific issue.

As I say, what you accomplished is certainly a fine, workable solution. I'm just giving you some things to think about and try.

Now, onwards to jQuery!!
tgadams11 replied on at Permalink Reply
tgadams11
I certainly appreciate the insight... don't get me wrong.... I simply did what I thought was correct or what worked for me being a novice at this still.... I'll have to re-read your post and try to absorb it more... I understand what you're driving at but don't totally get it... if that makes sense... hahaha

You're right... onward to jQuery fun... will start that once I get up... need a little more rest... :-)
tgadams11 replied on at Permalink Reply
tgadams11
Quick question.... what is the difference between a "fullheader.php" and the "header.php"? This base Concrete theme that I'm using and modifying has both of those files... I had started making updates in the "header.php" file yesterday and now that I'm focused on the header work today, I'm realizing there are two of them... And they both appear to contain the same code accept for one minor difference that the "fullheader" has a body ID specified.

So what's the difference? :-\
mhawke replied on at Permalink Reply
mhawke
I don't have access to your theme so I can only suggest that you'd have to look at the very top of your template files (full.php, left_sidebar.php, etc) to see which one has:

$this->inc('elements/header.php');

and which one has:

$this->inc('elements/fullheader.php');

If you go "Edit->Design" and swap your page out for the page type that includes the fullheader.php, you might get a clue as to why they created two different header files.
tgadams11 replied on at Permalink Reply
tgadams11
That makes sense.... However, considering that I plan to modify and/or create Page Type templates, I will probably just stick with one and make sure that is being called as the "header" for all of them....
mhawke replied on at Permalink Reply
mhawke
You say it is a concrete5 base theme that you're modifying. Which theme is it? I don't see a 'fullheader.php' in my core themes.
tgadams11 replied on at Permalink Reply
tgadams11
I am using the Boldy theme as the base... you or someone else recommending it over using some others... ;-)
mhawke replied on at Permalink Reply
mhawke
Boldy is nice. When you mentioned it was a 'base' concrete them, I thought you meant a 'core' theme. I'll shut up now and let you get back to work.
tgadams11 replied on at Permalink Reply
tgadams11
No worries man... I appreciate your input and will continue to look forward to it... ;-)
boltn replied on at Permalink Reply
boltn
THNX a bunch. Was fidling around with putting page list in footer through page list. This is clean and exactly what i needed.