If you ever want to see the variables being passed to Smarty just add `?SMARTY_DEBUG` to the end of your URL. This will create a popup with all the variables and their values, any templates that where included with load times, and any variables set in the config if you use one. The arrays are not pretty, but usable.
Find more info about the debug console and debug control.
Working with classes in PHP is not only great for keeping your framework clean, but handling an item with ease. The makeImage helper for Kaizen CMS makes use of this. It’s easy to make changes to the image after you create the class object as below. Below code re-sizes an image, then crops to fit within an image restraint.
1
2
3
4
5
6
7
8
// Pass the file path and option to cache the image to the class$oImage=new makeImage($sFile,true);// Tell the object to resize the image, no need to pass the image$oImage->resize(200,100);// Now crop the image after it was resized$oImage->crop(100,100,0,0);// Now send the image data to the user$oImage->draw(null,100);
Class handled all the dirty work of keeping up with the image, and knowing all the info about the image. Above code is easier to maintain then doing all the code straight in the file. Class used above is available here.
A CMS that James Fleeting and I have been working on for over a year has gone open source. The decision was made over new year’s eve dinner at Wild Wings. The reason for opening the code is to not only give other developers another MVC to code with, but to also help the CMS grow. (more…)