3212 Posts in 847 Topics by 809 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 666 Views |
-
How do I get arround: "you also cannot past a variable into a variable"

14 May 2010 at 8:23am
Hello,
I have a page TippToppMatchesPage with
static $has_many = array(
'Matches'=>'TippToppMatch',
);Each TippToppMatch (DataObject) has
static $has_many = array(
'Tipps' => 'TippToppTipp'
);TippToppTipp is also a DataObject
On TippToppMatchPage I want to show a list of all matches and the "tipp" (german for guessing/betting on a result) of the current user. Therefore, in the template I'd like to do something like this:
<% control Matches %>
<tr class="match">
<td class="matchDate">$Date</td>
<td class="tipp">Top.$TippOfCurrentUserForm($ID)</td>
<% end_control %>Unfortunately, this is not allowed since "you (...) cannot past a variable into a variable"
I have found several posts where others had a similar problem, but there never was a solution other than "you have to find a way around it".
Which way to proceed?
TippToppTipp and TippToppMatch are DataObjects, the only Controller available is TippToppMatchesPage but I don't see how TippToppMatchesPage should be able to "see" which TippForm I want to show without using a parameter.Any suggestion, tutorial or hint?
Thanks in advance,
Christian -
Re: How do I get arround: "you also cannot past a variable into a variable"

14 May 2010 at 10:31pm
Well instead of passing an ID to an object you need to have the TippOfCurrentUserForm function on your TippToppMatch object.
<% control Matches %>
<tr class="match">
<td class="matchDate">$Date</td>
<td class="tipp">$TippOfCurrentUserForm</td>
<% end_control %>Then have the TippOfCurrentUserForm function on the TippToppMatch.
-
Re: How do I get arround: "you also cannot past a variable into a variable"

14 May 2010 at 11:22pm
I want $TippOfCurrentUserForm to insert a form into the template.
As I understand, I have to put this function into a controller, or at least the form action has to be handled by a controller. Right?
How does TippToppMatch gets to know which controller to use?
| 666 Views | ||
|
Page:
1
|
Go to Top |


