Wednesday, September 2, 2009

Symbols in Rich Text Editor

Question: How can I add en dashes and em dashes to text in the Rich Text Editor?

The escapes for en dash and em dash (– —) are not handled correctly by the RTE when the text is copied back to the field.

You get: – in your text or – if you look at the HTML.

Using the numeric values works correctly: – — but this is tedious.

You can enter these symbols easily by using the Symbols drop down list on the RTE Toolbar.

After doing a little bit of reading on the RTE in SDN, I found how easy it is to add additional symbols to the list. You just need to add your entries to the ToolsFile.xml file which the RTE uses for its settings.

Read more at:

Add your own symbols to ToolsFile.xml:

<symbol value="&#8212;" /> <!-- em dash -->
<symbol value="&#8211;" /> <!-- en dash -->
<symbol value="&#169;" /> <!-- (c) -->
<symbol value="&#174;" /> <!-- (r) -->
<symbol value="&#8482;" /> <!-- tm -->
<symbol value="&#36;" /> <!-- dollar -->
<symbol value="&#8364;" /> <!-- euro -->
<symbol value="&#163;" /> <!-- pound -->
<symbol value="&#165;" /> <!-- yen -->
<symbol value="&#167;" /> <!-- section symbol -->

A good reference for symbol characters:

Tuesday, August 25, 2009

Item Serialization and the Developer Tab

Question: “Are Sitecore items serializable?”

Yes, for example, items are serialized when they are added to packages.

Also, there are serialization options on the Developer Tab.

The resulting files can be found under %siteroot%/data/serialization.

A blogpost from Alex DeGroot explains what the various commands do and more about serialization.

The Developer Tab is not displayed by default. To display it, right-click in the blank area next to the Tabs and the Ribbon and select “Developer”. You will see the serialization commands.

Another useful set of commands are ID and Path in the Show group. These commands will give you the Sitecore GUID or Content Tree path for the currently selected item. When you select one of the commands a dialog box will appear that prompts you to copy the information to the Windows Clipboard.

Monday, August 24, 2009

Language in the URL, Resetting Fields, Text Length

Here are a few quick answers to some commonly asked questions:

Question: “Why will the language designation (such as “en”) sometimes be included in the URL and sometimes not? How can this be controlled so that never displays?”

Answer from John West: “When <languageEmbedding> is set to “asNeeded” (in the LinkManager section of Web.config), Sitecore includes the language in the URL if it cannot determine the context site from the incoming HTTP request, if that HTTP request does not include a cookie that specifies a language, or if the language of the linked item differs from the context language. You should, set the <languageEmbedding> attribute to “always” or “never” to get the behavior you require.”

Chapter 5 of the Content API Cookbook describes dynamic link management: 206/Content%20API%20Cookbook.aspx

Question: “How can it be configured that an empty field is the same as NULL for resetting to Template Standard Values (TSV)?”

Answer from John West: “I think it could be the “reset blank” field in the data template field definition, or it may require custom logic such as an event handler.”

The “Reset Blank” field does the trick. If you delete the contents of a field in Content Editor, the blank field will be replaced with the default from Template Standard Values on the next Save.

Question: Is there a maximum length for a Single-Line Text field?

There doesn’t seem to be a set limit. I tested this by adding more than 15,000 characters to a single line text field and didn’t receive an error. (Formatting this would be a different problem, however.)

Thursday, August 20, 2009

Using ASP.NET AJAX Update Panel with Sitecore

A question came up during class last week about using the ASP.NET AJAX controls, particularly the UpdatePanel to improve the responsiveness of a Web page when doing the Poll Sublayout. This is a perfect example of when you would want a partial page update, rather than a full postback, when moving through a series of poll questions.

I did a little testing after class and found, as some of you did previously, that the UpdatePanel control did not seem to be working as expected in the Sitecore environment. I mentioned this to my esteemed colleague Seth Luersen and he knew immediately where to find the solution.

He directed me to this post on the SDN Forums:

Although this post is a couple of years old it does address the issue.

I checked for the correct <httphandlers> in web.config:


<add path="ScriptResource.axd" verb="GET">

type="System.Web.Handlers.ScriptResourceHandler" validate="false"/>

That seems to be in place by default in Sitecore 6. However, a later reply mentioned the IgnoreUrlPrefixes setting.

<setting name="IgnoreUrlPrefixes

Adding ScriptResource.axd to this setting seems to be the key enabling the expected AJAX partial page update behavior.

So, thanks again to Seth for pointing this out. Let me know if this works out for you. It’s great to see how easy it is to add AJAX functionality to Sitecore.