Innovative Tech Consulting

Contact UsView Openings

Caching in Drupal6

The Basics
Caches are used to improve the performance of your Drupal site. Rather than extracting the same data over and over again every time a page is loaded, caching stores frequently accessed and relatively static data
in a convenient place and format.

Caching has a drawback in that it can lead to “stale” data. This means that the website outputs old data or content from the cache even though newer stuff exists somewhere else. This problem can be particularly troublesome for developers who can get confused as to why changes they expect to see happen arent. Hopefully, by reading this document, you’ll have a more pleasant and less confusing Drupal experience.

What gets cached, where it gets cached, and how There are two different ways Drupal stores cached data:

1) Using files
Drupal can consolidate all the css files your site delivers on each page load and place them into a fewer number of files. The resulting files are also compressed. This is important for Drupal sites where its not unusual to have a dozen or more stylesheets associated with each page, depending on how many modules are enabled. Having so many stylesheets will increase page load times because the browser has to make several round trips to the server to download all the stylesheet files. By using the css caching feature, you can consolidate these files into fewer larger files and decrease page load time significantly.

Just like style sheets, javascript files can also be consolidated. However, these files are not compressed.

How to turn on stylesheet and javascript file caching
======================================================

First, be sure you have your “Download method” is set to “Public” (set at admin/settings/file-system). You will not be able to use stylesheet and javascript caching when your “Download method” is set to “Private.”

Next, in the navigation menu, select “Administer -> Site Configuration -> Performance” (admin/settings/performance) and scroll down to the “Bandwidth optimizations” fieldset and check off “Enabled” for both CSS files and Javascript files.

Note that turning on stylesheet and javascript caching can interfere with theme development and should only be enabled in a production environment.

 

 

Registration form validation using jQuery

Registration form validation using jQuery

Step 1:

Place the javascript files within the head section

Sample Code
1
2
3
4
5
6
7
8
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery.validate.min.js"></script>
<script>
$(document).ready(function(){
$("#registerForm").validate();
});
</script>
</head>

You should set the name and id of your html form same as $(“#registerForm”).validate();

Step 2:

For each required form element just place class=”required” and specify minlength tag inside it. For example

Name field -> class=”required”
Email field -> class = “required email”

Sample Code
1
2
3
<input name="name" type="text" id="name" class="required">
<input name="user_id" type="text" id="user_id" minlength="4">
<input name="user_email" type="text" id="user_email" class="required email">

Thats it! you will be able to validate form field textboxes without any advanced code.
For optional fields, you can specify class=”optional” or just leave it.

 

WHY HTML5

WHY HTML5

 

HTML5 introduces many cutting-edge features that enable developers to create apps and websites with the functionality, speed, performance, and experience of desktop applications. But unlike desktop applications, apps built on the web platform can reach a much broader audience using a wider array of devices. HTML5 accelerates the pace of your innovation and enables you to seamlessly roll out your latest work to all your users simultaneously.

HTML5 gives you better way to write W3C Standard code. There are many browsers available in the market these days. If you want your site or blog to work same across all browsers, HTML5 is the best way to implement.

More over that, HTML5 is replacing Flash heavily for many reasons. In our next article, I will discuss more about that.

Please feel free to post a comment or questions, if you have any! I will get back to you with answers.