O'Reilly logo

Umbraco User's Guide by Paul Sterling, Nik Wahlberg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

USING THE UMBRACO TAGS

Chapter 4 introduced you to the special tags that Umbraco utilizes for outputting content to templates. These tags are referenced in templates as .NET custom tags and take on the format you see in the following code:

<umbraco:item field=“” someOtherAttribute=“” runat=“server” …/>

If you have ever registered a user control (.ascx) in a .NET project, this code should look strikingly familiar to you. In its most basic form, the tag takes the field attribute and returns a value for the specified field name, assuming it exists in the context of the page that the template is rendering. For a summary of the various available attributes and what they do, see Table 9-1.

TABLE 9-1: Umbraco Tag Attributes

image

image

In many cases you can use a combination of the preceding attributes. For example, if you are trying to insert an HTML tag with attribute values (like a meta tag), you can accomplish this by using the insertBefore and insertAfter attributes simultaneously. See Listing 9-1 for an example. To see how you can access these attributes via the Umbraco backoffice UI, see Chapter 4.

LISTING 9-1: OutputMetaTag.master

image
<%@ Master Language=“C#” MasterPageFile=“∼/umbraco/masterpages/default.master” ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required