Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Silverstripe Static Caching


Go to End


9 Posts   4236 Views

Avatar
S0crates9

27 Posts

19 October 2008 at 5:53am

I was reading the post on the DNC static cashing code and I followed the documentation, however silverstripe kept on issuing an error stating that I was missing "FilesystemPublisher". Where do I get this and related files? Its not in cms/code/ ...

Thanks in advance for any direction.

Avatar
Willr

Forum Moderator, 5523 Posts

19 October 2008 at 3:53pm

You need to be using the latest trunk version of the code. Static publishing will be part of the new 2.3 release coming soon. You can download the latest development code on dailybuilds - http://dailybuilds.silverstripe.com/core-tarballs/

Avatar
da_g

Community Member, 3 Posts

20 October 2008 at 8:34am

Got the latest trunk which has FileSystemPublisher and SaticPublisher. I have just installed the standard site (wamp\www\sileverstripe) and edited wamp\www\sileverstripe\mysite\_config.php and added:

Object::add_extension("SiteTree", "FilesystemPublisher('cache/', 'html')");

How do I create the static copy of my site and into which directory will it go - wamp\www\sileverstripe\mysite\cache???

Avatar
Willr

Forum Moderator, 5523 Posts

20 October 2008 at 10:18am

to build the cache you run a script called dev/buildcache. You can do this via command line and sake or via the webbrowser by visiting http://www.site.com/dev/buildcache and this will output the contents of the rebuild to a folder called 'cache' on your sites top level (same level as cms, sapphire etc).

Avatar
da_g

Community Member, 3 Posts

20 October 2008 at 1:26pm

Tried it, but get a UserError (accessing site using http://localhost/silverstripe/dev/buildcache). Please define a method "allPagesToCache()" on your Page class...

What exactly should be in my wamp\www\sileverstripe\.htaccess? And do I need to and anything to wamp\www\sileverstripe\mysite\code\Page.php?

Avatar
Willr

Forum Moderator, 5523 Posts

20 October 2008 at 2:24pm

Because this is an unreleased feature we currently do not have full docs on it. You need to make the changes to your .htaccess file listed on http://doc.silverstripe.com/doku.php?id=staticpublisher also not listed there, but needed as you can see from your error msgs you need to define the 'cache' on your Page.php file and a few methods for it. Here is a bad example but it should describe the methods to recache every page

Avatar
da_g

Community Member, 3 Posts

20 October 2008 at 11:27pm

Thanks. I read / followed the directions in this link but there isn't a mention of what to put in the Page.php file. What should I put in this file? It is for this feature, staticpublish, that I chose this CMS. I really need to get it working.

Avatar
Willr

Forum Moderator, 5523 Posts

21 October 2008 at 12:01pm

Edited: 21/10/2008 12:03pm

It needs to go in your Page class (the controller part is only for the templates really). The static caching is all pretty beta code and we are working on the documentation in the coming weeks for it.

Sorry my last post was meant to have a pastie link - http://pastie.org/pastes/296003 with the basic good

Go to Top