سؤال

Sorry if this is a really simple question. I am sure I am missing something very basic. Anyway: I have just installed a new Sitecore 7 site, and I am just trying to add a new field to the "Sample Item" template. I have added a field called "title2", with a type "Single-Line Text".

I created a new page with this template under home, field in the fields including "title2" and published. Inside my "sample rendering.xslt" file, I added a section to display the new field,

<div>
    <sc:text field="title2"/>
  </div>

Yet when I view the page, it won't display the new field. If I change "title2" to "title", it displays.

What am I missing here?

هل كانت مفيدة؟

المحلول

From what I know the tag should be:

<sc:text ID="id" Field="FieldName" runat="server" />

What I'm missing in your code is the runat="server" tag and I don't see an ID. Further you should be aware that all items related to this field should be published. That is the Template and - if there is one or more - subtemplates and the item which contains the field itself. Also when you checked all of this you can try switching the database to WEB in the desktop environment to see wheter the information for your field has been published for sure.

نصائح أخرى

With Sitecore 7 you can use sc:FieldRenderer as well to retrieve the title of any template field . Here is the code snippet of the same .

<sc:FieldsRenderer runat="server" ID="scFieldRendereSample" Field="title2"/>

Hope this helps .

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top