Autonav doesn't display on view.php
Permalink
Hi
I've never had to use view.php pages before but I've tried adding the autonav to it, but it doesn't display in the same way - all the styling has gone.
Any ideas why?
Thanks
I've never had to use view.php pages before but I've tried adding the autonav to it, but it doesn't display in the same way - all the styling has gone.
Any ideas why?
Thanks
Yes view.php is in my theme and all the other styles on the page are appearing correctly.
It's just the autonav which obviously is inserted separately.
Looking at the code it looks like the appropriate ids and classes aren't being inserted onto the <li>s.
Is there any reason why this might be happening?
Thanks
It's just the autonav which obviously is inserted separately.
Looking at the code it looks like the appropriate ids and classes aren't being inserted onto the <li>s.
Is there any reason why this might be happening?
Thanks
Could be a CSS thing then?
If you look at the classes and what they called this could help with the styling in your CSS.
If you look at the classes and what they called this could help with the styling in your CSS.
It can't be that as the autonav styles work perfectly on all other pages. It's just view.php for some reason...
I'm reading your question as if you're making a copy of the autonav's view.php file, but you can't get it display properly on your site.
If that's the case, then the view.php has to be in a sub-folder called "templates" of the autonav block itself (not your /theme folder) like so:
DOCUMENT_ROOT/blocks/autonav/templates/my_autonav/view.php
Where "my_autonav" is the name you wish give your new template. Or, you could simply do:
DOCUMENT_ROOT/blocks/autonav/templates/my_autonav.php
Which works the same - either way is acceptable. Then when you add a new autonav block you can simply choose "Custom Template" and select your custom one.
If that's the case, then the view.php has to be in a sub-folder called "templates" of the autonav block itself (not your /theme folder) like so:
DOCUMENT_ROOT/blocks/autonav/templates/my_autonav/view.php
Where "my_autonav" is the name you wish give your new template. Or, you could simply do:
DOCUMENT_ROOT/blocks/autonav/templates/my_autonav.php
Which works the same - either way is acceptable. Then when you add a new autonav block you can simply choose "Custom Template" and select your custom one.
Thanks for your replies. I think maybe I didn't explain properly.
Basically this is the view.php file located in the site's theme directory which is used for things like 404 etc, not the view.php used in the autonav folder.
As I said, the autonav feature is working perfectly on all pages apart from the ones which use the view.php template.
Any ideas?
Thanks
Basically this is the view.php file located in the site's theme directory which is used for things like 404 etc, not the view.php used in the autonav folder.
As I said, the autonav feature is working perfectly on all pages apart from the ones which use the view.php template.
Any ideas?
Thanks
Does your view.php look like this?
Interestingly, the password input isn't picking up any styles either...
http://www.countrysidenurseries.co.uk/nurseries/parents-room/...
http://www.countrysidenurseries.co.uk/nurseries/parents-room/...
So what CSS is the header calling?
Make sure header is calling both CSS and in your case the nav javascript.
Why is your link showing:
http://www.countrysidenurseries.co.uk/index.php/passwordrequest/?re...
Thats not pretty, if you see what I mean
Steev
<link href="/themes/nurseries/nav.css" rel="stylesheet" type="text/css" />
Why is your link showing:
http://www.countrysidenurseries.co.uk/index.php/passwordrequest/?re...
Thats not pretty, if you see what I mean
Steev
I've compared the references to the stylesheets in this password page and in a normal page such as the home page:http://www.countrysidenurseries.co.uk/...
...and they're identical. So everything is being referenced correctly.
The differences are how the autonav is working though. This is how it should look in code:
But this is how it looks in this view.php template page:
As you can see it looks like the appropriate ids / classes aren't being pulled in for whatever reason.
Any ideas why this might be?
...and they're identical. So everything is being referenced correctly.
The differences are how the autonav is working though. This is how it should look in code:
<div id="nav"> <ul class="nav"> <li id="homeactive" class="nav-selected nav-path-selected"><a class="nav-selected nav-path-selected" href="/"></a></li> <li id="about" ><a href="/about/"></a><ul> <li id="working-partnership" ><a href="/about/working-partnership/">Giving You Peace of Mind</a></li> <li id="structure-sessions" ><a href="/about/structure-sessions/">Parents As Partners</a></li> <li id="tax-credits" ><a href="/about/tax-credits/">Our Rooms</a></li> <li id="childcare-vouchers" ><a href="/about/childcare-vouchers/">Head Office Support</a></li> <li id="testimonials" ><a href="/about/testimonials/">Testimonials</a></li> ...etc </div>
But this is how it looks in this view.php template page:
<div id="nav"> <ul class="nav"><li><a href="/" >Home</a></li> <li><a href="/about/" >Countryside Nurseries - About us</a></li> <li><a href="/nurseries/" >Our Nurseries</a></li><li><a href="/financials/" >Financials</a></li> <li><a href="/links/" >Links</a></li> <li><a href="/contact/" >Contact us</a></li> </ul> </div>
As you can see it looks like the appropriate ids / classes aren't being pulled in for whatever reason.
Any ideas why this might be?
But is your header calling your CSS file?
Yes it is.
I don't think this is a CSS problem - if you manually add the IDs via Firebug the link displays properly. As you mentioned, everything is being referenced as it should.
Could you paste the contents of your autonav's view.php (or whichever template you're using)?
Could you paste the contents of your autonav's view.php (or whichever template you're using)?
Sure, here you are:
<? defined('C5_EXECUTE') or die(_("Access Denied.")); $aBlocks = $controller->generateNav(); $c = Page::getCurrentPage(); $containsPages = false; $nh = Loader::helper('navigation'); //this will create an array of parent cIDs $inspectC=$c; $selectedPathCIDs=array( $inspectC->getCollectionID() ); $parentCIDnotZero=true; while($parentCIDnotZero){ $cParentID=$inspectC->cParentID; if(!intval($cParentID)){ $parentCIDnotZero=false; }else{
Viewing 15 lines of 78 lines. View entire code block.
If it was a matter of not being able to load the ctHandle of each page in the nav then we would be seeing something like ...id=""..., but we don't get a blank ID attribute; it's not even firing your autonav template, but it looks like it's firing the default view.
I'm assuming you're using the Page Password addon (http://www.concrete5.org/marketplace/addons/page-password/) given the URL of the example you posted.
If you access said page via the dashboard's site map, go into edit mode and check the block's template what do you see?
I've never used that addon, but perhaps it's programatically adding the block with taking into account the custom view?
I'm assuming you're using the Page Password addon (http://www.concrete5.org/marketplace/addons/page-password/) given the URL of the example you posted.
If you access said page via the dashboard's site map, go into edit mode and check the block's template what do you see?
I've never used that addon, but perhaps it's programatically adding the block with taking into account the custom view?
Yes it is the Page Password addon I'm using.
If I do as you suggested, everything looks as it should do really! (doesn't help!)
I'm not quite sure what you mean by your last sentence?
If I do as you suggested, everything looks as it should do really! (doesn't help!)
I'm not quite sure what you mean by your last sentence?
If it is running your template as intended then if we slightly modify it like so:
..then we should see that hidden <div> in the source. Could you try that and paste the "View Source" code of the autonav? My hunch is that it won't show up since we're not seeing ANY id attribute on the <li> elements at all (not even blank ones).
What I meant by last sentence was that some addons programatically insert a block after content (eg. ProBlog adds a Next/Prev block in this manner after every content block you add). I don't know the Password Page addon so it could be that it's doing so without taking into account the custom template you've built (I'm totally guessing here - a shot in the dark).
..then we should see that hidden <div> in the source. Could you try that and paste the "View Source" code of the autonav? My hunch is that it won't show up since we're not seeing ANY id attribute on the <li> elements at all (not even blank ones).
What I meant by last sentence was that some addons programatically insert a block after content (eg. ProBlog adds a Next/Prev block in this manner after every content block you add). I don't know the Password Page addon so it could be that it's doing so without taking into account the custom template you've built (I'm totally guessing here - a shot in the dark).
Thanks for all your help on this.
The problem lay in the fact I was adding the autonav in the normal way rather than using the custom template.
I hadn't added the autonav originally so wasn't aware I should be doing it this way, so it was slightly confusing to say the least.
I appreciate all your help.
The problem lay in the fact I was adding the autonav in the normal way rather than using the custom template.
I hadn't added the autonav originally so wasn't aware I should be doing it this way, so it was slightly confusing to say the least.
I appreciate all your help.
Glad you got it worked out :)
Is the view.php header calling your CSS?
Take a look at the source it should show CSS sheet and path.