Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » DataObjectManager Code Examples

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2 3 4 5 6 7 8 9 10 11
Go to End
Author Topic: 20480 Views
  • vivilanco
    Avatar
    Community Member
    19 Posts

    Re: DataObjectManager Code Examples Link to this post

    thanks for the reply. I am using just the "blackcandy" template without any adaptations.

    would there be any conflict between other modules?
    (i have )
    image_gallery
    userforms
    newsletter
    forum
    dataobject_manager

    I am in the process of uploading the lot to my hosting to see if i get the problem online (as opposed to WAMP)

  • UncleCheese
    Avatar
    4085 Posts

    Re: DataObjectManager Code Examples Link to this post

    Just go through the template that is throwing the error and make sure all the <% include %> tags are pointing to an include file that exists on your server.

  • vivilanco
    Avatar
    Community Member
    19 Posts

    Re: DataObjectManager Code Examples Link to this post

    I have manages to get the following to work:
    http://www.carlinowebdesign.com/assets/dataobjectmanager_examples.zip

    thanks for all your help

    this is the one i am haivng trouble with but in honesty i can make the other work
    http://imt.carlinowebdesign.com/assets/resources.zip
    (thats the error)

  • UncleCheese
    Avatar
    4085 Posts

    Re: DataObjectManager Code Examples Link to this post

    What do you mean when you say it doesn't work? It's difficult to help when I don't know what problem you're having.

  • vivilanco
    Avatar
    Community Member
    19 Posts

    Re: DataObjectManager Code Examples Link to this post

    sorry, i am aware of my inability to communicate of late (stress got the better of me).

    with this download http://imt.carlinowebdesign.com/assets/resources.zip I was / am getting this error (taken from page 7 of this post, 2 February 2010 at 10:19pm).
    (thats the error)

    [Warning] file_get_contents() [function.file-get-contents]: Filename cannot be empty
    GET /silverstripe-HCA/new-resourcepage/

    Line 280 in C:\wamp\www\silverstripe-HCA\sapphire\core\SSViewer.php
    Source

    271 /**
    272 * Used by <% include Identifier %> statements to get the full
    273 * unparsed content of a template file.
    274 *
    275 * @uses getTemplateFile()
    276 * @param string $identifier A template name without '.ss' extension or path.
    277 * @return string content of template
    278 */
    279 public static function getTemplateContent($identifier) {
    280 return file_get_contents(SSViewer::getTemplateFile($identifier));
    281 }
    282
    283 /**
    284 * @ignore
    285 */
    286 static private $flushed = false;

    Trace

    * file_get_contents()
    Line 280 of SSViewer.php
    * SSViewer::getTemplateContent(ResourceNav)
    Line 2 of SSViewer.php(403) : runtime-created function
    * __lambda_func(Array)
    * preg_replace_callback(/<% include +([A-Za-z0-9_]+) +%>/,�lambda_5402,<!-- template C:/wamp/www/silverstripe-HCA/themes/blackcandy/templates/Layout/ResourcePage.ss --> <div id="primaryContent" class="clearfix"> <div class="innerpad"> <h2>$Title</h2> $Content <% control Resources %> <h3><img src="$Attachment.Icon" alt="" /> <a href="$Attachment.URL" title="Download $Title">$Title</a> ($Attachment.Extension, $Attachment.Size)</h3> <p>$Description</p> <% end_control %> </div> </div> <div id="secondaryContent"> <div class="innerpad"> <div id="secondarynav"> <h3>Categories</h3> <% include ResourceNav %> </div> </div> </div> <div id="sideContent"> <div class="innerpad"> </div> </div> <!-- end template C:/wamp/www/silverstripe-HCA/themes/blackcandy/templates/Layout/ResourcePage.ss -->)
    Line 403 of SSViewer.php
    * SSViewer::parseTemplateContent(<div id="primaryContent" class="clearfix"> <div class="innerpad"> <h2>$Title</h2> $Content <% control Resources %> <h3><img src="$Attachment.Icon" alt="" /> <a href="$Attachment.URL" title="Download $Title">$Title</a> ($Attachment.Extension, $Attachment.Size)</h3> <p>$Description</p> <% end_control %> </div> </div> <div id="secondaryContent"> <div class="innerpad"> <div id="secondarynav"> <h3>Categories</h3> <% include ResourceNav %> </div> </div> </div> <div id="sideContent"> <div class="innerpad"> </div> </div>,C:/wamp/www/silverstripe-HCA/themes/blackcandy/templates/Layout/ResourcePage.ss)
    Line 324 of SSViewer.php
    * SSViewer->process(ResourcePage_Controller)
    Line 349 of SSViewer.php
    * SSViewer->process(ResourcePage_Controller)
    Line 172 of Controller.php
    * Controller->handleAction(HTTPRequest)
    Line 129 of RequestHandler.php
    * RequestHandler->handleRequest(HTTPRequest)
    Line 119 of Controller.php
    * Controller->handleRequest(HTTPRequest)
    Line 29 of ModelAsController.php
    * ModelAsController->handleRequest(HTTPRequest)
    Line 277 of Director.php
    * Director::handleRequest(HTTPRequest,Session)
    Line 121 of Director.php
    * Director::direct(/new-resourcepage/)
    Line 118 of main.php

    and thats all it gives me. I put the 3 php files in C:\wamp\www\silverstripe-HCA\mysite\code and the .ss files in C:\wamp\www\silverstripe-HCA\themes\blackcandy\templates\Layout. it is all a standard template (i have not created any <% includes %> other than what are used in the following addons :
    image_gallery
    userforms
    newsletter
    forum
    dataobject_manager

    have done a fair amount of jiggery pokery with it but still not made any success with it.

    thats the problem, that help?

    (btw, thanks for your interest in this)

  • UncleCheese
    Avatar
    4085 Posts

    Re: DataObjectManager Code Examples Link to this post

    If you look at this line:

    * SSViewer::getTemplateContent(ResourceNav)

    It's looking for an Include file that is coming up non-existent. Have you checked your templates to see if this <% include %> tag is in there?

  • vivilanco
    Avatar
    Community Member
    19 Posts

    Re: DataObjectManager Code Examples Link to this post

    I have removed the resource and put the problem ones in (3php and 3ss). and then db/build?flush=1

    the error i have has now:

    [User Error] Uncaught Exception: Object->__call(): the method 'resources' does not exist on 'Group'
    GET /silverstripe-HCA/new-resourcepage/

    Line 576 in C:\wamp\www\silverstripe-HCA\sapphire\core\Object.php
    Source

    567             case isset($config['function']) :
    568                return $config['function']($this, $arguments);
    569             
    570             default :
    571                throw new Exception (
    572                   "Object->__call(): extra method $method is invalid on $this->class:" . var_export($config, true)
    573                );
    574          }
    575       } else {
    576          throw new Exception("Object->__call(): the method '$method' does not exist on '$this->class'");
    577       }
    578    }
    579    
    580    // -----------------------------------------------------------------------------------------------------------------
    581    
    582    /**

    Trace

    * Object->__call(Resources,Array)
    * Group->Resources(ResourcePageID = 19 AND Global = 0)
    Line 45 of ResourcePage.php
    * ResourcePage_Controller->Resources()
    * call_user_func_array(Array,Array)
    Line 318 of ViewableData.php
    * ViewableData->obj(Resources)
    Line 18 of .cacheC..wamp.www.silverstripe-HCA.themes.blackcandy.templates.Layout.ResourcePage.ss
    * include(C:\Windows\Temp\silverstripe-cacheC--wamp-www-silverstripe-HCA\.cacheC..wamp.www.silverstripe-HCA.themes.blackcandy.templates.Layout.ResourcePage.ss)
    Line 357 of SSViewer.php
    * SSViewer->process(ResourcePage_Controller)
    Line 349 of SSViewer.php
    * SSViewer->process(ResourcePage_Controller)
    Line 172 of Controller.php
    * Controller->handleAction(HTTPRequest)
    Line 129 of RequestHandler.php
    * RequestHandler->handleRequest(HTTPRequest)
    Line 119 of Controller.php
    * Controller->handleRequest(HTTPRequest)
    Line 29 of ModelAsController.php
    * ModelAsController->handleRequest(HTTPRequest)
    Line 277 of Director.php
    * Director::handleRequest(HTTPRequest,Session)
    Line 121 of Director.php
    * Director::direct(/new-resourcepage/)
    Line 118 of main.php

    *tearing out hair*

  • UncleCheese
    Avatar
    4085 Posts

    Re: DataObjectManager Code Examples Link to this post

    As I said before, if Resources is a component of your Group object, make sure you're decorating it.

    20480 Views
Page: 1 2 3 4 5 6 7 8 9 10 11
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.