AspDotNetStorefront v9 Skin Token Tips

With the release of version 9 of AspDotNetStorefront many developers are going to be running into tiny roadblocks as they get used to working with standard ASP.NET themes with some AspDotNetStorefront goodness sprinkled on top.

First, you can find a fresh list of v9 supported skin tokens at http://manual.aspdotnetstorefront.com/p-1064-skin-tokens.aspx.

The template.master that ships with v9 has some good examples of how skin tokens work, especially with passing in additional parameters.  Let’s go through a few examples:

Displaying images from your App_Themes/Skin_x/images/ folder

Notice the logo.gif placement.  This will display the logo.gif file found in App_Themes/Skin_x/images/logo.gif.

   1: <asp:Image ID="logo" runat="server" ImageUrl="<%$ Tokens:SKINIMAGE, logo.gif %>" />

And to display an image found at App_Themes/Skin_x/images/icons/icon_1.jpg:

   1: <asp:Image ID="Image2" runat="server" ImageUrl="<%$ Tokens:SKINIMAGE, icons/icon_1.jpg %>" />

Topic Related Tokens

There are actually three (3) tokens related to topics, so make sure you use the correct token for the correct use case.

If you want to render out a link to a topic, you are going to use the TopicLink:

   1: <a runat="server" href='<%$ Tokens:TopicLink, Returns %>'>Returns</a>

If you want to render out the contents of a topic, you would use the Topic token:

   1: <asp:Literal ID="ltrHelpBox" runat="server" Text='<%$ Tokens:Topic,helpbox %>' /></div>

If you want to display the title of a topic only, you would use the TopicTitle:

   1: <asp:Literal id="mytopictitle" runat="server" text="<%$ Tokens:TOPICTITLE, TheTopicId %>" />

Using Literal controls within normal html elements

Sometimes you want to use standard html and just have Token values output to them. The problem with Tokens (more how they are bound) is that they require an ASP.NET server control to bind properly.  To get around this, try something like the following:

   1: <a href='&lt;asp:Literal ID="Literal1" runat="server" Text="<%$ Tokens:SignInOut_Link %>" />'>

We’ll keep posting any goodies we find in this new version of AspDotNetStorefront.

This entry was posted in AspDotNetStorefront, eCommerce and tagged , , , . Bookmark the permalink.