17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1666 Views |
-
How to show a database table

27 March 2008 at 11:50am
Hello to everyone.
I created those classclass ProductorManager extends Page
{
static $db = array('Percentage'=>'float'
);
static $has_one = array('id_productor'=>'Member'
);public function Productors()
{
return DataObject::get("ProductorManager ");
}
}class ProductorManager _Controller extends Page_Controller
{
}and i've the table setted up, but i cannot retrieve datas from them. i thinks function Productors() is correct, but something don't work.
I want to show Percentage and the complete productor's name fetched by Member's tablesI dont know if i want clear about the explaination.
Thanks to everyone.VG
-
Re: How to show a database table

27 March 2008 at 1:26pm
you probably want to put that function in the Page_Controller, for starters.
what does your template code look like?
-
Re: How to show a database table

27 March 2008 at 10:45pm
Template page look like in this way temporarily
<div class="body">
<h1>$Title</h1>
<% include SideBar %>
<div style="clear:left"><% if Productor %>
<% control Productor %>
$FirstName .<br />
<% end_control %>
<% else %>
<div class="message">No productors found</div>
<% end_if %>
</div>
</div>First I put Productors() inside the Controller Class, but didn't work.
I want to show each productor's name and i don't know where i've made a mistake.thank you very much
-
Re: How to show a database table

28 March 2008 at 3:24am Last edited: 28 March 2008 4:07am
I solved that problem using a DataObject-derivated class.
class Produttori extends DataObject
{
static $db = array('Percentuale'=>'float');
static $has_one = array('Produttore'=>'Member');
}Thanks you
| 1666 Views | ||
|
Page:
1
|
Go to Top |


