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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

DataObjectManager Code Examples


Go to End


84 Posts   40578 Views

Avatar
MKO

Community Member, 2 Posts

31 January 2010 at 9:13am

I took out Superfish and hoverintent scripts from the page and it seems to work in IE8. However, Firefox/Chrome still downloads the .flv file.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

31 January 2010 at 12:05pm

Edited: 31/01/2010 12:06pm

You still have several errors. Make sure you're checking for Javascript errors before posting problems. It saves me time when troubleshooting the issue.

Your swfobject.js is not coming through in your source code. Is something blocking it? It should be included by line 249 of FLV.php:

		Requirements::javascript('dataobject_manager/code/flv/swfobject.js');

Avatar
vivilanco

Community Member, 19 Posts

2 February 2010 at 7:39am

i hate to sound like an absolute noob but i have been struggling with this for hours now. i have looked through all the documentation and forums, but i seem to be missing something.

i download the files (interested in the resources one). please the .ss files in the templates folder (just for clarification) where do i put the .php files? no matter what i do, the front end doesnt work (the back end is fine)

Avatar
UncleCheese

Forum Moderator, 4102 Posts

2 February 2010 at 8:12am

PHP should go in your code folder, and templates should go in you templates/Layout folder.

What does "doesn't work" mean?

Avatar
vivilanco

Community Member, 19 Posts

2 February 2010 at 9:48am

i am aware that i wasn't very helpful there. lol,

basically when i click on the menu item i get the following reply (no page but...):

[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 = 15 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 994 of ViewableData.php
    * ViewableData_Customised->obj(Resources)
      Line 18 of .cacheC..wamp.www.silverstripe-HCA.dataobject_manager.templates.ResourcePage.ss
    * include(C:\Windows\Temp\silverstripe-cacheC--wamp-www-silverstripe-HCA\.cacheC..wamp.www.silverstripe-HCA.dataobject_manager.templates.ResourcePage.ss)
      Line 357 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

Avatar
UncleCheese

Forum Moderator, 4102 Posts

2 February 2010 at 10:15am

Are groups supposed to have resources associated with them? If that's the case, make sure you're decorating your Group object.

Avatar
vivilanco

Community Member, 19 Posts

2 February 2010 at 10:19pm

ok here is what i have (step by step to avoid the cluts in me)

php -
C:\wamp\www\silverstripe-HCA\mysite\code
.ss -
C:\wamp\www\silverstripe-HCA\themes\blackcandy\templates\Layout

i currently have only 1 document uploaded for the test

Access (top level tab)
Who can view this page?
- Anyone
Who can edit this page?
- Inherit from parent page

default access (tab)
Resources in this category can be accessed by the following groups by default
- (tick) Administrators
- (tick) registered users

Resources (tab)
*document that is uploaded*
This resource is private, and can only be accessed by these groups
- (tick) Administrators
- (tick) registered users

from that (on the front end) i get

[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

thanks for bing patient and helping with this :D

Avatar
UncleCheese

Forum Moderator, 4102 Posts

3 February 2010 at 4:39am

Looks like you have an include in your template somewhere that doesn't exist.