String Myurl Sitecore - Links.Linkmanager - Getitemurl (Thisitem)
String Myurl Sitecore - Links.Linkmanager - Getitemurl (Thisitem)
What is most efficient way to create a SEO friendly URL for an item in the Sitecore Content
Tree?
The correct answer was:
string myUrl = Sitecore.Links.LinkManager.GetItemUrl(thisItem);
Your answer was:
string myUrl = Sitecore.Links.LinkManager.GetDynamicUrl(thisItem);
GetDynamicUrl() does not return a friendly URL.
Which of the following is a conditional rendering rule that features both a condition and
action?
The correct answer was:
where the visit no is greater than 10 trigger the Revisits Web Site goal
Your answer was:
Add the ShowImage Rendering to the Content placeholder.
This is an action. No condition is defined.
A Product Description item has Layout Details for a Default Device. The Default Device
settings show a Site Layout and Product Description Sublayout. The Sublayout dynamically
binds to the content-main placeholder.
You create a conditional rendering rule named Hide Product Description. This rule hides a
specified presentation component when the visitor is a competitor. Where do you apply the
conditional rendering rule?
The correct answer was:
Product Description Sublayout
Your answer was:
content-main placeholder
Use the Control Properties dialog to apply the conditional rendering rule to the component.
When the current item has one or more Product child items, a conditional rendering rule
will add the Show Subitem List XSLT Rendering to the Top-Row placeholder (click view
picture) only.
A Rule Description reads: except where item is based on the Product Description template
Data Infrastructure 1
How are items and templates related to one another?
The correct answer was:
Templates define the field structure of items.
Your answer was:
Templates provide a set of default field values for newly created items.
Developers may assign a __Standard Values item to a data template, which provides default values, but the
template itself defines fields.
Data Infrastructure 2
The Product data template inherits from the Metadata data template.
The Product data template includes the following fields: Title, Description and Price.
The Metadata data template includes the following fields: Keywords and Description.
Which fields will appear in the Product data template's __Standard Values item?
The correct answer was:
Title, Description, Price, Keywords and Description.
Your answer was:
Title, Description and Price.
The Standard Values has the same fields as any other item based on the template. As a result, the Standard
Values will display fields from the template and any templates from which it inherits.
When defining a field of the type Rich Text using Template Builder, what does the source
field indicate?
The correct answer was:
HTML Editor Profile
Your answer was:
File path to the Editor XML file
For fields of the type Rich Text, the source field defines the HTML Editor Profile to use for editing the field.
Field Classes
How can you determine the field type for a Sitecore field?
The correct answer was:
The TypeKey property.
Your answer was:
GetType() method.
GetType() returns the object reference.
Choose the code snippet that best demonstrates how to retrieve the Description field, which
is of the field type Rich Text?
The correct answer was:
HtmlField htmlField = items.Fields["Description"];
string text= htmlField.InnerField.Value;
Your answer was:
RichTextField richTextField = items.Fields["Description"];
string text= richTextField.InnerField.Value;
There is no RichTextField class. Use the HtmlField Class.
You are coding a Sublayout to display these field values as a human readable string.
The News Article data template contains a field called Media Link which usually contains a
link to a media item in the Media Library.
Which is the best code snippet to display a thumbnail of the referenced media item?
The correct answer was:
Image img = new Image();
LinkField linkField = currentItem.Fields["Media Link"];
if (linkField.IsMediaLink){
string mediaItemPath = "/sitecore/media library/" + linkField.Url;
Item item = currentDB.GetItem(mediaItemPath);
MediaItem mediaItem = new MediaItem(item);
char prefix = '/';
string url = StringUtil.EnsurePrefix(prefix, MediaManager.GetThumbnailUrl(mediaItem));
img.ImageUrl = url;
}
Your answer was:
Image img = new Image();
LinkField linkField = currentItem.Fields["Media Link"];
if (linkField.IsMediaLink){
string mediaItemPath = "/sitecore/media library/" + linkField.Url;
Item item = currentDB.GetItem(mediaItemPath);
MediaItem mediaItem = new MediaItem(item);
string url = mediaItem.GetThumbnail();
img.ImageUrl = url;
}
GetThumbnail() is deprecated. Use the MediaManager's GetThumbnailUrl method. This code retrieves the
icon for the media item.
The Product Description data template contains a Related Services field of type Checklist
with its source set as a Sitecore Query expression.
What other field type could you use to improve the user experience of the content editors?
The correct answer was:
Multilist
Your answer was:
Treelist-Ex
Multilist as a field type supports Sitecore Query. Treelist-Ex does not support Sitecore Query directly, but
rather, a parameterized Source.
Item Collections
What type of collection does the GetChildren() function return?
The correct answer was:
ChildList
Your answer was:
Item Collection
GetChidlren returns a ChildList.
You would like to use the asp:Repeater control to display a formatted list of Sitecore items
on a Sublayout. Your design requirements call for every other row to be formatted with a
different style for easier reading.
Your web designer needs to be able to modify the markup file with the appropriate CSS
styles. Choose the best implementation strategy.
The correct answer was:
Create an ItemTemplate section inside the asp:Repeater, add controls to display field values and format them
appropriately for the first row background color. Add a AlternatingItemTemplate section, add controls and format them
appropriately for the alternating background color.
Your answer was:
Create an ItemTemplate section inside the asp:Repeater, add controls to display field values and format them
appropriately for the first row background color. Add a SeparatorTemplate section, add controls and format them
appropriately for the alternating background color.
Use ItemTemplate and AlternatingItemTemplate sections to vary the formatting for every other item. The
Separator section is used to provide formatting (typically a line break or horizontal rule) between items.
Using the Template sections allows you to dynamically change the formatting without having to write and
compile additional code.
Presentation Components
In ASP.NET terms, what does it mean to "statically bind" a control on a Sitecore Sublayout?
The correct answer was:
It means to use declarative syntax.
Your answer was:
It means to bind the control on the DataBound event.
Static binding simply means to use declarative syntax.
In Sitecore, a Layout typically includes common elements across all pages of a site, such as
the site header and footer. When creating a new Sitecore Layout in Visual Studio, what do
you create?
The correct answer was:
Web Form
Your answer was:
Master Page
A layout in Sitecore is an ASP.NET Web Form.
What is the purpose of a Sitecore Placeholder Web Control on a Layout?
The correct answer was:
Placeholders allow for the dynamic binding of controls. Because controls can be dynamically bound, this allows for
the possibility of control reuse. For example, a Sitecore solution might feature a few Layouts for an entire Web Site.
Your answer was:
Placeholders allow for the both the static and dynamic binding of controls. Because controls can be both dynamically
and statically bound, this allows for the possibility of control reuse. For example, a Sitecore solution might feature a
few Layouts for an entire Web Site.
Placeholders allow for component reuse. Presentation components are dynamically bound to a placeholder.
The Show Subitems Sublayout displays a list of all the children of the current requested
item. It is used throughout your site. For example, the control is bound to items of the type
Training Category in order to show a list of Course Descriptions.
For the News Section, you want the Show Subitems Sublayout to list the children of the
Home item and not News Articles items.
You create websites for higher education. A developer on your team has created individual
web forms for department pages, program pages, course pages, and faculty pages. All the
pages are identical, except for web user controls placed in the center of the web form. Since
this is a Sitecore solution, what do you recommend doing?
The correct answer was:
You recommend to define one web form as a Sitecore Layout and to define each web user control as a Sitecore
Sublayout.
Your answer was:
You recommend to define each web form as a Sitecore Layout and to define each web user control as a Sitecore
Sublayout.
Speed up development by reusing components. Since the design between web forms is the same, one web
form is required as a Sitecore Layout in this scenario. Web user controls as Sitecore Sublayouts can be
dynamically inserted with a Sitecore placeholder.
Requirements state that CSS and FilterByDataTemplate specific parameters are defined on
the Show List Sublayout. How can you best implement a solution?
The correct answer was:
Create a Rendering Parameters data template named Show List Rendering Parameters and inherit from Standard
Rendering Parameters template. Add to the template two fields: CSS of type Single-line text and
FilterByDataTemplate of type multilist with a source of /sitecore/templates/content templates/. For the Show List
Sublayout definition item, set the Parameters Template to Show List Rendering Parameters.
Your answer was:
Create the Show List Sublayout with a statically bound asp:GridView data control. Wherever the control is used,
define the Control Properties. In the Additional Parameters field, add CSS and specify a value. Add the
FitlerByDataTemplate and specify a value.
Create a Rendering Parameters template for the Sublayout rather than the Additional Parameters Name
Value List.
Besides using a placeholder settings, for a given presentation component, how can a
developer offer a Page Editor user other component options?
The correct answer was:
For the given presentation component item, define one or more compatible renderings.
Your answer was:
For the given presentation component, add the sc:replace Sitecore Web Control.
There is no sc:replace Sitecore Web Control. Compatible Renderings allow a Page Editor user to replace one
presentation component with another.
You need to define custom behavior for an Edit Frame Button. Where do you do this?
The correct answer was:
In the core database, under /Sitecore/content/Applications/WebEdit/Edit Frame Buttons.
Your answer was:
In the sc:EditFrame Web Control markup, for the fieldname attribute.
Find these settings in core database, not the master or web databases. You can change settings for an
individual EditFrame control at run-time in your code behind logic but custom button settings must first be
defined in the core database, so that you can reference them in your code.
On every page on your website, you want to display a promotion link in the Side Bar area of
the web page. A promotion item features a field named Promotion Link. This field is of the
field type General Link. This link is for internal items only. You want to display the value of
a Promotion Link field in the Promotion Sublayout. You also want business users to edit this
link with Page Editor.
What is the best Sitecore Web Control to display the Promotion Link field?
The correct answer was:
sc:Link
Your answer was:
sc:EditFrame
EditFrame just creates an edit frame control.
To display a Rich Text field value on a Sublayout without coding, which Sitecore Web
Control should you use?
The correct answer was:
FieldRenderer
Your answer was:
RichText
There is no RichText Sitecore Web Control. For statically bound controls on a Sublayout, use the Sitecore
FieldRenderer Web Control or the Sitecore Text Web Control.