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.

Template Questions /

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

CMS Custom Field Data is Not Being Inserted Into My Rendered Template


Go to End


2 Posts   1742 Views

Avatar
siteLease

Community Member, 4 Posts

26 September 2016 at 6:03am

Having troubles with custom fields for some reason. Can anyone help? I have successfully created a custom page type "HomePage". I have set the page type in the CMS. I have successfully added the custom fields to tabs in the CMS and they work as they should (allowing data to be added, changed, removed, saved, etc). However, when I try to insert those custom fields into the template HomePage.ss the fields do not get inserted into the template
So for example, I have the following custom fields:
private static $db = array (
'QuoteRequestHeading'=>'Varchar',
'QuoteRequestIntroText'=>'HTMLText'
);

in my HomePage.php

When I try to insert $QuoteRequestHeading into the template, nothing is returned even though a query in the mysql table shows that there is data to pull in. The same thing happens with $QuoteRequestIntroText.

Any suggestions on what I might be doing wrong, or how I might diagnose my problem?

Avatar
siteLease

Community Member, 4 Posts

26 September 2016 at 4:04pm

If anyone else runs into this problem, they may slam their heads against the wall wondering what is going on. After all, the data does appear in the HomePage table. It turns out that after a lot of hunting around and testing, my son and I discovered that their is more than one table for HomePage. There is actually three tables. Those tables are to keep old versions of table data, and also to store the live (or published) data for that table. So, at this point, can anyone guess what I forgot to do, that made the data not appear on the live site?...

Someone queue the Jeopardy music.....

I had hit save on the forms, rather than save and publish, so the data had not been copied over to the "live" table.

Can you believe that...? Wow, I felt like a total idiot. Anyway, hopefully if someone makes the same mistake, they will search the forum, stumble across this post, do a face-palm and hit save and publish in the cms.

God bless one and all who read this message, may you have clear sailing from here. ;-)