Monthly Archives: April 2010

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

Hide file extensions in URLs with .htaccess files

I was working on a (rather neglected, outdated) site I had previously done and decided it needed some (rather, a lot of) improvements. I was looking for a way to get rid of to clean up the URLs without having to remap my files. .htaccess to the rescue!

.htaccess files are a wonderful thing, and incredibly powerful, ignoring the bad experience I had with them on my current web host (fortunately, this project is hosted by another web host, and everything runs perfectly with them :)), and Apache’s mod_rewrite module does exactly what we need. Continue reading