Posts: 972
Threads: 27
Joined: Aug 2009
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!
Posts: 10
Threads: 0
Joined: Sep 2009
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
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
Posts: 972
Threads: 27
Joined: Aug 2009
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 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:
- Check for specified sorting order.
- Rank it from lowest (1) to highest (20).
- Those with no specified priority (-) should be last.
- If pages have the same priority (1-20) or non-priority (-) they should be sorted alphabetically.
- 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...
Posts: 10
Threads: 0
Joined: Sep 2009
ok, thx for your answer, for your time and for your existing and future functions
Patricia
Posts: 12
Threads: 0
Joined: Dec 2009
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
Posts: 972
Threads: 27
Joined: Aug 2009
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.
Posts: 12
Threads: 0
Joined: Dec 2009
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.
Posts: 972
Threads: 27
Joined: Aug 2009
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
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.
Posts: 12
Threads: 0
Joined: Dec 2009
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.
Posts: 2
Threads: 0
Joined: Dec 2009
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.
Posts: 972
Threads: 27
Joined: Aug 2009
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.)
Posts: 2
Threads: 0
Joined: Dec 2009
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...
Posts: 339
Threads: 27
Joined: Nov 2009
^ It's all in the PHP section of the code. Change LI to OPTION and that should help a little.
Posts: 6
Threads: 2
Joined: Dec 2009
2009-12-25, 03:43:51
(This post was last modified: 2010-01-11, 02:28:33 by Spaceman.)
Fear is mindkiller, the little death that obliterates.
Posts: 972
Threads: 27
Joined: Aug 2009
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.
Posts: 339
Threads: 27
Joined: Nov 2009
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";
}
}
Posts: 972
Threads: 27
Joined: Aug 2009
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!
Posts: 111
Threads: 14
Joined: Jan 2010
2010-01-10, 09:59:54
(This post was last modified: 2010-01-10, 10:01:18 by martynas.barzda.)
\n = newline
\r = return
\r\n would be best for cross-platform support though
Posts: 7
Threads: 2
Joined: Oct 2009
Hello again
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
Your help would be very much appreciated!
BigWill
Posts: 972
Threads: 27
Joined: Aug 2009
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.
Posts: 7
Threads: 2
Joined: Oct 2009
As quick as ever
Thank you very much
Big
Posts: 972
Threads: 27
Joined: Aug 2009
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.
Posts: 7
Threads: 2
Joined: Oct 2009
Thanks a lot
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
Posts: 4
Threads: 0
Joined: Feb 2010
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,
Posts: 1,848
Threads: 86
Joined: Aug 2009
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!
|