7912 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » How to call action from dataobject
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
| Go to End | ||
| Author | Topic: | 1345 Views |
-
Re: How to call action from dataobject

20 November 2010 at 4:13am Last edited: 20 November 2010 4:29am
do i need to use those fields what i wanna show in that like picture and price. but anyways this code dont show in web also the categorie names aint visible in that page.
do i use it like this then:
<% control Categories %>
$CategoryName
<% control Bikes %>
<div class="pilt">
<table width="220" border="0" cellspacing="0" cellpadding="0" style="height:170; vertical-align:top; text-align:center;">
<tr>
<td height="19"><div style="text-align:center;"><strong><a href="$link" title="$Mootorrattanimi">$Mootorrattanimi</a><strong></div></td>
</tr>
<tr>
<td height="150" valign="top"><div style="text-align:center;"><a href="$link" title="$Mootorrattanimi">$Photo.Setheight(143)</a></div></td>
</tr>
</table>
</div>
<% end_control %>
<% end_control %> -
Re: How to call action from dataobject

20 November 2010 at 4:47am Last edited: 20 November 2010 4:49am
Something is wrong with the function because everything else shows up the fields and stuff. Only when the fields are inside categories controller they dont show up so something is wrong with the controller code with categories.
Also categorie names dont show up -
Re: How to call action from dataobject

20 November 2010 at 5:30am
Your Categories() function doesn't return anything!!
--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com -
Re: How to call action from dataobject

20 November 2010 at 5:35am Last edited: 20 November 2010 5:42am
its shows categories in backend but not in frontend
nothing , nada, ничего.
if <% control Bikes %> is before categories its shows the bike info but not category if its after categories its doesnt show anything. thats why i thing the function is broken.
-
Re: How to call action from dataobject

20 November 2010 at 5:57am
i use also the show in dataobject maybe there is some function needed also in dataobject.
-
Re: How to call action from dataobject

20 November 2010 at 7:16am
Like I said, your Categories() function doesn't return anything. That's the problem.
--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com -
Re: How to call action from dataobject

20 November 2010 at 7:20am
made it from your example.
Can u figure out what can be wrong
-
Re: How to call action from dataobject

20 November 2010 at 7:44am
This function:
public function Categories() {
$ret = new DataObjectSet();
foreach(singleton('Bike')->dbObject('BikeCategory')->enumValues() as $cat) {
$ret->push(new ArrayData(array(
'CategoryName' => $cat,
'Bikes' => DataObject::get("Bike","BikeCategory = '$cat'")
)));
}
}has no return..
you need to add:
return $ret;
| 1345 Views | ||
| Go to Top |

