Recently I’ve had a number of developers contact me asking for advice on how to integrate server side code (particularly .NET and ASP) within their RedDot projects. Since RedDot CMS only publishes out static content as separate files it can be bewildering for new users on how best to integrate dynamic functionality into a project – whether it be a forms, site search or even social media.

Of course there’s always Delivery Server that provides these features that aren’t available within the CMS, however adopting this technology usually incurs a learning curve (particular around the use of the propriety ‘Dynament’ code). Most developers/agencies would rather utilise a technology that they are already proficient with or one where they can tap into large pool of readily available developers and or resources.

The key point I would like to stress here is that you should (by any means necessary) keep all server side code outside of your CMS project – i.e. don’t embed code directly within your Content Classes!

There’s a school of thought that it’s better to keep all code and templates within one central location – the RedDot CMS project – by inserting code directly into templates and linking resources and libraries via media RedDot placeholders. The argument for doing so is that if the project needs to be relocated to another server, all that is required is deploy is a full site publish from the CMS.

I recommend not adopting this approach since relocating the site to another server happens infrequently (much less than actually having to deploy code changes) and developers end up spending more time having to integrate code changes back into the CMS on a regular basis. This ends up being a manual step – developers aren’t able to utilise deployment, software configuration management and version control best practises to minimise risk when deploying changes.

The best approach is to insert custom tags into your web pages in the position where you want to include dynamic functionality. The CMS is just used to publish out content as separate files to the web server where code has been deployed separately and can be included/referenced within the site pages.

There is a detailed step-by-step guide up on the RedDot CMS Blog site explaining how to embed .NET code with your project. If you are using C# or VB.NET – everything you need to know about embedding User Controls into your site templates has been covered.

Although my knowledge of Java is quite limited, I have had success using JSP templates to enable you separate out page layout and code in much the same way as .NET user controls.


<jsp:include page="templates/quick_search_form.jsp" flush="true">
<jsp:param name="docPath" value=""/>
<jsp:param name="styleClass" value=""/>
<jsp:param name="showExamples" value="false"/>
</jsp:include>

On the ASP and PHP front, I would suggest that using Function or Sub calls – where all code is stored within separate files and added within the page using includes.

To facilitate adding these tags or calls across site pages, I use a combination of basic template page parts (containing the tags that I need to include in the page) and containers positioned within various areas of a page – such as the header, main body and sub content areas:

foundation reddot cms template

I wrap all tags around a render tag to check if the page is currently being publish, as this is the only time we want them to appear within the page:

user control code reddot cms

Then its just a case of connecting up the individual page part ‘tags’ to the required positions (containers) within my site pages.

This way I can add the required tags to any page in my site (regardless of which foundation page template I use). Just remember to set the filename extension of each foundation content class to that of the server side language that is being used (e.g. .aspx, .php, .jsp, .asp etc)

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  • blogmarks
  • email
  • Faves
  • LinkedIn
  • Linkter
  • MySpace
  • NewsVine
  • Ping.fm
  • Posterous
  • Reddit
  • Slashdot
  • Socialogs
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Technorati
  • Tumblr
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz
  • Yigg