Category Archives: Articles

Improve Your Jquery using 25 tips

1.  Load the framework from Google Code
2.  Use a cheat sheet
3.  Combine all your scripts and minify them
4.  Use Firebug’s excellent console logging facilities
5.  Keep selection operations to a minimum by caching
6.  Keep DOM manipulation to a minimum
7.  Wrap everything in a single element when doing any kind of DOM insertion
8.  Use IDs instead of classes wherever possible
9.  Give your selectors a context
10.  Use chaining properly
11.  Learn to use animate properly
12.  Learn about event delegation
13.  Use classes to store state
14.  Even better, use jQuery’s internal data() method to store state
15.  Write your own selectors
16.  Streamline your HTML and modify it once the page has loaded
17.  Lazy load content for speed and SEO benefits
18.  Use jQuery’s utility functions
19.  Use noconflict to rename the jquery object when using other frameworks
20.  How to tell when images have loaded
21.  Always use the latest version
22.  How to check if an element exists
23.  Add a JS class to your HTML attribute
24.  Return ‘false’ to prevent default behaviour
25.  Shorthand for the ready event

Read Complete article

More

Adding Zend PHTML File extension in Dreamweaver

By default, Dreamweaver cannot read PHTML files. You can add the file type to the “Open in Code View” section of the preferences if you wish to have fast access, however you cannot view the file in design view if you do that. So if you use Dreamweaver (versions 4, MX, MX2004, 8, or 9, aka CS3,CS4) to design your sites, and you wish to open Magento’s Template files (they have .phtml extensions) in Dreamweaver, you can follow these steps to add support for .phtml and make Dreamweaver render PHP code (with coloring, hinting, et al) as well as allow you to see the design in code view if desired. Below are three steps to follow.*

Continue Reading Rest of the Article

Kurmo better replacement of var_dump() or print_r() for debuging

To put it simply, Krumo is a replacement for print_r() and var_dump(). By definition Krumo is a debugging tool (initially for PHP4/PHP5, now for PHP5 only), which displays structured information about any PHP variable.

A lot of developers use print_r() and var_dump() in the means of debugging tools. Although they were intended to present human readble information about a variable, we can all agree that in general they are not. Krumo is an alternative: it does the same job, but it presents the information beautified using CSS and DHTML.

Except the collapsible DHTML tree built around the structure of the dumped PHP variable, and the improved by the CSS looks, Krumo offers additional useful features.

require_once(“krumo/class.krumo.php”);

krumo(array(‘a1’=> ‘A1’, 3, ‘red’));

Output

… (Array, 3 elements)
| Called from /index.php, line 265

Read More information at http://krumo.sourceforge.net/

PHP Templating with Smarty

The theoretical web development process is that: first the designer makes the interface, and breaks it down into HTML pieces for the programmer then the programmer implements the PHP business logic into the HTML.

That’s fine in theory, but in practice, from my experience, the client frequently comes with more requirements, or maybe more modifications to the design or to the business logic. When this happens , the HTML is modified (or words rebuilt ) programmer changes the code inside HTML.

The problem with this scenario is that the programmer needs to be on stand-by until the designer completes the layout and the HTML files. Another problem is that if there is a major design change then the programmer will change the code to fit in the new page. And that’s why I recommand Smarty. Smarty is a templating engine for PHP.

Read Complete Article here