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:
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:
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)































Kim Dezen is a Senior RedDot CMS (Open Text Web Solutions) CMS Consultant, Developer and Freelancer. Part time DJ and obsessed music / vinyl junkie. This site is my personal blog for all things related to Red Dot, SEO/SEM and Web Development.
3 comments
Vitaliy Rabotnik says:
Apr 27, 2011
For some applications I separate presentation from functionality.
The easiest method is to use server side includes.
Method 2
CMS can publish the presentation of the page. Basically, it is publishing of a template that later will be consumed by application.
For example, I need a CMS page where some parts of the page will be managed by external application. Instead of real CMS placeholders I use my custom placeholders: #PAGE_TITLE#, #LEFT_MENU#, #BREADCRUMB#, #LANGUAGE_TOGGLE#.
When page is published – the external application would read it in as a stream and replace the placeholders with values that come from the application and then the merged UI and values are displayed as a single page.
Of course, the “template” page could be published as XML or Java Template, etc. and could be processed other ways: eg. it could be published as XSL and just merged with XML that comes from external app.
Let me know whether you need code sample.
Kim Dezen says:
May 18, 2011
Hey Vitaliy
Would be interested at checking out a code sample if you can email it through..
Cheers,
Kim
Elena Krsteva says:
Feb 17, 2012
Hi Kim, Vitaliy:
I and my colleague are now exploring different options of how to integrate an existing, stand-alone, self-contained .Net application with our Corporate RedDot CMS. We are looking for a solution that will require as less as possible changes into the application itself. Vitaliy’s idea sounds interesting. Would you mind sending me the code sample you mentioned above?
Thanking you in advance,
Elena