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.

Template Questions /

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

Display custom DataField in Templates inside DataObjectSets


Go to End
Reply


2 Posts   1358 Views

Avatar
Ironcheese

Community Member, 36 Posts

10 July 2010 at 11:42am

Hello,

i have several custom DataFields inside my Page. Inside the templates i can access the default fields by just naming them. Like "$Title" "$MenuTitle" etc.

this works inside Control Loops aswell.

What doesnt work is the same trick with my custom datafields. As soon my pages come inside a dataobjectset it seems the templates cant access my custom fields.

So if i try something like:

<% control Children %>
<a href="$Link" title="$MetaDescription">$myCustomTitle</a>
<% end_control %>

it does not work! As soon i access the page directly like:
<% control Page(mypage) %>
<a href="$Link" title="$MetaDescription">$myCustomTitle</a>
<% end_control %>
it works.... 

Probably its somethin trivial.... 

Avatar
Willr

Forum Moderator, 5521 Posts

10 July 2010 at 4:22pm

Is myCustomTitle a method on your controller class or on the model? If its on the controller you may not have access to it in a dataobjectset like children as it only stores the model object of the page. To fix this simply move the function from your controller to the model.