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

Display custom DataField in Templates inside DataObjectSets


Reply

2 Posts   1166 Views

Avatar
Ironcheese

10 July 2010 at 11:42am Community Member, 33 Posts

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

10 July 2010 at 4:22pm Forum Moderator, 5511 Posts

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.