Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cached Navigation Menu plugin
#1
Whenever a page is requested with GetSimple the server needs to look through all the page files of the site to generate the main navigation menu. This can take quite a bit of time if the site has lots of large pages. To ease the server load I made a simple little plugin that implements a caching mechanism for the main navigation menu. This way the server only needs to read 1 file to generate the menu :-)

Instructions and downloads are available on http://www.fohlin.net/getsimple-cached-n...ion-plugin

Cheers!
Reply
#2
Very useful plugin. Thanks for sharing it.
Reply
#3
Thanks Erka!
Reply
#4
thanks Eka, i'm going to test it.

One simple question, when is the menu data updated ? Is you plugin able to automatically detect new pages and changed SLUGs ?
Reply
#5
marrco Wrote:One simple question, when is the menu data updated?
Every time you save a page on the back-end the plugin will remove all of its cache files.
If you load a page on the front-end to display it will search for a cache file and if it doesn’t exist create one.

Hope that answers your question.
“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
#6
Zegnåt Wrote:Every time you save a page on the back-end the plugin will remove all of its cache files.
If you load a page on the front-end to display it will search for a cache file and if it doesn’t exist create one.

yes, thanks. I guess this will be one of my favorite plugins
Reply
#7
marrco Wrote:I guess this will be one of my favorite plugins

Me too. This plugin can help keep the host provider from complaining we use too much resources Smile

There's just something I'd like to suggest to the developer regarding install instructions. I'm newb so probably it's just me who gets confused following simple instructions so I opened "cached_navigation.php" for editing as instructed.

The line "<?php get_navigation(return_page_slug()); ?>" wasn't there, of course it's in the template file! stupid me.

So I made a readme file and saved it in my plugins collection after editing the instruction to:

**************************************

2) Open theme/YOUR_TEMPLATE/template.php

3) Change

<?php get_navigation(return_page_slug()); ?>
to
<?php get_cached_navigation(return_page_slug()); ?>

**************************************


Thanks for the great plugin!!
Reply
#8
spring Wrote:There’s just something I’d like to suggest to the developer regarding install instructions. I’m newb so probably it's just me who gets confused following simple instructions so I opened “cached_navigation.php” for editing as instructed.
It might not be clear if you haven’t gotten very much into GetSimple before, just mentioning get_navigation() around here pretty much tells every GetSimple developer what to do. But I believe the install instructions are correct: (emphasis added by me)
fohlin.net Wrote:2) Change
<?php get_navigation(return_page_slug()); ?>
to
<?php get_cached_navigation(return_page_slug()); ?>
in your template.
cached_navigation.php is a plugin, not your template. template.php and other PHP files in your template folder are your template and that’s where the change needs to be done.

There is actually a reason why your instructions might be more confusing. You specify a certain file, but some themes offer multiple PHP files and those would all need to be edited. That’s why you can only talk about changing your theme files/template files and not about specific file names.
“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
#9
Zegnåt Wrote:
fohlin.net Wrote:2) Change
<?php get_navigation(return_page_slug()); ?>
to
<?php get_cached_navigation(return_page_slug()); ?>
in your template.

...but some themes offer multiple PHP files and those would all need to be edited. That’s why you can only talk about changing your theme files/template files and not about specific file names.

Aha! now I see the picture much clearer. So far I'm only working on the default template because it satisfies everything I need. I'll have a look on other templates later.

And since it was the last line I missed I'll move that to the first line:

2) Change in your template
<?php get_navigation(return_page_slug()); ?>
to
<?php get_cached_navigation(return_page_slug()); ?>




Thanks Zegnåt!
Reply
#10
there is a bug, at least with 2.03

when i modify a page and click save all i get is :

>> Unable to clean up ...getsimple/data/other/navigation_cache folder

a workaround to the issue is:
- log to the ftp, rename /plugins/cached-navigation.php (site stop working)
- save the modified page
- rename the modified plugin back to his original name

by the way, i already noticed an issue a few days ago, after installing the plugin: I'm not able to chdir to data/other/navigation_cache
the folder has been automagically created with 750 permission
(/data/other/logs is standard 775)
Reply
#11
Hi Marrco.
This seems to indicate that you are having some privileges issues on your server.
The web server can not write to (delete files in) the navigation_cache folder.
The easiest way to fix it is probably to just delete the navigation_cache folder, and let the web server rebuild it.

marrco Wrote:there is a bug, at least with 2.03

when i modify a page and click save all i get is :

>> Unable to clean up ...getsimple/data/other/navigation_cache folder

by the way, i already noticed an issue a few days ago, after installing the plugin: I'm not able to chdir to data/other/navigation_cache
the folder has been automagically created with 750 permission
(/data/other/logs is standard 775)

Well, not a bug but a bit of security minded thinking.
All the files in the navigation_cache folder will be deleted whenever you save a page so letting you put personal files in there is not a good idea.

I have just released v. 0.8 of the plugin (http://www.fohlin.net/getsimple-cached-n...ion-plugin) with the privs set to 755 to try to prevent accidental placing of files in the navigation_cache folder.

v. 0.8 also has a few minor improvements and 1 bug fix that could cause an error message if the navigation_cache folder did not exist when a page was saved.

Cheers,
Erik
Reply
#12
Thx Erik, testing v.0.8:
Unable to clean up the folder ...getsimple/data/other/navigation_cache, check folder content privileges.

just be sure i did a chgrp -R web plugins/ then deleted the folder to have all the files recreated, but no difference.

data/pages files have a 755 permissions, yours a 644 maybe a 664 can do?

btw, i'm using a security-aware hosting: nearlyfreespeech, so maybe using a more 'relaxed' hosting gives different results.
Reply
#13
marrco Wrote:Thx Erik, testing v.0.8:
Unable to clean up the folder ...getsimple/data/other/navigation_cache, check folder content privileges.
just be sure i did a chgrp -R web plugins/ then deleted the folder to have all the files recreated, but no difference.
Hi Marrco.
The navigation_cache folder to delete or chmod is not plugins/navigation_cache, it is data/other/navigation_cache
It was an old version that had it in plugins/ now it is in data/other/

Cheers,
Erik
Reply
#14
erka Wrote:The navigation_cache folder to delete or chmod is not plugins/navigation_cache, it is data/other/navigation_cache

deleted and chmoded, same problem: Unable to clean up the folder ...getsimple/data/other/navigation_cache, check folder content privileges.

so it looks like there's still something wrong with plugin&data permissions.
Reply
#15
Hm... It works for me on multiple sites and I can not reproduce your problem.
Anyone else seeing this problem?
/Erik
marrco Wrote:so it looks like there's still something wrong with plugin&data permissions.
Reply
#16
erka Wrote:Hm... It works for me on multiple sites and I can not reproduce your problem.
Anyone else seeing this problem?
/Erik
marrco Wrote:so it looks like there's still something wrong with plugin&data permissions.

chgrp -R web www.mysite.tld solved the issue.
Reply
#17
Caching is now also used in the I18N plugin, which also provides a fully multi-language enabled multi-level hierarchical navigation and a better user interface for setting page parent and menu position, when editing a page.

http://get-simple.info/extend/plugin/i18n/69/ and http://mvlcek.bplaced.net
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply




Users browsing this thread: 1 Guest(s)