If you’re a CakePHP user and have been frustrated by how this “bake” functionality doesn’t allow for more than one validation rule on a given field, check out the new post on the SaniSoft blog (from Amit Badkas):
This is not much of a problem if you have only a few models but when you start to work on several dozen models in a project it becomes very tedious to open each and every model file to make changes.
The result of his frustration has come out in the form of a patch as a part of a new ticket in the CakePHP request submission process.
Mikko Koppanen has a quick post today showing how to use PHP and Imagick to create an image of text filled with another image layer behind it:
The fill pattern is used to annotate text but the named pattern could also be used to fill any shapes that allow fill to be specified (include circles, ellipses, rectangles, polygons etc etc).
His example is pretty simple (with a “Hello World!” output) that pulls in the background image, creates the composite layer over it, adds the text to it and sets the fill to the background image’s layer. The whole this is wrapped up and output as a PNG file.
The Zend Developer Zone has posted a new tutorial (from Matthew Weier O’Phinney) about a handy feature of the Zend Framework’s view layer – view helpers that can be added in and reused across an application to do some pretty cool stuff.
A View Helper is simply a class that follows particular naming conventions, When attached to a view object, you can call the helper as if it were a method of the view object itself. The View object retains helper instances, which means that they retain states between calls.
View helpers can be use to do things like manipulate view data for more complex operations and carrying over data between two views, limiting the number of fetches that have to be done. He shows how to create a simple helper – My_Helper_FooBar – that just appends “fooBar ” to whatever’s passed in. He also talks about some of the default view helpers (like form fields), partials, the doctype() helper, capturing/caching content to be used later and the use of placeholders.
For the Oracle users out there looking for an easy way to pull those tags together and make a handy little cloud out of them, Maggie Nelson has posted about a simple Oracle function that can help – NTILE.
For example, check out the documentation for the NTILE Function. Yeah, sounds kind of boring. What good could it be in the wonderful world of web development? After all, who manages employee or sales tables anymore… Answer: generating tag clouds.
Her SQL statement categorizes the tags for you automatically, dropping them in to “buckets” of font sizes. This makes it simple to loop through them (like with a foreach) and output your tags with a little help from some CSS. You can even specify how many buckets you want it to fill (how many different tag values to get and compare).
Padraic Brady has posted part three in his look at making a blogging application with the Zend Framework. This time get gets down and gets into the code.
It’s almost obligatory when introducing a new programming topic, that the author present the simplest possible example. Usually this means getting a programming language or framework to print “Hello World” to the screen. I’m going to be no different. So much for originality…
He shows how to set up everything, down to the Apache VirtualHost directive and hosts file to get the web server and localhost working correctly. He includes the code for the boostrap file and how to create your first controller (along with its view, of course).
If you’re in the area of The Netherlands and you’re into PHP, consider yourself lucky – just look at all the events that Ivo Jansch mentions in one of his more recent blog entries:
PHP is still growing in The Netherlands (according to nexen.net, 46% of Dutch domains use PHP). A good indicator of PHP’s growth is the number of conferences and other events that are organized this year. [...] This year alone, there are already 6 major (>50) events; 3 done, 3 to go.
Some of the events (like Dutch Joomla Days and the PHP Business Seminar) have already passed but there’s still a chance to get in on a few others like Kings of Code and the Dutch PHP Conference.
The Developer Tutorials blog has posted the first seven parts of a series they’ve worked up to show bloggers out there running WordPress how to create a custom theme from scratch:
In this multi-part series I’ll detail how to create and design a WordPress theme from nothing more than your imagination using Photoshop, CSS, XHTML and PHP.
Here’s the list so far:
- Part 1 – getting the tools and an overall layout idea
- Part 2 – splitting it up to make the layout parts
- Part 3 – converting the Photoshop template to XHTML
- Part 4 – cleaning up the XHTML and doing some styling with CSS
- Part 6 – creating the WordPress-specific markup
- Part 7 – working up the PHP functionality
Hasin Hayder has written up a quick tutorial for his blog that shows how to create your own “Today in History” page with details from Scopesys pulled with a little web scraping.
There are thousands of services available on web who are presenting interesting as well as education information which you can really integrate in your web page or make a nice widget and let others use them seamlessly with their content delivery platforms. In this article I am going to show you how you can make a nice Today-in-History widget with the help of the data provided in Scopesys.
He wisely recommends that you check one thing first about the content you’re grabbing – the copyright it carries with it. This could get you into big trouble down the line depending on whose content it is. The actual script is pretty simple – he defines some constants as markers for where things start and stop in the HTML and then uses strpos to get the locations for his substr call to grab the segments.
The PHPEveryDay.com website has posted some more tutorials recently – here’s the list:
Check out the rest of the site for even more great tutorials and articles.