Working With Templates in Web Publisher Contributed by Paul O Mahony Developer Program
Overview... 3 Template Options... 3 Web Publisher Editor Templates... 3 Advanced Content Editor... 3 ewebeditpro + XML... 4 MSOffice Templates... 4 Free Form Templates... 5 Things To Consider... 5 User Community... 5 Output and Template Design... 5 Dynamic Versus Static... 6 Page Analysis... 6 Conclusion... 6
Overview Web Publisher templates allow end users to easily create web content, and offer the advantage of imposing consistent look and feel across your website by separating layout from content. In addition, templates offer the opportunity to enforce business rules such as security, or force certain templates to use specific workflow processes. Developers today are presented with a number of different options to create templates for their content in the current version of Web Publisher. This document outlines the use of templates in Web Publisher, highlighting the available options to developers and attempts to help developers navigate through the choices available to them by analyzing the different options each approach offers. It assumes familiarity with Web Publisher and the WCM suite of products. Template Options Web Publisher has a range of options for creating templates for your content which can go from very simple approaches to templates which offer users the ability to create complex dynamic content. Developers can create templates that are XML/XSL based and use the Web Publisher Editor. They can create templates that offer a more WYSIWIG approach using ewebeditpro + XML. Template developers also have the ability to create templates that use MS Word and can be automatically transformed into HTML and PDF renditions. Raw HTML external templates are also an option for developers who are familiar with HTML, and raw XML can also be used if desired. Web Publisher Editor Templates Web Publisher Editor templates are XML-based content templates which contain the main elements of your content. For example, a content file for a press release may contain elements such as headline, subtitle, graphic, main_paragraph and second_paragraph. Associated with the main content template are two files, a rules file and a presentation file. The rules file is also an XML file, which contains instructions as to how each of the elements should be represented in the Web Publisher Editor. The presentation file is an XSL file, which is used to transform the content the user inputs into the Editor into how it will look when it is rendered into a finished web page. The XSL files can have embedded XDQL in their style sheets which offer the chance to query the repository and reference content dynamically. Dynamic content of course is not limited to XDQL templates. These template types can output JSP and ASP formats in addition to standard formats such as HTML, and text. XML/XSL templates can also be very powerful for metadata extraction. If a template references an XML application in the repository, it gives users a single interface for entering content and metadata. Embedded advance content editors enable users to create and manipulate tables, and embed graphics inline with text. The Web Publisher Editor also has many different widgets integrated into the repository, such as the xselector, choice and the ability to create custom tags. Advanced Content Editor With the release of 5.2.5 SP3, the Web Publisher Editor offers a new, advanced content widget with enhanced formatting features. The use of this enhanced content widget is optional and Web Publisher has been configured so that the editing functions are backward compatible with the former content widget functions.
The UI is very intuitive and looks much like Microsoft Word. It enables the user to embed graphics inline, alongside text which can be formatted accordingly. Users can also insert tables and edit them by entire row, entire column or individually. User can also find and replace, undo, redo, insert pre-staged hyperlinks set up by an Administrator and nested lists. ewebeditpro + XML ewebeditpro + XML offers the ability to create XML/XSL templates without having to compose the XML by hand. From within Web Publisher, you can choose, File New Template Design. This will bring up a screen for you to enter details about the template and then brings you into ewebeditpro in design mode. In design mode, you can drag and drop controls into the template area. You can choose from such controls as plain text, checkbox, rich text, graphics, choice, select, calculated and calendar. Dragging them into the template area pops up a dialog box. This enables you to set values for the control, such as name, label and so forth. It also provides the ability to set validation on certain controls. For example, you can force users to enter in a date into a text field that must fall within a certain date range. It is also possible to set custom validation on various controls you include using JavaScript. Once you save your template, the XML and associated XSL is automatically generated for you in the background. Users who use this template to create content are presented with the ewebeditpro interface with the controls embedded as placed there by the developer. The interface is entirely WYSIWIG to the user. The default format outputted by the XSL file is HTML, but this can be changed to include JSP or ASP if desired. It is worthy to note that modifying the XSL can lead to slight problems with the Preview in the current instance where you will be prompted with a message in the lower toolbar that Preview is not available. Preview should still work however, and Webview is also another option should the Preview operation fail. ewebeditpro gives users a more streamlined approach to creating templates using the File-New- Template design option, and offers a very nice, slick WYSIWIG approach to both template designers and content contributors. It offers the ability to grab graphics from the repository or import from the local file system and embed them inline, and work with tables, in addition to adding controls with built-in validation. It can also create XML/XSL and enable metadata extraction if the XML file is associated with a valid XML application. MSOffice Templates Office templates enable users to create content as they normally would in Office documents and then submit them where they can be processed. The template is created by a developer and usually associated with an external HTML wrapper, though this is not always necessary. Developers can use all of the tools available to them in MS Office to create the templates. In general, the approach to Office templates is mostly associated with MS Word files, and leads to a more free form approach to content contribution. Once the template is built, the contributor can create new content from this template by selecting it from the New Content menu item. They will be presented with the template with any embedded graphics or text that the developer has included. Once this new content is saved and checked in, it is then sent for processing to Content Rendition Services. Here it will automatically be generated into HTML and PDF versions which can then be published to a Web site. Word offers more of an open approach to content creation. It s worth noting that the HTML created by Word may not represent clean HTML, yet this may not matter for instance if you simply wish to generate PDF formats from the Word content and publish it to your site. Word may be more suited to the creation of such content as press releases for instance, rather than the raw HTML tables that contain the structure of your site.
Free Form Templates It is entirely possible to create raw HTML or XML templates for users to create and edit with clients such as Dreamweaver, Frontpage, or XMetal for example. These templates would be used primarily for people who are well-versed in HTML or XML, though contributors could use the WYSIWIG interface offered by these clients to work with their content if they needed. These clients are not embedded within the interface, and users would have to return to the Web Publisher UI to perform actions such as WebView, and Submit. It would be possible to perform some of these actions using a type-based business object to apply a lifecycle on checkin from the client. As you can see there are a number of different approaches to creating templates in Web Publisher today. Neither of the above options are necessarily better than each other, and before you choose an approach, there are some things to think about. Things To Consider The most important things to consider when you are creating templates are: a) The user who will be using the template b) Your output User Community When considering what approaches to take, you should consider the users who will be using the templates to create content. If the templates aren t usable, they ll never be useful and probably won t be adopted easily. For instance, if you are rolling out Web Publisher Templates to a group of people in a department who work in MS Office most of the time, it seems it would make sense to roll out Word templates to them rather than rolling out raw XML or HTML templates. The latter would require a certain skill set which may not be apparent in the user community and, more importantly could cause issues with the formatting of the templates if users were able to access the underlying code or elements. A very important question is the role of the content contributors. The level of freedom to create within the content created from the template is proportional to the user s role. For instance, if they are in the author role, you would best be served going with the Web Publisher Editor or ewebeditpro templates, which don t allow these users to really change much of the underlying structure of the content. Developers and Administrators can make full use of more free-form templates and developer tools such as Dreamweaver, or even enabling HTML tags in the Web Publisher Editor Content Widget. Output and Template Design The user community using the templates to create content has a definite impact on what approach you wish to take, but it is not the only thing to have an impact on this choice. There are some other important considerations to make, and a number of questions to be asked before you can have a clearer picture of the best approach for your content templates.
Dynamic Versus Static Your page layout and output will help narrow down your choices. The biggest decision is whether or not the page is going to be dynamic or static. If the page is dynamic it leaves you with a few choices. You could use the Web Publisher Editor, to output ASP or JSP and run your queries on the app server side or embed XDQL in the XSL stylesheet, and have the queries run on the content before being pushed to the site as static HTML updated at regular intervals by a refresh job. Here, users who are not necessarily developers can create content that is dynamic. Developers of course would create the underlying XSL stylesheet. The other approach would be to use component pages, where raw ASP or JSP pages are built by developers and query for content components and include them in. These components can be fragments created by contributors using the Web Publisher Editor, ewebeditpro, Word Templates or even text editors. In this way, we separate content from layout, and give the authors control over only the pieces they need. It also present the opportunity for creating single components which can be used in many places on your web site. Page Analysis Converting your web site content to use templates system can often be done in tandem with a site redesign. Changing your site to take advantage of the opportunities presented to you by integrating a WCM tool and its templating capabilities can be a powerful thing. In this way, you should look at designing templates for your content, with the knowledge of the tools you have on hand. Take advantage of the ability to separate layout from content. If you have many hands working on a few pieces of content, think about breaking things out into components, and then applying different security to the components if applicable. The other advantage of componentizing your content is the ability to have component reuse. In this way, editing a single piece of content can update components across the entire site, rather than having to edit individual pages by hand. For instance, a common header and foot, or navigation across your site enables you to change the look and feel of the entire site simply by changing one or two files and publishing it. This can be extremely powerful. What leads you in the direction of what template editor to use then could be if you are to use components is how you pull them all together. Using XDQL, ASP, JSP or some other mechanism to build a page gives you a choice of what editors to use. Conclusion Each of these approaches has their own advantages and disadvantages. Hopefully this document has highlighted some of the main ones and given you some ideas as to the options available to you. More information can be found in the Web Publisher Administration Guide. The content on your web site is an ever changing, evolving landscape. A single one of the above ways to work with templates in all likelihood will not solve all of your business needs, and you may use a mixture of different approaches. Certain areas of your site may use content created from Word templates, or may use XDQL embedded in XML/XSL templates created by the Template Editor, or html fragments written in ewebeditpro or that come from text files. In the end, the tools you choose depend as much on your content and users as they do on the tools themselves.