hello again,
I keep trying but I can not read data: (
I will try to explain better:)
I just want to read data from a table from any template.
this is the idea: within page.ss I have a reference to a header in Layout (cabecera.ss), called with <% include cabecera.ss%>
I wish could get in cabecera.ss data from a table to use as menus.
This table is created inside a DataObject called "barqTipoProyecto" and only has a column called "Tipo"
As seen in 5 of the web tutorial and in this post: http://www.silverstripe.org/data-model-questions/show/12601
In cabecera.php I added inside the controller:
tProyecto function () {
return DataObject:: get ("barqTipoProyecto");
}
in cabecera.ss:
<% Control tProyecto%>
$Tipo // this is the only column inside the table, the table name is "barqtipoproyecto"
<% End_control%>
barqTipoProyecto.php contains:
<? php
class barqTipoProyecto extends DataObject {
static $ db = array (
'Tipo' => 'Text',
);
static $ belongs_many_many = array (
'tipodelProyecto' => 'barqProyecto'
);
getCMSfields_forPopup function () {
$ fields = new Fieldset ();
$ fields-> push (new TextField ('Type'));
return $ fields;
}
}
please a help, I'm blocked , I'm starting in SilverStripe.
Thank you very much again.