As our blogging module #SunBlogNuke# are applied in more DNN websites, some clients requires customization based on their specific requirements. The unique UI layout including theme will be a common issue. Toady we would like to share tokens reference of theme view with some samples so that you can get started to customization easily.

As our blogging module #SunBlogNuke# are applied in more DNN websites, some clients requires customization based on their specific requirements. The unique UI layout including theme will be a common issue. Toady we would like to share tokens reference of theme view with some samples so that you can get started to customization easily.

Useful built-in methods

  • CategoryLinks(string delimiter): to build separated category links with desired delimiter(such as commas.
    Code Sample:
    <%=CategoryLinks(", ")%>
  • CategoryLinks(string delimiter, string token): to build separated category links with desired delimiter(such as commas) and format token.
    Code Sample:
    <%=CategoryLinks(", ", "<a href=\"{0}\" title=\"View all posts in {1}\">{1}</a>")%>  
    the token has 2 formats to be applied: the {0} is category url and {1} is for category title.
  • TagLinks(string delimiter): like the method CategoryLinks(string delimiter)
    Code Sample:

    <%   
    String tags = TagLinks(", ");  
    if(!String.IsNullOrEmpty(tags)){%>  
        <div class="blog-icon post-tags"><%=LocalizeByKey("tags")%> <%=tags%></div>  
    <%  
    }  
    %>  
  • TagLinks(string delimiter, string token): like the method CategoryLinks(string delimiter, string token)

  • LocalizeByKey(string key): place a localized text with specific key, which requires to be defined in the resource file.
  • AvatarUrl(int size): to build the avatar url of post author.
    Code Sample:
    <img src="<%=AvatarUrl(36)%>" alt="<%=Entry.Author%>'s avatar" class="avatar" width="36" height="36" />
  • ThumbnailHandler(string format): to build thumbnail with 2 formats, "scale" or "crop".

Core Properties

  • <%=BlogSettings.xx_setting%>: to access any settings of current blog. ‘xx_setting’ is the option name.
  • <%=Entry.AdminLinks%>: to host edit link for a post so that the Authenticated users can click link to enter edit panel directly.
  • <%=Entry.Link%>: the permalink of current post.
  • <%=Entry.Description%>: the simple excerpt of current post.
  • <%=Entry.ViewCount%>: the views of current post.
  • <%=Entry.AuthorLink%>: the author url of current post. Clicking it will direct you to the posts list published by this author. Yes, you can customize it with replacing it with dnn core profile link.
  • Entry.AuthorProfile: the same object like dnn core profile so you can retrieve more other DNN profile properties.
    Code Sample:

    <% var objAuthor = Entry.AuthorProfile;
    
     var profileValue = objAuthor.GetProfileProperty("CustomProfileField");%>

And here are some useful links:

http://www.sunblognuke.com/blog/entryid/175/enhance-dnn-articl-footers-with-author-profiles.aspx
http://www.sunblognuke.com/support/forums/mulit-user-post-issues.aspx
http://www.sunblognuke.com/support/forums/other-profile-properties.aspx

  • <%=Entry.PostedTime%>: the published date of current post. If you would like to build your own format, you can try it like that:

    <% var dateTime = System.DateTime.Parse(Entry.PostedTime); %>
    
    <%=string.Format("{0:f}",dateTime)%>  
  • Entry.IsShowMoreLink: bool value to check whether show more link.
    Code Sample:

    <%if(Entry.IsShowMoreLink){%><p><a class="post-readmore" href="<%=Entry.Link%>"><%=LocalizeByKey("lnkMore")%></a></p><%}%>
  • <%=Entry.CommentCount%>: the comments count of current post.
  • <%=Entry.CommentLink%>: the url to direct to comments list of current post.
    Code Sample:

    <a href="<%=Entry.CommentLink%>" rel="nofollow">  
    <%   
        if (Entry.CommentCount <= 0)  
        {  
    %>  
    <%=LocalizeByKey("NoComments")%>  
    <%  
        }  
        else  
        {  
    %>  
    <%=Entry.CommentCount%> <%=LocalizeByKey("lnkComments")%>  
    <%  
        }  
    %>  
    </a>  
  • Entry.AlternativeThumbnail: alternative thumbnail of current post, if the field “thumbnail” is empty, it will retrieve the first image of post content as post thumbnail.

  • Entry.Thumbnail: the thumbnail of current post.
    Code Sample:

    <%  
     if (!string.IsNullOrEmpty(Entry.Thumbnail))  
     {  
       %>  
      <div class="catItemImageBlock">  
        <a href="<%=Entry.Link%>" title="">  
            <img src="<%=Entry.Thumbnail%>" alt="<%=Entry.Title%>" style="width: 302px; height: auto; "/>  
        </a>  
      </div>  
       <%  
     }  
    %>

Those usages above may be enhanced with some changes in the later package. If you have any question please feel free to contact us or raise your issue in our support forum. Thanks.

Note: more samples or tokens will be added later.

Related resources:

Develop an Customized Theme

Tokens Replace Reference

Extend DNN Blog With Custom Fields