1
sceilig
multiMenu cache problem
  • 2007/1/10 1:48

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


Im using XOOPS v2.2.4 with multiMenu v1.8 on a Linux server running PHP 4.4.2.

It works great and for my main menu block im using the "Drop down Vertical" which utilises this template multimenu_dyn_vert.html.

I have the cache set to be 1 week, but if someone makes changes to the menu, I added a hack so it would refresh the cache.
using this XOOPS function:
xoops_template_clear_module_cache($xoopsModule->mid());

That all works fine. However I have been noticing that on a few of the websites Ive built with multiMenu like this, it sometimes displays a different block template, for no apparent reason - multimenu_list.html.

Here is the serialized array from the top of the multiMenu block that gets cached successfully.
Quote:

a:4:{s:8:"template";a:2:{s:26:"db:multimenu_block_01.html";b:1;s:26:"db:multimenu_dyn_vert.html";b:1;}s:9:"timestamp";i:1167943791;s:7:"expires";i:1168548591;s:13:"cache_se
rials";a:0:{}}


And here is what the cache file changes to on a website where Ive noticed this issue.
Quote:

a:4:{s:8:"template";a:2:{s:26:"db:multimenu_block_01.html";b:1;s:22:"db:multimenu_list.html";b:1;}s:9:"timestamp";i:1168172890;s:7:"expires";i:1168777690;s:13:"cache_serial
s";a:0:{}}


Note that the arrays are from 2 separate websites, but they are built identical in every way. And Ive seen the issue occur on about 4 of my websites all built like this.

Anyone have an idea why this would happen, or how I could go about tracking down this bug?

2
sceilig
Re: multiMenu cache problem
  • 2007/1/10 1:51

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


I should also mention that when the cache multiMenu file changes to be multimenu_list.html, if I go to the Menu Blocks admin area and view the options set for the multiMenu block, they are set correctly -- the Block Format is set to "Drop down vertical".

3
solo71
Re: multiMenu cache problem
  • 2007/1/10 9:47

  • solo71

  • Module Developer

  • Posts: 941

  • Since: 2003/1/29


Quote:

sceilig wrote:

That all works fine. However I have been noticing that on a few of the websites Ive built with multiMenu like this, it sometimes displays a different block template, for no apparent reason - multimenu_list.html.


It's not a bug. It's a function I've implemented for SEO optimisation reasons.

The fact is that bots do not read very well links included in javascript. Thus, I have added a little script which detect if a bot is visiting the page, and display the list template instead, which is a more botfriendly template.

The downside aspect of this, is that if you set some cache on your block, and that it is a bot which renew the bloc cache, the block will display the list for everyone (at least till the cache expiration).

I will definitly have to remove this option.

So...

2 solutions :

1) Remove cache on your block.

2) Edit the 'block/block.php' file, and quote the following lines :

// Check user agent (SEO). If Spider, display list style
if ( eregi"bot",     getenv("HTTP_USER_AGENT") )     ||
 
eregi"spider",     getenv("HTTP_USER_AGENT") ) ||
 
eregi"robot",     getenv("HTTP_USER_AGENT") )     ||
 
eregi"crawler"getenv("HTTP_USER_AGENT") ) ) {
    
$block['format'] = "ul";
} else {
    
$block['format'] = $options[0];
}



4
sceilig
Re: multiMenu cache problem
  • 2007/1/10 12:12

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


Thanks for the fast response solo71 and for explaining the issue -- it had me completely stumped.

multiMenu truly is a powerful module.

I did run into another problem with using the multimenu_dyn_vert.html template.

I can change colors and background images for the menu from my theme stylesheet e.g. #mainmenu
However, I cant control the colors or background images for a submenu of links, and the parent link for the submenu. These seem to be hardcoded into the multimenu_dyn_vert.html template. It seems the javascript in the template needs to have some of the style info right there, rather than reference it from the theme stylesheet.

Perhaps Im missing something and it can be controlled from the theme stylesheet, or maybe you can suggest another hack or workaround?

Thanks for your help!

Oh and here is a suggestion of an enhancement for a future version. When adding a link to the menu, to give the user the option to choose a link to an existing content page from a dropdown, or to choose a link to any of the installed modules from another dropdown. I implemented this on my end since I was using wfchannel for adding content pages on my sites and the administrators who manage the sites aint very techie so I had to give them the ability to quickly add a content page and make it live in a specific place on the main menu.

5
solo71
Re: multiMenu cache problem
  • 2007/1/10 14:36

  • solo71

  • Module Developer

  • Posts: 941

  • Since: 2003/1/29


Quote:

sceilig wrote:

multiMenu truly is a powerful module.


Thanks.

Quote:

sceilig wrote:

I did run into another problem with using the multimenu_dyn_vert.html template.

I can change colors and background images for the menu from my theme stylesheet e.g. #mainmenu
However, I cant control the colors or background images for a submenu of links, and the parent link for the submenu. These seem to be hardcoded into the multimenu_dyn_vert.html template. It seems the javascript in the template needs to have some of the style info right there, rather than reference it from the theme stylesheet.

Perhaps Im missing something and it can be controlled from the theme stylesheet, or maybe you can suggest another hack or workaround?


While developping (along with Blueteen) the 1.8 serie and its "awfully" complicate dynamic menus, we had to deal with : php, html, smarty, java and css scripts (which is what mainly composes those templates). I know that the mix is not perfect. Some menus are tricky, even for myself, to tweak around. I must say I'm not really happy with it, as it is not really userfriendly. Basically, this 1.8-1.9 version is intended to be functionnal and experimentative. I'm planning to develop a multiMenu 2.x version which would be easier to manage. Don't ask me when, I'm on my XOOPS hibernation at the moment (not talking about my job).



Quote:

sceilig wrote:
Oh and here is a suggestion of an enhancement for a future version. When adding a link to the menu, to give the user the option to choose a link to an existing content page from a dropdown, or to choose a link to any of the installed modules from another dropdown. I implemented this on my end since I was using wfchannel for adding content pages on my sites and the administrators who manage the sites aint very techie so I had to give them the ability to quickly add a content page and make it live in a specific place on the main menu.


I don't get you well on this. Did you tweak multiMenu? If so, please let me see it.

Back on the improvment aspect of this module, I'm planning to implement dynamic multiMenu links. That is, the admin will be able to "program" a menu, so that it would update its content depending on a specific module/table's content. I did some tests, and it seems to work fine. This would be part of the 2.x serie anyway.


6
sceilig
Re: multiMenu cache problem
  • 2007/1/11 19:34

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


Looking forward to the 2.x release.

I just emailed you a couple of screenshots of my multiMenu hack.

7
irmtfan
Re: multiMenu cache problem
  • 2007/1/11 21:20

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


Quote:
I'm planning to develop a multiMenu 2.x version which would be easier to manage

another good news.

now the main problem i have with multimenu is xhtml incompatibility in dynamic and tree menu.

Login

Who's Online

456 user(s) are online (395 user(s) are browsing Support Forums)


Members: 0


Guests: 456


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits