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.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

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

DataObjectManager Code Examples


Reply

84 Posts   21009 Views

Avatar
vivilanco

3 February 2010 at 4:57am Community Member, 19 Posts

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)

Avatar
UncleCheese

3 February 2010 at 5:07am 4085 Posts

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.

Avatar
vivilanco

3 February 2010 at 5:58am (Last edited: 3 February 2010 6:56am), Community Member, 19 Posts

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

thanks for all your help :D

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

Avatar
UncleCheese

3 February 2010 at 7:52am 4085 Posts

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.

Avatar
vivilanco

3 February 2010 at 7:59am Community Member, 19 Posts

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)

Avatar
UncleCheese

3 February 2010 at 8:10am 4085 Posts

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?

Avatar
vivilanco

3 February 2010 at 8:28am Community Member, 19 Posts

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*

Avatar
UncleCheese

3 February 2010 at 8:40am 4085 Posts

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