Template Resources

Posted by Community Admin on 04-Aug-2018 03:46

Template Resources

All Replies

Posted by Community Admin on 03-Jul-2011 00:00

So using the backend template editor, has the syntax to include a resource changed?

This is what's defined in the template

<sf:FieldListView ID="Phone" runat="server"
    Text="<%$ Resources:EventsResources, ContactPhone %> 0" Properties="ContactPhone, ContactCell"
    WrapperTagName="li"  WrapperTagCssClass="cme-event-single-details-phone"
/>

But on the page, this is what gets rendered out
<%$ Resources:EventsResources, ContactPhone %> 905xxxxxxx, 905xxxxxxx

(instead of <strong>Phone</strong> 905xxxxxxx, 905xxxxxxx)

Posted by Community Admin on 06-Jul-2011 00:00

Hello Steve,

It's because of the 0 you have inserted, as it places the string text and messes up parsing the resources text, actually the default syntax is:

<sf:FieldListView ID="Phone" runat="server"
                Text="<%$ Resources:EventsResources, ContactPhone %>" Properties="ContactPhone, ContactCell"
                WrapperTagName="li"
            />
 By the way, since you mentioned you've used the backend template editor, don't you find using the built-in functionality for inserting fields int he template (located in the top right area on the template editor, where there's a list of the fields that can be included int he template) more convenient? This would always give you heads up of the default syntax which you can later try to modify as per your requirements. If you have any additional questions, please let us know, I'll be glad to help you further.

Kind regards,
Boyan Barnev
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 06-Jul-2011 00:00

Well in 99% of the backend editor cases I'm just modifying existing templates, not using the right-hand snippits to make something from scratch :)

So the whole 0 syntax was in the template already...

I'll try this, thx

Posted by Community Admin on 07-Jul-2011 00:00

Hey Boyan,
  Here's an example:

The News list templates defines the content like this

<sf:FieldListView ID="NewsContent" runat="server" Text="0" Properties="Content" WrapperTagName="div" WrapperTagCssClass="sfnewsContent" />

But if I delete that by accident, then re-add it via the right pane as you suggest, it gives me this

<sitefinity:HtmlField runat="server" DisplayMode="Read" Value='<%# Eval("Content")%>' />

?

Posted by Community Admin on 08-Jul-2011 00:00

Hi Steve,

Yes, that's true, however both will render the desired content. You can always refer to the default templates when creating/modifying a new one, as well if you prefer sticking to the default implementation. Have you tried the solution from my initial reply, as you correctly pointed out the 0 is automatically added by the control. Alternatively, you can get it with Eval like this:

<sitefinity:TextField runat="server" DisplayMode="Read" Value='<%# Eval("ContactPhone")%>' />


Best wishes,
Boyan Barnev
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 08-Jul-2011 00:00

Both do render the desired content...but they also don't ;)

Like the other issue I mentioned...all of these controls still render extra hidden markup to my pages

So this is what it wants me to use

<sitefinity:TextFieldrunat="server"DisplayMode="Read"Value='<%# Eval("ContactPhone")%>' />

...but this renders out signifigantly less markup (but is more of a pain to impliment and we don't get the extra properties like WrapperTag)
<asp:Label runat="server" Text='<%# Eval("ContactPhone")%>' Visible='<%# (Eval("ContactPhone") == null) ? "False" : "True" %>' />

I've been using JustDecompile to try and figureout which of these to use and when....becasue clearly the templates were made for a reason using whatever version.

This thread is closed