Skip to main content

Posts

Showing posts with the label CMS

Error pages in DD4T (404 and 500)

In DD4T the 404 page can be retrieved as below, Override the Action Page, and when the Page is null return the NotFound Action. In the NotFound action, Query the Broker for the 404  page and return the view. The 500 Error page can be throw from the Global level as below, when error occurred handle it the global level and return just view with error information

Handling images and on the fly re-sizing in DD4T

When it comes with DD4T we have plenty of control on the data and we can decided on how we wanted the page to be rendered. The traditional approach of having difference size of same image is replaced in DD4T to have one single image and generate the thumbnail on the fly. In this approach, we will have only one image published in tridion, and rest will be created on the fly based on the request. Just by adding below configuration on the web.config modules session will enable this feature <modules runAllManagedModulesForAllRequests="true">   <add name="BinaryModule"         type="DD4T.Web.Binaries.BinaryDistributionModule" />  </modules> The BinaryDistributionModule process the request as below Process the Binary Request Check if the file is already in the file system. If file is available compare the last published date of the binary against the broker. If the file is updated, update the existing file in the file system....

DD4T: Customizing RenderComponentPresentation

Sometime when we work with Component presentation, we might come up with the scenario to have customized RenderComponentPresentation, when we deal with Area/View or splitting view into more organized structure. We can fetch and send the area from the Template. Currently DD4T doesn’t allow injecting the ComponentPresentationRenderer, instead it allows us to write our own renderer and call it along with RenderComponentPresentation as below The custom ComponentPresenationRenderer can be created based on the scenario, so when we use the area, we could have the custom ComponentPresentation as below SDL Reference implementation, customized Renderer beautifully and implemented the Renderor to use Area view concept.

Navigation in DD4T

There always been a question on What is the best approach for building navigation with DD4T and ASP.NET MVC? Answer is: There is TridionSiteMapProvider as part of the DD4T.Mvc project, which can be used out of the box. The  DD4T.Examples.Templates project also have a example on how Sitemap can be generated from the template ( TBB ) Many organization will have different kinds of navigation structure, It can be from very simple structure or it can be a heavily complex in nature. In this article you can see how the default SitemapProvider can be used and how we could customize to achieve complex Navigations like Megamenu or similar using TridionSiteMapProvider. Setting up the default TridionSiteMapProvider The only configuration you would need to do in web.config is set the your default sitemap provider is as below. <system.web> <siteMap defaultProvider= "TridionSiteMapProvider" enabled= "true" > <providers> <clear/> ...

What is DD4T

Well, It's the high time to think about DD4T. What is DD4T? What makes more easier to the developer and Editor to talk about DD4T.!!  DD4T is a framework that developed by Tridion veterans. The framework makes it easier for Tridion developers to develop, deploy and maintain a project. The basic building blocks of Tridion  like, schema, components, template etc. are still remain the same as below. So what changes, if you look at the below diagram, you could see the different between both So, the whole logic goes to the web server, CMS just plays the role of generating the pages and delivering it to the Broker, no Template logic or HTML in CMS any more. DD4T solves the problem by making sure the pages and content are published to the broker as data, without any HTML rendering. If we summarize the diagram. 1) The role of editor and visitor are normal, and that is the main aspect of DD4T architecture. 2) Everything is published to the broker database. ...

knockoutjs with Umbraco and Umbraco base call

I was thinking how we could use knockoutjs with Umbraco, so just thought blog it. Knockout is a JavaScript library that helps you to create rich, responsive display and editor user interfaces with a clean underlying data model. Any time you have sections of UI that update dynamically (e.g., changing depending on the user’s actions or when an external data source changes), KO can help you implement it more simply and maintainably. Features Elegant dependency tracking Declarative bindings Flexible and sophisticated templating Trivially extensible More information reference: http://knockoutjs.com . Well, we start with Umbraco, To know more on umbraco, Please refer below links http://our.umbraco.org/wiki/how-tos/a-complete-newbie's-guide-to-umbraco http://umbraco.com/help-and-support/video-tutorials/getting-started?freeVideos=1 http://our.umbraco.org/wiki/how-tos/getting-started-with-umbraco-what-is-next-after-you-install http://our.umbraco.org/wiki/install-and-set...

Error: ko.mapping.updateFromJS, use ko.mapping.fromJS instead

I had the same issue, (Error: ko.mapping.updateFromJS, use ko.mapping.fromJS instead) I bugged for long time, then i tried the another alternative. fromJS  the functionality is the same, but be aware that updateFromJS's parameter list is just the other away around, so instead of doing:    ko.mapping.updateFromJS( viewModel, jsData); You need to replace this with:    ko.mapping.fromJS( jsData, {}, viewModel );

Localization in Umbraco, Item Page field localization

Umbraco is one of the most deployed Web Content Management Systems on the Microsoft stack. It's in the top five most popular server applications and among the ten most popular open source tools in general. You can directly download and start using it from http://www.umbraco.com If you have not used the application yet, its always worth trying it once. I am sure you will love it. Well, for the first time users, Umbraco provide step by step instruction for initial set up, once you are done you can use some sample template or create a blank website. To know more on umbraco, Please refer below links http://our.umbraco.org/wiki/how-tos/a-complete-newbie's-guide-to-umbraco http://umbraco.com/help-and-support/video-tutorials/getting-started?freeVideos=1 http://our.umbraco.org/wiki/how-tos/getting-started-with-umbraco-what-is-next-after-you-install http://our.umbraco.org/wiki/install-and-setup ,  I have created a blank website, Now we will go step by step. Fi...

Create Document Dynamically (Umbraco)

You can create document and publish the content during run time, Below code snippets helps you to do it. public class UmbracoUtils { /// <summary> /// Create and publish the document programatically /// </summary> /// <param name="nodeName"></param> /// <param name="properties"></param> /// <param name="documentType"></param> /// <param name="parentId"></param> /// <returns>node id</returns> public static int CreateDocument(string nodeName, Dictionary<string, string> properties, int documentType, int parentId, List<string> roles = null) { DocumentType dt = new DocumentType(documentType); umbraco.BusinessLogic.User u = new umbraco.BusinessLogic.User(0); // Create the document Document d = Document.MakeNew(nodeName, dt, u, parentId); // Add values...

Logger with UmbracoLog

Umbraco logger is powerful tool and It can be extended to use in your Umbraco application to log anything that you want to do, instead of using another logger to do the task. /// <summary> /// Logger to log Error/Debug/Warning to Umbraco log table /// </summary> public class Logger { public enum LogLevels { DEBUG = 1, WARNING = 2, ERROR = 3, NONE = 100 } public static LogLevels CurrentLevel { get; set; } private static string StrLoggedInUserId; public static void SetStrLoggedInUserId() { if (StrLoggedInUserId == null || StrLoggedInUserId == "NA") { if (HttpContext.Current != null) { HttpCookie cookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName]; if (cookie != null) ...