News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Till Klampaeckel's Blog:
Zend Framework CRUD
May 22, 2012 @ 10:07:20

In this new post to his blog Till Klampaeckel shares a Zend Framework "base" controller that makes it easier to do the usual CRUD (Create, Read, Update, Delete) operations in an application.

I think it took me (or us) a couple attempts to get this right - let me introduce you to Zf_Crud, a CRUD controller for the Zend Framework. [...] Zf_Crud aims to provide you with an interface for any table possible - think of it as a phpMyAdmin more tailored towards your data and (thanks to Twitter Bootstrap and the Easybib_Form_Decorator) prettier!

He shows how to install and use it (via PEAR or Composer) and an example of a controller extending it. You can find the code here on github, ready to clone and try out.

0 comments voice your opinion now!
zendframework crud controller base github zfcrud


Richard Miller's Blog:
Symfony2 Moving Away From the Base Controller
June 14, 2011 @ 13:23:15

Richard Miller has a new post to his blog today that recommends moving away from the base controller the Symfony introductory documentation has you make. He suggests an alternative that can be used more widely.

In fact, it is the advised best practice for controllers in shared bundles. When you do, you will no longer have access to these useful methods, in this post I am going to look at how to accomplish the same tasks without them. I have created a simple controller for some basic form interaction with a model which uses the base controllers methods. I am going to go through how to change this to a service which does not extend the base controller.

He starts with his "TestimonialController" that does some of the basic CRUD operations on the testimonial information. He shows you, step-by-step, the refactoring needed to stop using things like the default controller helpers (each with replacement code). With those removed, he can move to extend "ContainerAware" instead of "Controller", make the controller a service and doing some dependency injection for needed resources.

0 comments voice your opinion now!
base controller symfony refactor dependency


Gonzalo Ayuso's Blog:
PHP Template Engine Comparison. Part 2 (vs Plain PHP)
January 24, 2011 @ 11:11:07

Following in the heels of his first post looking at a few of the templating offerings available to PHP applications, Gonzalo Ayuso is back with part two - a comparison versus just "plain PHP".

In my last post I created a small (and very personal) test of different templating engines in PHP (Smarty, Haanga and Twiw). Someone posted a comment asking for the comparison between those template engines and old school phtml. OK I've done some tests. It's a bit difficult to create the template inheritance (without cloning one of the template engines and creating a new one) so I have one approximation with a simple include. It's not the same but it's similar.

He tries to recreate a similar scenario as in the three other templating tools by setting up a base template (with inline PHP), a class to populate the contents of it and a sample template with "inheritance". He stacks up the execution times and memory usage against the results from the other three with interesting results, specifically compared to Haanga.

2 comments voice your opinion now!
template engine compare benchmark plain base


Phil Sturgeon's Blog:
CodeIgniter Base Classes Keeping it DRY
February 11, 2010 @ 09:46:51

