Closed (fixed)
Project:
footermap: a footer site map
Version:
6.x-1.5
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
8 Oct 2009 at 10:53 UTC
Updated:
26 Oct 2009 at 15:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
karengrey commentedComment #2
mradcliffeThis is actually a bit difficult to implement as a feature in the module itself for all cases and have it work for everyone the way they want.
For your particular situation, it may be best to patch (hack) the module slightly for your own needs. If you know how to apply a patch, this bit of code may help your situation.
I don't think this is going to be a feature that I'll implement permanently.
edit: it should apply to the development version, but you'll need to wait 12-14 hours before that updates before you apply it.
Comment #3
karengrey commentedHi,
Ive applied the patch but it doesnt seem to make any difference.
Any other ideas?
Comment #4
mradcliffeWhoops. I forgot to explain the patch in my previous post.
There are two numbers that you'll need to change around. I just put them in arbitrarily.
On this line:
if ($level > 3 && $mycount < 5)Put the menu depth after which you want this to start working. So if you wanted it at the second level, replace the 3 with a 1. I would recommend setting this number to the Recursion Depth - 1.
The second number is how many items you want it to go to. Note: that if a menu has child items neither will show up if there are more or equal parent items than this number.
Example:
Let's say you only wanted 3 child items under the main item.
Set the first number to 1 and set the second number to 4.
This should have everything but the Impressionist item and its child items and the Random item.
Comment #5
karengrey commentedOk i changed the two values but still not getting the right output.
Ive included a couple screenshots so you can see whats going on.
When setting level to 1 it only shows the parent item.
When setting level to 2 it displays all the children but doesnt stop when mycount reaches its value (so it keeps going after the 5th increment) (also - it doesnt matter what value i put into $mycount - it seems to ignore it)
Is there something im forgetting to do?
to clarify - my function footermap_get_menu() looks like this:
function footermap_get_menu($mlid,$level,$limit,&$mapref,$arrcnt,$avail_menus)
{
global $db_type;
if( ($limit != 0 ) && ($level > $limit) )
return;
if (variable_get('sys_menus',0) == 0)
$add = " AND ml.module <> 'system' ";
else
$add = ' ';
if( module_exists('path') )
$r = db_query("SELECT ml.*, (SELECT ul.dst FROM {url_alias} ul WHERE src = ml.link_path) AS alias FROM {menu_links} ml WHERE ml.plid = %d AND ml.hidden <> -1".$add."ORDER BY ml.plid,ml.weight",$mlid)
or die(db_error());
else
$r = db_query("SELECT ml.* FROM {menu_links} ml WHERE ml.plid = %d AND ml.hidden <> -1".$add."ORDER BY ml.plid,ml.weight", $mlid)
or die(db_error());
$mycount = 0;
while( $h = db_fetch_object($r) )
{
if ($level > 1 && $mycount < 6) //show only 5 items
return;
$mycount++;
if (preg_match("/node\/(\d+)/",$h->link_path,$matches) == 1)
$node = node_load($matches[1]);
$g = 0;
...and so on.
Comment #6
karengrey commentedDoh - after all that i figured it out!
if ($level > 1 && $mycount > 4)
mycount should be higher than, not lower than :)
Thanks for your help!
Comment #7
mradcliffeSorry for the confusion.