Jump to:

5539 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » [SOLVED] What's happening??

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

Page: 1
Go to End
Author Topic: 1089 Views
  • theAlien
    Community Member
    131 Posts

    [SOLVED] What's happening?? Link to this post


    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 .cacheC..wamp.www.ss.themes.myTheme.templates.Layout.Page.ss
    * include(C:\WINDOWS\Temp\silverstripe-cacheC--wamp-www-ss\.cacheC..wamp.www.ss.themes.myTheme.templates.Layout.Page.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

  • theAlien
    Community Member
    131 Posts

    Re: [SOLVED] What's happening?? Link to this post

    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.

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.