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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Uncaught Exception: Object->__call(): the method 'subpagestocache' does not exist


Reply


5 Posts   1376 Views

Avatar
opitzs

Community Member, 3 Posts

29 March 2011 at 10:31pm

Hi,

when I start a "sake dev/buildcache flush=1" I get the error

the method 'subpagestocache' does not exist on 'CampaignPage'

We are using the StaticExporter (or trying to).
CampaignPage extends InfoPage, which extends PageLsd, which in turn extends SiteTree.

Any help, where to start to look?

Thank you very much
Sven Opitz

Avatar
Willr

Forum Moderator, 5513 Posts

29 March 2011 at 11:24pm

As the error says - it indicates subPagesToCache function does not exist in your page model. Check the function is in your Page class as per http://doc.silverstripe.org/sapphire/en/reference/staticpublisher#usage

Avatar
opitzs

Community Member, 3 Posts

30 March 2011 at 1:47am

I checked it in Page.php and it looks fine. it works for some pages, I guess they are in some way first in line...

Could this snippet be the culprit?

class InfoPage extends PageLsd {
static $db = array(
'date' => 'Date',
'alttitle' => 'varchar(128)',
);

The problem is, I can understand what to insert where, as it is in the docs, that is Copy&Paste. It does however not really explain why.
And the docs get very fast very confusing, if I try to follow them.

Avatar
Willr

Forum Moderator, 5513 Posts

30 March 2011 at 5:09pm

Could you post your Page.php just so we can check? It sounds like you are unsure.

To explain why you need to have those functions the best place to understand is the actual code - https://github.com/silverstripe/silverstripe-cms/blob/master/code/staticpublisher/StaticPublisher.php.

* allPagesToCache() returns an array of all the url segments you would want to cache
* subPagesToCache you don't need to define but in that example allPagesToCache calls that function. Think of it as a helper function
* pagesAffectedByChanges is optional. If you have it you need to return an array of url segments you want to update when publishing the current page (often you'll want to also update the homepage).

Hope that helps!

Avatar
opitzs

Community Member, 3 Posts

30 March 2011 at 6:05pm

It certainly does.
Knowing this I can use the help files better and then find the error.

Thank you!