Use Ajax Redirect in ImpressCMS

ImpressCMS introduced a AJAX-based redirect system in series 1.2, which makes your site much quicker to work with. By using this redirect system, notifications and confirmation messages (E.g. ‘Thank you for logging in’) don’t show on a new page any more, but they are presented to the user on a text bubble that is loaded dynamically while the user remains on the same page.

Currently, not that many themes are created that provide this, and you need to explicitly enable it before the functionality becomes available. I’ll explain here the two simple steps you in adding this to your site.

ATTENTION: It has been noted to me that this technique is not needed, as ImpressCMS automatically includes the javascript code required into the <head> section of the page. All that remains to be done then is to enable the Ajax redirect in the settings (STEP 2)

STEP 1 : theme changes

in the theme folder, you should have one html file that is the master page. Sometimes this page is called theme.html or default.html. Normally it shouldn’t be index.html. Open that master page, and insert the following block of text just before the </head> tag :

<!– If You want to have messages and errors
in the admin menu, you should add this part to each admin them. –>
<{if $site_msg}>
<script type=”text/javascript” src=”<{$icms_url}>/libraries/jquery/jgrowl.js”>
</script>
<link rel=”stylesheet” media=”screen” href=”<{$icms_url}>/libraries/jquery/jgrowl.css” type=”text/css” />
<script type=”text/javascript”>
if (!window.console || !console.firebug) {
var names = [“log”, “debug”, “info”, “warn”, “error”, “assert”, “dir”,
“dirxml”, “group”, “groupEnd”, “time”, “timeEnd”, “count”, “trace”, “profile”, “profileEnd”];
window.console = {};
for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() {};
}
(function($){
$(document).ready(function(){
$.jGrowl(“<{$site_msg}>”, {  life:5000 , position: “center”, speed: “slow” });
});
})(jQuery);
</script>
<{/if}>

This should take care of the display of the text bubble.

STEP 2 : Site configuration

Now, in order to actually use the redirect, you need to make sure te site is configured correctly for that.

In ImpressCMS 1.2.x, in the administration section, go to the System -> Preferences -> Personalization section.

That’s it! You might need to clean the templates and the cache from your site, but you should now have the jGrowl-based Ajaxed redirect.

I’ve tried it with several themes from the ImpressCMS addons site or from xoops-theme.org, and it worked every time. Let me know in the comments if this was helpful, or if you have anything to add.

Leave a Reply