DevShed has posted the fifth part of their series looking at CodeIgniter and its use to make a simple blogging application. The focus this time is on the output, working with the views to "pretty up" the resulting pages.
Although in its current state, the blogger works well, its visual presentation looks pretty primitive. Therefore, in this fifth part of the series I'll be adding some CSS styles to the view files that comprise this blog application to improve its look and feel.
They start with a review of the code so far - a simple blogging app with the ability to let users comment on each entry. The HTML and CSS you'll need to add to the views to make the output look more like this.
Johannes Schluter recently looked at one of the new features coming with PHP 5.3 - the goto functionality:
Over the last few days I already mentioned a few hidden gems from PHP 5.3. Now at Christmas I wanted to take a look at some new language feature of the upcoming PHP version: Added "jump label" operator (limited "goto"). (Dmitry, Sara)
No, its not the sort of "goto" you're thinking of - its a bit more limited than that. Johannes mentions that it only allows you to jump within the same execution unit and you can't jump into loops. Used incorrectly, it can be bad but he points out two useful instances - one being a code generator and the other an instance where you might need to drop out of code but not kill off the script in the process (sample code is included for this second one).
In this recent post to his blog Doug Brown spends a little time comparing (at a high-level) some of the differences between ASP and PHP.
The difference between PHP and ASP is that ASP is a Microsoft product based on visual basic syntax whereas PHP has C and Java based syntax. ASP works better on Microsoft servers.
He describes the target audience for each language and talks about the environments that they work best in as well as some general statements about their speed and flexibility. Basing his judgment on the facts he noted, he suggests PHP as the best alternative of the two for being more flexible, running in more places and being a bit faster overall.
Johan Mares has a recent post about using PHP on the command line:
I already knew how to run PHP scripts from the command line (CLI), although I never really used it. What was new to me was that there are 2 ways of doing this. The first one is by using the php command and the second, and new for me, is by adding a shebang on the first line of your script.
His first way is to run the PHP file through the interpreter directly (via a command line call to something like "php myfile.php"). The second it to actually include the path to the interpreter inside the PHP file itself and use the shell to execute the contents based on that (adding something like "#!/path/to/php" at the top). Then you just make the file executable and you can run it like any other binary file.
Dave Marshall is having a contest to give away a few copies of the "Job Hunter's Handbook" (by Michael Kimsal) - all you need to do is sign up:
I've got a couple of copies of Php|architect's PHP Job Hunter's Handbook to give away, the only catch is you have to sign up to PHPPositions' feed via email. It's managed by Feedburner, so it can be trusted and you wont get any spam, just super smashing great php jobs in the UK.
If you'd like to find out more about the book (or to order your own copy), head over to the book's page on the php|architect website. Normal price is $27 CAD for Print/PDF and just $23 CAD for the PDF.
Robert Basic has posted an example of the use of the Zend_Auth component of the Zend Framework inside of an example controller.
So, here's what I'm going to do: authenticate an user against a database table using Zend Framework's Zend_Auth component. It's really a piece of cake. You can see a working example here: http://robertbasic.com/dev/login/.
He sets up a registry instance, a database table for the logins and the sample controller with both login and logout functionality. Complete code (and links to Zend Framework documentation are included).
In this new post to his blog Jani Hartikainen looks at implementing the Data Access Object pattern in your PHP applications.
The advantage of this is that you can easily implement different methods to persist objects without having to rewrite parts of your code. I'm again going to use the programming language quiz game I wrote as an example. Since I initially wrote it to use Doctrine ORM directly, and both the old and new code are available, you can easily see how the code was improved.
He starts off with a look at the pattern itself (including a diagram of how an example would work with Doctrine) followed by the creation of the models for his Questions example. Add in the factory to create an instance and an exmaple of it in action and you're there.
According to this new post on his blog, Eli White has taken over the post of "community guy" at Zend (a post previously held by Cal Evans).
I've been offered a position at Zend, and accepted it. The official (lengthy) job title is Zend Community Manager/Leader & DevZone Editor-In-Chief. The short form to many people would be: "The job formerly held by Cal Evans" I'm extremely excited about this opportunity to work with Zend and to have the focus of my daily job to be working with the PHP community which I dearly love. I know that any attempt to fill Cal's shoes will be met with failure, so I hope instead to come up with my own twist on the position and to give it my best.
He'll be acting as the liason between the PHP company and the rest of the community including writing articles, doing some podcasting and all around getting in the middle of whatever's going on in the PHP community. Congrats Eli!
The eZ Components project has release their latest stable version - 2008.2 - for public consumption today:
The development team is happy to announce the release of the seventh
major version of eZ Components: version 2008.2. The main new development of this release is focused on the MvcTools (and
accompanying) components.
The MvcTools component implements the tools for a framework, providing a dispatcher, request parsers, routing, view support and a response writer. Examples of its use can be found in the subversion repository for the project. You can see the full Changlog for the release here and you can download the latest release here.