3214 Posts in 848 Topics by 810 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1682 Views |
-
Displaying DataObject properties in a template

4 October 2009 at 12:41am Last edited: 4 October 2009 12:42am
Hello,
I implemented the search of dataobjects to my site. The search works, here is the search form´s action method:
function doSearch($data, $form) {
$StudioPostcodeQuery = $data['StudioPostcodeQuery'];
$id = $this->ID;
$StudioSearchResults = DataObject::get('FitnessStudio', "FitnessStudio.campaignID = '$id' AND FitnessStudio.postcode = '$StudioPostcodeQuery'");
$data = array(
'Results' => $StudioSearchResults,
'Title' => 'Surchergebnisse'
);
return $this->customise($data)->renderWith(array('StudioSearch_results', 'Page'));
}
The results template looks like this:<div class="typography">
$Title
<% if Results %>
<ul id="SearchResults">
<li>hrhrhr</li>
<li></li>
</ul>
<% else %>
<p>No results found.</p>
<% end_if %>
</div>
How can I call attributes of the dataobjects in the results template? -
Re: Displaying DataObject properties in a template

4 October 2009 at 1:04am
<% control StudioSearchResults %>
<li> $StudioPostcode</li>
<% end_control %>?
Neem een kijkje naar de Page_results.ss.. ehm
Take a look to the default Search method in the BlackCandy theme... -
Re: Displaying DataObject properties in a template

4 October 2009 at 1:14am
Thanks Martijn,
I simply forgot the <% control Results %>. Now I can access all dataobject properties. Thanks for your quick help.
| 1682 Views | ||
|
Page:
1
|
Go to Top |


