Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

sitetree pages, sometimes loose meta-title and description fields


Go to End


5 Posts   1444 Views

Avatar
DsX

Community Member, 178 Posts

18 February 2011 at 12:15pm

I am noticing that sometimes in the cms that my pages will loose a couple fields from the Content/Metadata tab.
The fields that go missing are the title and description fields.
The last case of this (just happened) occurred after selecting another page in the left pane and duplicating it.
This is now the second time I have had this occur, the first I edited the title direct in the database..
I would rather not have to continue this way, so I am hoping that someone has come across this before??

Avatar
DsX

Community Member, 178 Posts

18 February 2011 at 12:17pm

OK, just tried adding a new page and still the fields are gone...
will have a look to see if I removed the fields in code somehow... can't imagine do that though.

Avatar
johnraz

Community Member, 2 Posts

9 March 2011 at 2:43am

Hi,

I have the same problem here. Im curious what have you found to solve this problem. Thanks!

john

Avatar
johnraz

Community Member, 2 Posts

9 March 2011 at 8:28pm

Hi,

I just managed to fix this problem. this happens when you have conflict in your field names. For example you have a field named "Description" under Root.Content.Metadata and another "Description" in Root.Content.Whatever.

Hope this helps :)

Avatar
johnmblack

Community Member, 62 Posts

31 August 2011 at 6:09am

Also watch how you define custom Getters. If you create a custom getter method for a field, and follow the pattern suggested in the tutorials, you might end up with these issues because _the CMS also ends up calling them_ to load its values.

A better approach would be to create custom getters for display purposes by naming them differently, like:

function getDisplayTitle() {  return 'customPrefix ' . $this->getTitle(); }  // or whatever

Then in the templates, you are always using $DisplayTitle and never $Title. This ensures that your pages will always use the custom logic, but the CMS will always load the original, actual value.