Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Function: multi-level navigation. / Plugin for version 2!
#26
Texta Wrote:I can tell you: the menu is in order now.
Great, that was one of the biggest bugs so I guess people can get going with this now.

I hope you will all share your results with me if you use this script. Would love to see some!
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#27
Zegnåt Wrote:Great! Is the order of the menu items right now too, since I took away the sorting function?

well... there must be something I don't understand about sorting (if no priority set to pages) but if I set priority it's in correct order, and even if I don't set, it's in the same order as page list in the admin pages-tab (where it has never been in correct order for me...), so if there is a bug, it's not in your function, but in the base-code (or more probably on my side Smile

Zegnåt Wrote:I hope you will all share your results with me if you use this script. Would love to see some!

yes i'll share when done

thx again
Patricia
Reply
#28
Patricia Wrote:there must be something I don't understand about sorting (if no priority set to pages) but if I set priority it's in correct order, and even if I don't set, it's in the same order as page list in the admin pages-tab (where it has never been in correct order for me...), so if there is a bug, it's not in your function, but in the base-code (or more probably on my side Smile
The administration panel does not use any kind of sorting I guess.

Also, you're not alone. I haven't really grasped the sorting of GetSimple's menu either. That's why I mentioned having to write my own sorting function sometime.

Ultimately it would be nice if sorting went something like this:
  1. Check for specified sorting order.
  2. Rank it from lowest (1) to highest (20).
  3. Those with no specified priority (-) should be last.
  4. If pages have the same priority (1-20) or non-priority (-) they should be sorted alphabetically.
  5. If alphabetical sorting cannot be applied (due to having the same menu titles) they should be sorted by publication/revision date.
Now to figure out how I'd get it to work like this...
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#29
ok, thx for your answer, for your time and for your existing and future functions Smile
Patricia
Reply
#30
This function is great, but maybe I'm mistaken given the following scenario

Home
--Interior Page (add to menu Y)
----Subpage (add to menu N)

the item 'subpage' is actually included in the menu regardless of it's 'add to menu' status
it inclusion in the menu seems to be based on it's parents 'add to menu' state - is that by design? or am I seeing an anomaly

--
saul
Reply
#31
You—apparently—spotted a mistake. If you don’t check the “add to menu” it should not be added. Did you change some part of my function? If not, please give some more details and I’ll see whether I can spot the bug.

