17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1630 Views |
-
fieldByName ......

5 August 2008 at 7:23am
Hi all.
Just trying to change label in "Root.Content.Main.Title"class DepartmentPage extends Page {
function getCMSFields() {
$fields = parent::getCMSFields();$gg = $fields->fieldByName("Root.Content.Main.Title"); // same error with filedByName("Title").
$gg->setTitle("My new Title");I get this error
Fatal error: Call to a member function setTitle() on a non-object in /public_html/silverstripe/tutorial/code/DepartmentPage.php on line 27Thanks in advanced.
-
Re: fieldByName ......

5 August 2008 at 7:27am Last edited: 5 August 2008 7:28am
got the answer.
use dataFieldByName("Title")instead fieldByName("Title").
That leads me to a question?
What does fieldByName() retrieve?.
Thanks.
-
Re: fieldByName ......

5 August 2008 at 7:31am
fieldByName() returns a field at the top level.
dataFieldByName() checks in tabs as well.
| 1630 Views | ||
|
Page:
1
|
Go to Top |

