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.

Customising the CMS

[SOLVED] What's happening??


2 Posts   1103 Views


21 March 2009 at 1:39pm (Last edited: 21 March 2009 1:51pm), Community Member, 131 Posts


Can anyone tell me what's happening and how to solve things? It looks like I have to patch SiteTree and I don't want to do that if it's not strictly necessary. If I'm reading the docs, (mainly tutorial 5) this shouldn't be happening...

I have a pagetype Persons. In that pagetype (CMS) I can select a page from the type FormContact (by a treedropdownfield). According to the docs on TreeDropdownField, this has to be stored in this way:

   static $has_one = array(
      "ContactForm" => "SiteTree",   

So far so good. But as soon as I call a Persons-page in the frontend I get an error. The exact form of the error depends. If I have selected a FormContact-page it looks like this:

[User Error] Object::__call() Method 'forTemplate' not found in class 'FormContact'
GET /ss/new-persons/?stage=Live

Line 133 in C:\wamp\www\ss\sapphire\core\Object.php

If I haven't selected a FormContact-page it's like this:

[User Error] Object::__call() Method 'forTemplate' not found in class 'SiteTree'
GET /ss/new-persons-2/?stage=Live

Line 133 in C:\wamp\www\ss\sapphire\core\Object.php

The remainder of the message is more or less the same:


125          } else if($config['function_str']) {
126             $function = Object::$extraMethods[$this->class][strtolower($methodName)]['function'] = create_function('$obj, $args', $config['function_str']);
127             return $function($this, $args);
129          } else {
130             user_error("Object::__call() Method '$methodName' in class '$this->class' an invalid format: " . var_export(Object::$extraMethods[$this->class][$methodName],true), E_USER_ERROR);
131          }
132       } else {
133          user_error("Object::__call() Method '$methodName' not found in class '$this->class'", E_USER_ERROR);
134       }
135    }
137    /**
138     * This function allows you to overload class creation methods, so certain classes are
139     * always created correctly over your system.


* Object::__call() Method 'forTemplate' not found in class 'SiteTree' (or in the other case 'FormContact')
Line 133 of Object.php
* Object->__call(forTemplate,Array)
* SiteTree->forTemplate()
Line 425 of ViewableData.php
* ViewableData->XML_val(ContactForm,,1)
Line 23 of
* include(C:\WINDOWS\Temp\silverstripe-cacheC--wamp-www-ss\
Line 350 of SSViewer.php
* SSViewer->process(Persons_Controller)
Line 342 of SSViewer.php
* SSViewer->process(Persons_Controller)
Line 175 of Controller.php
* Controller->handleAction(HTTPRequest)
Line 107 of RequestHandler.php
* RequestHandler->handleRequest(HTTPRequest)
Line 122 of Controller.php
* Controller->handleRequest(HTTPRequest)
Line 19 of ModelAsController.php
* ModelAsController->handleRequest(HTTPRequest)
Line 262 of Director.php
* Director::handleRequest(HTTPRequest,Session)
Line 106 of Director.php
* Director::direct(/new-persons-2/)
Line 115 of main.php


21 March 2009 at 1:55pm Community Member, 131 Posts

OK, it was more of a templating-problem...
I had still an unnoticed $ContactForm-tag in my .ss-file from an earlier attempt which incorporated the whole contactform into the Persons-pagetype.

Off course that tag wanted to know where to find it's template.