0

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?

2
  • 3
    Have you published the template with the new field as well? Commented Jun 4, 2013 at 11:33
  • turns out I hadn't, though I was sure I had. thanks Commented Jun 4, 2013 at 12:46

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

4 Comments

Publishing the template was it. I was sure I had done this, but clearly I hadn't
I think mp3duck's markup was correct actually as it was for xslt rendering and not an ascx control.
Also - the Sitecore field rendering controls don't require an ID even in an ascx control unless they are going to be referenced in code. Of course its better to add one than not tho.
Richard, that's totally true :)
0

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 .

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.