Subnav URL?

Permalink
Is there a way to call the URL for subnav items through the AutoNav block?

I have this in view.php:

<a href="' . $ni->url . '" target="' . $ni->target . '" class="fixedTip exampleTip ' . $ni->classes . '" title="<img src=\' ' . $this->getThemePath() . '/images/nav/vts_1.jpg \'>">' . $ni->name . '</a>


but I want this:

<a href="' . [SUBNAV URL] . '" target="' . $ni->target . '" class="fixedTip exampleTip ' . $ni->classes . '" title="<img src=\' ' . $this->getThemePath() . '/images/nav/vts_1.jpg \'>">' . [SUBNAV PAGE NAME] . '</a>


Any help is much appreciated, and if you need more info, let me know. Thanks.

stephmars
 
wagdi replied on at Permalink Reply
wagdi
Not sure if I understood correctly but I do know that when you add an 'autonav' block, you have many options to choose from..

You can choose to have it display pages at the top level, second level, third level etc.. or even beneath a particular page.

You also have a choice of which sub-pages to display and then even which sub-page levels you wish to use.

Just click on the 'autonav' block and 'edit'.

Hope that helps.
stephmars replied on at Permalink Reply
stephmars
Hi, thanks.

What I'm trying to do with the Autonav block is have this be the output:

<div class="sf-menu-wrapper">
    <ul class="sf-menu">
        <li class="single selected">
            <a href="about.htm">About Us</a>
        </li>
        <li class="section multi "> <a href="stuff.htm">Other Stuff</a>
        <ul class="demos">
          <li>
            <div class="dropdown-container">
              <div class="dropdown-section-container">
                <div class="dropdown-section">
                    <a href="lorem.htm" class="fixedTip exampleTip" title="<div class='nav_inset vts_1'></div>">Lorem</a>
                    <a href="ipsum.htm" class="fixedTip exampleTip" title="<div class='nav_inset vts_2'></div>">Ipsum</a>
                    <a href="sit.htm">Sit</a>
                    <a href="dolor.htm">Dolor</a>


As you can see, in order to do this I need the li's to NOT appear for the dropdowns, because they're tied into some very specific JS and CSS using two different plug-ins. When the Autonav adds the li's to the dropdowns, the menu breaks.

I figure if I can somehow split the PHP in view.php to showing the main nav when I want it to, and the subnav when I want it to, it might work. But right now I have just $ni->url to work with.

Sorry, I know it may not make much sense. There's so much to the HTML/CSS/JS and now PHP, I wanted to simplify by just asking for what I (think I) need.
jordanlev replied on at Permalink Best Answer Reply 1 Attachment
jordanlev
I don't think it's going to be possible to put the menu you have into the autonav block. The problem is that your markup is too specific to the exact pages in the site, but the autonav block works in generalities (it always outputs the same things for all pages at a certain level). The point of the autonav block is to create the menu based on whatever pages your users add to the site, so it's generally not a good idea to code in specific styles for specific pages. These things in your markup look like they're specific to certain pages of the site:

<ul class="demos">

class="fixedTip exampleTop"

title="<div class='nav_inset vts_1'>

...so really you need to either hard-code the menu (which means if your users rename pages or move them around or add new ones, you need to update the code manually), or figure out how to make a menu that is not so specific to the pages you're expecting the site to have.

If you can make your markup more "generalizable", you might find this alternate template easier to work with than the built-in one:
https://raw.github.com/jordanlev/c5_clean_block_templates/master/aut...

...save that file as "view.php" and place it in a new folder in your site here:
SITEROOT/blocks/autonav/view.php


I'm attaching a version of that alternate template that does almost everything in your menu markup, except for the specific things I listed above. Download it, rename it to "view.php", and place that in SITEROOT/blocks/autonav/view.php. Hopefully that gets you close enough.

-Jordan
stephmars replied on at Permalink Reply
stephmars
Hi Jordan,

Thanks for the response - I thought as much. I will be hard coding the menu. And thanks for the attachment, that's the one I was using! :)

Thanks again,

Steph