My function should sort out only those with menuStatus set to Y.
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#32
No I'm using the function as provided (no changes) - but if I'm reading it correctly you only check the 'add to menu' status for the parent not the child (forgive me if I'm reading that wrong)

here
if (count($menu)>0) {
echo '<ul class="submenu">';

aren't you just checking for the existence of children regardless of their menuStatus
I tested it twice - create 2 pages and create a child of one of them - turn off the menustate of the child but leave the parent set to add to menu and a li for that item is created at least that's what's happening here.
Reply
#33
sauldraws Wrote:but if I'm reading it correctly you only check the 'add to menu' status for the parent not the child (forgive me if I'm reading that wrong)
I forgive you Wink

Before the count(), the line directly above it, reads:
Code:
$menu = $data->xpath('//*[menuStatus="Y"][parent="'.$link->slug.'/"]');
Meaning $menu should only contain items that you set to show up. I’ll be setting up a new test this afternoon and check it out.

Do you think you could provide me with your files? In case I can’t reproduce your problem.
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#34
If I get a chance later today I'll setup another site and see if I get the same behavior
I tried it several different ways on my current site, and always got the same results.
Reply
#35
Hello,

Unfortunately I'm newbie in editing code. Please explain me where exactly put code to make Drop-Down Menu. GetSimple best CMS for me but very important use it with drop-down menu.
Reply
#36
zhenin Wrote:Unfortunately I'm newbie in editing code. Please explain me where exactly put code to make Drop-Down Menu. GetSimple best CMS for me but very important use it with drop-down menu.
Unfortunately there is no ready to use code for a drop-down menu. All this code will do is give you all the HTML in your template that you might need. You will have to take care of all the CSS (styling) yourself to turn it into a drop-down menu. (Or see whether you know someone who has the time to do this for you.)
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#37
OK, Thank you for immediate response. Hope that will be included in the next release... and now I have to go learn how to do that drop down menu mysef, for a while...
Reply
#38
^ It's all in the PHP section of the code. Change LI to OPTION and that should help a little.
Clients always want to be able to change the content of their pages, but they are unwilling to do so.

Have you ever coded in your underwear before?
Reply
#39
moved here : http://get-simple.info/forum/viewtopic.p...1798#p1798
Fear is mindkiller, the little death that obliterates.
Reply
#40
You are completely right on the classes airtonix, they are mainly there to make it easy for CSS beginners to work with it. On my own website you will note there are no other classes than the active one.

It’s nice to see how you changed it and split it up into multiple parts. Everyone is of course free to use his/her own menu function, I wrote this function one afternoon and thought to share it (as it is—meaning I was not planning to work it out just for the purpose of others using it).

airtonix Wrote:if and when getSimple starts supporting a page tree deeper than 2 levels
ccagle8 Wrote:Added depth seems like a waste of time now, don’t you think? This system really isn’t robust enough to handle multi-multi-level pages.
Not an issue for GetSimple, at least not until some far-future version. We won’t be seeing it in version 2.
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#41
Zeg,

I found that I needed your menu structure and it appears to work well.
However, I wanted to look better in my source code instead of it being bunched up all together.

Here is my change that causes the menu structure to be tabbed and easy to read.
Code:
function menu_master() {
    $data = simplexml_load_string(menu_data('',true));
    $menu = $data->xpath('//*[menuStatus="Y"][parent=""]');
    if (count($menu)>0) {
        echo '<ul class="menu">'."\r";
        foreach ($menu as $link) {
            if ("$link->slug"=="") $link->slug = "index";
            $prnt = count($data->xpath('//item[slug="'.return_page_slug().'"][parent="'.$link->slug.'/"]'));
            $menu = $data->xpath('//*[menuStatus="Y"][parent="'.$link->slug.'/"]');
            echo '<li'.("$link->slug"==return_page_slug()?' class="active"':($prnt>0?' class="parent"':'')).'><a href="'.$link->url.'">'.($link->menu!=""?$link->menu:$link->title).'</a>'.(count($menu)>0?"\r":'');
            if (count($menu)>0) {
                echo "\t".'<ul class="submenu">'."\r";
                foreach ($menu as $link) {
                    echo "\t".'<li'.("$link->slug"==return_page_slug()?' class="active"':'').'><a href="'.$link->url.'">'.($link->menu!=""?$link->menu:$link->title).'</a></li>'."\r";
                }
                echo "\t".'</ul>'."\r";
            }
            echo '</li>'."\r";
        }
        echo '</ul>'."\r";
    }
}
Clients always want to be able to change the content of their pages, but they are unwilling to do so.

Have you ever coded in your underwear before?
Reply
#42
You might want to go with \r\n, which is a different way of breaking the line. I thought it was better supported cross-platform. If you check the source on my website, where I am using it too, you’ll see I tabbed it for cleaner source too.

Good to see some people still care about view source!
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#43
\n = newline
\r = return

\r\n would be best for cross-platform support though
http://nijikokun.com
random stuff. idk.
Reply
#44
Hello again Smile

I've been using your magic "Multilevel Navigation" Script on a lot of projects now - it works as good as ever.

BUT: will it work in Version 2.0?

I tested it online in an copy of a project - and didn't get it to work in V2.0 - so what to do?

Obviously something changed within the functions.php - my navigation will no longer be loaded.

Any workarounds?

Would like to use 2.0 - but without MultiLevelNavigation I can't Sad

Your help would be very much appreciated!

BigWill
Reply
#45
It doesn’t work on version 2.0? I never even really tested, didn’t know we had changed anything about the menu functions. I’ll check it out today and will post back with my findings before the (my) day is over.
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#46
As quick as ever Smile

Thank you very much Wink

Big
Reply
#47
No it will not work on version 2, the current version 2 download seems to have a troubled menu_data() function.

menu_data() is the function used to get all the information on the different menu items, and it seems to be returning faulty slugs. I’m looking into it and am considering putting a next version of the menu up in the form of a plugin within a couple of days.
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#48
Thanks a lot Smile

Looking forward to the new code - because I would really like to switch to V2.0.

In the meantime I will do some translation for a German Language File.

BigWill
Reply
#49
Hi guys,

Have you tried to use this function with Fancy URLs turned on? While it didn't work for me when Fancy URLs was turned of, it seems to be working after I did that change (more details on why this might be happening).

I do realize this might not be a perfect solution (there are a couple of rhetorical questions that run through my head) but it might do the trick until an updated version of GS2.0 is released (I can't seem to find the place from which to download 2.01, since as mentioned in the Change Log, this was released to - return_site_ver() returns 2.0 in my case).

Best regards,
Reply
#50
2.01 is running the main GS site, but it's more of a beta test before we release it to the wild. If you know anything about SVN - you can get it here: http://code.google.com/p/get-simple-cms/
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply




Users browsing this thread: 1 Guest(s)