With over 10 years installing and customizing industry-standard Content Management Systems (CMS), DLC Web Consulting is excited about the opportunity to create your new web presence.

Contact Derrek Lemar Croney today for a quote, and get started down the path of creating a vibrant, functional web presence for your organization.

Using jQuery Within Your Joomla Framework - Part 1

Recently, I created a Joomla 1.7 component for a valued customer, and I insisted on the presence of jQuery to facilitate event handling, and data validation. Having completed that, I wanted to share the steps I took to include jQuery on my page.

It is presumed that one has at least read how to create a Joomla component and/or module, and if not, please take a look at this link:

The trick in doing this is to make sure jQuery is included in the page, enabled, and not in conflict with MooTools (which comes with Joomla by default).

Editing the Layout Page

I chose to place the code in the layout file -- in this case, "default.php". I'm sure one could place it in the view.html.php file of the appropriate view, as well.

defined('_JEXEC') or die('Restricted access');

JHTML::_('stylesheet', 'mycomponent.css', JURI::base(true) . 'components/com_mycomponent/assets/', false);
JHTML::_('script', 'jquery.min.js', 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/', false);
JHTML::_('script', 'mycomponent.js', JURI::base(true) . 'components/com_mycomponent/assets/', false);

// other code removed

One person gives freely, yet gains even more; another withholds unduly, yet comes to poverty. A generous person will prosper; whoever refreshes others will be refreshed.
Proverbs 11:24-25 NIV