In a new post to his blog Phil Sturgeon looks at creating sharable code for your controllers in a CodeIgniter application (DRY: Don't Repeat Yourself).

The idea is that most of your controllers share something in common with each other. For example: All admin controllers need to make sure a logged in user is present and that they are an administrator. A public controller may want to load a theme for your application and load default user data, navigation links or anything else frontend related.

The problem is solved by creating a base controller - in his example its one called MY_Controller that follows the CodeIgniter naming convention and allows you to easily make other controllers that extend it. You'll also need to make a small addition to your config.php file to get the base controllers working correctly and make them able to be found.

0 comments voice your opinion now!
codeigniter base class controller dry


Ben Scholzen's Blog:
Writing powerful and easy config files with PHP-arrays
May 11, 2009 @ 12:05:45

Ben Scholzen has written up a post about how regular PHP arrays can be used as a native configuration option for your applications.

I was asked many times how I organize my config files, and my response was always the same, until some time ago when I switched began refactoring the codebase of my blog. [...] Looking at [the advantages of PHP config files], you may ask now why not everbody is using them. Well the problem mostly is that you cannot create extend-sections (when working with Zend_Config for example).

He compares an example of a method that, using a base config file with some "smarts", you can have it automatically pull in certain files and overwrite settings from the array inside. A sample "other config" file is also included, showing the definition of some PHP settings, resources and database information.

0 comments voice your opinion now!
configuration file array zendframework zendconfig smart base config


Jordi Boggiano's Blog:
Multiton base class
December 30, 2008 @ 11:17:49

In this recent post Jordi Boggiano looks at a different sort of design pattern - a sort of extension of the Singleton pattern: Multition.

While I like the Singleton pattern every now and then, I prefer the flexibility that the Multiton potentially offers, and well it's just an extended version of the Singleton, so it's "compatible" with the Singleton model. Anyway, to the point, PHP5.3 is coming, and with Late Static Binding you can do a base Multiton (or Singleton if you insist), which wasn't possible before. Now I like this very much because you can simply extend it rather than rewriting those (few, I know, but still) lines each time.

Included in the post is an example of the design pattern showing how to create its structure in the class and use it to grab the same or unique instances (defined with an ID).

2 comments voice your opinion now!
multiton base class singleton php5 latestaticbinding lsb


Jani Hartikainen's Blog:
Base classes in OOP programming languages
November 19, 2008 @ 16:10:58

Jani Hartikainen has followed up on a post from David Otten about standard classes in PHP and how they provide the base for much of what the language does.

David Otton posted a short but thought-provoking post about stdClass, which many think is the "base class" all PHP classes automatically inherit from. I have to admit that I had this misconception as well. [...] This [difference in PHP from other OOP languages] presents some room for analysis in how things are handled in dynamic and static languages, and how those differences affect things...

Jani talks about dynamic and static typing in languages and how that effects the base types things are extended from as well as some of the benefits that having a standard base class affords developers.

0 comments voice your opinion now!
base class programming language oop stdclass standard inherit


Richard Thomas' Blog:
Using jQuery with Solar
October 17, 2008 @ 09:31:10

In a quick new entry to his blog, Richard Thomas shows how to integrate the popular jQuery javascript library into your Solar application.

Going to go through a quick walk through of how to use a hacked together version of my old jquery library with solar. You can find the class source files here.

He sets up a callback in the Base controller (that all other controllers extend) for the jQuery calls so that any of the "child" controllers can just call "/controller/jquery" to make jQuery requests.

0 comments voice your opinion now!
solar framework jquery javascript tutorial base controller


Richard Thomas:
Solar Gets Firephp Support & a Base Controller Tip
October 15, 2008 @ 07:56:14

Richard Thomas has two new Solar framework posts added to his PHPJack blog - one talking about the new Firephp support integrated into the framework (similar to other frameworks) and a tip he's come across so far in using the framework.

In talking about the Firephp support:

There has been a flurry of work around Firebug recently including announcements that Zend Framework and Symfony both now have Firebug logging support through the use of the Firephp. As of this weekend Solar can be added to the list with its own support.

A quick example is included.

In the second post he looks at a simpler way to share information between all of your controllers without code duplication - adding it to the constructor of the Base controller your application is built on.

5 comments voice your opinion now!
base controller solar framework firephp support tutorial


Jeremy Johnstone's Blog:
Enums in PHP
October 06, 2008 @ 07:56:08

In this new post Jeremy Johnstone looks at creating a class to add that's missing from the basic datatype set of the language - enums.

I stumbled across a blog post on how to implement Enums in PHP via userland code written by Jonathan Hohle. I liked the concept he had, but the implementation was a bit unappealing because it used eval() among other more minor issues. You shouldn't need to generate Enums at runtime, so I took that as a challenge to find a way to do it at compile time, thus making the code much more efficient.

His enums would support type hinting and would, ideally, be iterable. He gives the code he's worked up - a base class, another than extends it to make a basic enum structure and some handy changes to support comparisons. A few more changes (and a few other extended classes later) he has some pretty well functioning enums that can even bee iterated through.

0 comments voice your opinion now!
enum tutorial base datatype userland class



Community Events





Don't see your event here?
Let us know!


opinion language library framework zendserver list release laravel podcast update interview package api series community deployment symfony install tips introduction

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework