17488 Posts in 4473 Topics by 1978 members
| Go to End | ||
| Author | Topic: | 8747 Views |
-
Re: Get random object

2 September 2008 at 5:23pm Last edited: 2 September 2008 5:39pm
umm, nope. that would be my problem then. let me make the class and see what happens.
**
I created a new class/page called ProductsPage, and now I'm getting this error:
FATAL ERROR: Object::__call() Method 'forTemplate' not found in class 'ProductsPage'
At line 199 in /Applications/MAMP/htdocs/biomicro.com/sapphire/core/Object.phpmaybe I'm missing something on the class stuff. After some good sleep I'll try again tomorrow.
Thanks for all your help guys. -
Re: Get random object

2 September 2008 at 6:11pm
alright, I've been playing around with the get_one and get functions and when I use DataObject::get("ProductsPage", "", ""); it returns all the products, just like it should. then when I use DataObject::get_one('ProductsPage', null, false, 'RAND()'); I get the error that its looking for Object::__call() Method 'forTemplate' yet, Method 'forTemplate' not found in class 'ProductsPage',256. I'm starting to grasp this more and more, but maybe I'm missing the function or class to display the one result I want.
and then again maybe I'm just smoking something.
-
Re: Get random object

2 September 2008 at 6:18pm Last edited: 2 September 2008 6:22pm
forTemplate() usually means you're referencing an object in a template, but it doesn't know how to render it.
This could mean that you're doing something like $RandomObject - when it should be in specific calls to properties on that object such as $RandomObject.Title OR using <% control RandomObject %> to render variables in the scope of that object.
-
Re: Get random object

3 September 2008 at 2:33am
That was it. I put .Title behind it and it worked perfectly.
Thanks for all the help.
| 8747 Views | ||
| Go to Top |


