Ektron CMS400.NET API Documentation
|
Creates the site map from folder breadcrumb.
public WebsiteMap GetWebsiteMap(Optional ByVal Long folderId, Optional ByVal Boolean getSameLevelNodes);
Public Function GetWebsiteMap(Optional ByVal folderId As Long = 0, Optional ByVal getSameLevelNodes As Boolean = False) As WebsiteMap
Parameters |
Description |
folderId |
Build the web sitemap from the folder specified. |
getSameLevelNodes |
Do you want to retrieve all nodes at the same level as the one you specify? True = include all sites at the same level as the folderId property. False = Do not include the same level nodes. |
The following example shows how to create a Web page that displays the site map for a given folder. This example uses some standard drag and drop controls and a small section of VB code utilizing the GetWebsiteMap method. This method uses the InternalAdmin to access and return the site map information. In the first section, we will deal with the standard drag and drop controls. In the second, we'll deal with the code behind.
1. Between the form tags, add the following label: <asp:Label ID="Label6" runat="server" Text="Folder ID:" Width="66px"></asp:Label> 2. Add text box where the folder ID can be entered. <asp:TextBox ID="txtFolderId" runat="server" Width="55px"></asp:TextBox> 3. From the Validation control menu, add a RequiredFieldValidator control. This validates that something appears in the Folder ID box. <asp:RequiredFieldValidator ID="rfvId" runat="server" ControlToValidate="txtFolderId" ErrorMessage="Please enter folder ID" Width="179px"></asp:RequiredFieldValidator> 4. Add two breaks for spacing purposes. <br /><br /> 5. Add a button to submit the folder ID and retrieve the site map information. We will set the button click event in the code behind. <asp:Button ID="btnGet" runat="server" Text="Get site map" Width="91px" /> 6. Add two more breaks for spacing purposes. <br /><br /> 7. Add a label to display the site map. <asp:Label ID="lblResult" runat="server" Width="502px" Height="100px"></asp:Label>
Add the following information to the code behind of your aspx.vb page.
Protected Sub btnGet_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGet.Click
If Not IsNumeric(txtFolderId.Text) Then lblResult.Text = "Invalid Folder ID" Exit Sub End If
Dim sitemapApi As New Ektron.Cms.API.SiteMap
Dim mapData As Ektron.Cms.Common.WebsiteMap
Try mapData = sitemapApi.GetWebsiteMap(CInt(txtFolderId.Text), False)
If (Not mapData.childrenNodes Is Nothing) Then lblResult.Text = sitemapApi.RenderWebsiteMap(mapData, "")
Else lblResult.Text = "No breadcrumb path found" End If
Catch ex As Exception lblResult.Text = ex.Message End Try End Sub
Copyright (c) 2008. All rights reserved.
|
What do you think about this topic? Send feedback!
|