purple oar software

"Ensuring Your Web Presence Contributes"

drupal

Javascript code filter for Drupal

admin's picture

Here is an explanation of how I wrote a Drupal5.n module to filter javascript code so that it displays syntax highlighted. To illustrate what it does:-

/*
 * comment block
 *
 */


// single line comment


function
example(a,c) {
  return
a * c * 59;
}


document
.writeln("this is a text string");
document
.writeln('so is this, single quoted');

If the code is just a single line it will display without the background div:

var myDiscount = 0.25;

The filter system within Drupal is intended to make data entry into the CMS easy and safe. URL's can become clickable and malicious HTML (and rude words) can be stripped out. This js_filter module, based on the contributed codefilter module by John Wilkins, will syntax highlight Javascript code. There are already ways to do this within Drupal, the geshifilter module which uses the third-party GeSHi PHP library will syntax highlight many languages and there is also a jQuery plugin, jquery-chili-js which uses "recipes" for several languages.

js_filter has no software dependencies, it is purely PHP module code.

Drupal consulting

We are familiar with the Drupal CMS (Content Management System) and offer competitive Drupal developer consultancy. Drupal is an extremely flexible CMS, that we can quickly tailor to your requirements. We configure the site, enable and configure approriate modules and modify themeing to suit.

Because it is such a flexible system, it often seems complicated when first encountered. There is a learning curve for newcomers.

With our years of experience, we can efficiently deploy a Drupal site giving you a "state of the art" CMS. Additionally the Drupal open source project offers -

  • Continual improvement, new releases of Drupal incorporate the latest web features
  • An active user community helping solve problems
  • Hundreds of extra modules given back to the community, there is a good chance there is already a module to solve your specific need

We are active on the Drupal forums, assisting where we can.

Content Management Systems

Manage your own content.

We use and recommend the free open source Content Management System (CMS) called Drupal. It is written in the PHP programming lanuage and uses the MySQL database. Drupal is more than a CMS, it is a framework where specific functionality may be added by including "modules". We will develop modules for special features you may require.

Usually, we configure this CMS, design the theme, set up search engine optimisation factors, set up content and images to suit you, test, upload, and train you in the use of this system. We would also add Privacy Policy, Terms of Use and Disclaimer pages if required. We will explain how you should solicit links for best search engine ranking. This will provide you with these benefits:

  • A web standards compliant site.
  • Content and images directly under your control for ease of updating at any time.
  • Ability to amend your site from anywhere there is Internet access.
  • Visitors can locate content by "search" and/or by placing content into categories.
  • A "breadcrumb" trail so your visitors can see where they are.
  • Ability to easily create sub-domains for other aspects of your site. Sub-domains have their own content and presentation and appear to search engines and visitors as completely separate sites. This is a significant feature for future diversity.
  • Site optimised for agreed key words/phrases for improved search ranking.
  • Visitors can email you without publicly exposing your email address, leaving your website or assuming there is a suitable email client (e.g. Outlook) on the computer being used.
  • To prevent malicious automated posting to public parts of your site, visitors posting can be asked to recognise and enter a few characters displayed over an image (captcha). If the entry does not match the characters displayed, the posting is rejected.
  • To prevent unseemly words appearing on your site from public postings, a word filter can be provided to censor any words you specify.
  • An updated Google sitemap can be generated whenever Google requests it.
  • Your site may be multi-lingual for international marketing.
  • Additional features such as blog, newsletter, poll, survey and forum etc can be easily provided when they are required.
Syndicate content