Popular just now

ad1

Showing posts with label Content Connection Kit. Show all posts
Showing posts with label Content Connection Kit. Show all posts

How to Use Zend Framework 2 Forms in Another Script (Factory)

Here's the same stand-alone form class for Zend Framework 2. I am posting this script as-is from the Content Connection Kit so you'll need to modify it to remove errors of omission. The demo url is http://fhqk.com/cck/?zftest/zfform_factory.

Be aware that I have found that ZF2's take-over of session handling means that any use of session_start() in the container script will cause ZF2 to fail with fatal error. This means that the use of session_start() for other frameworks or class libraries like PFBC running in the same scope will block ZF2 from loading. Because of things like this incompatibility with other systems like Drupal 7.x< 8.x and Symfony2 can be expected. You can work around the problem of ZF2 sessions by avoiding the use of captcha and other functionality that is dependant on sessions. But if anyone knows of a way to disable/override ZF2 session handling completely please speak up!

How to Use Zend Framework 2 Forms in Another Script

I have been going back and forth on Zend Framework 2. First it helps me by providing some really robust code. The flip side of the coin is ZF2 makes me crazy because it's always explained terribly by classically educated computer scientist. Given that me and much of the PHP community are autodidacts this is a turn-off.

I always can tell how useful a PHP framework is by trying to do what I learned first in PHP, building a HTML form. Not one post or tutorial I could find gave a straight forward answer a to how things worked. What was worse no one gave working code for using ZF2 as a library used by another simple PH script. Trying to get this done simply and without Zends MVC in place seemed to be unattainable. This meant that ZF2 was not something I would use at first thought. That has changed now that I have this code working. This is a complete stand-alone class use of the Zend framework and only needs to be called.

Berlinto is going live, Drupal killer?

For years I have been doing website development using Drupal and Wordpress. I adopted both of these systems when they made development easier and faster. They were also more complete than the CMS I was building and due to time restraints I opted for them.
But nowadays this is no longer the case. Systems like Drupal are a wall that has to be climbed with each project. Simple things are no longer simple and the amount of time learning has become greater than the time actually creating.
This is why I am creating Berlinto. Because I feel that things should be rolled back to simplicity. I think that web developers need to embrace PHP more and stop trying to "fix" it. Berlinto is not a "killer" or the next step in web frameworks. It's more of a reversion to plain PHP and then takes advantage of PHP advancements in a very simple way.
I first got the ideas used when I was creating the Movico module for Drupal. But although Movico makes a single module easier to develop there is still a problem. I find that on every Drupal project I am spending hours in the administration area doing tasks better left to , well, administrators. I am a web developer so should not complain right? But still, I like coding more than sitting for hours watching those ajax animations turn while I wait for the admin section to process a view or whatnot. Not only that but that ugly feeling I get when I know that I will have to modify something extensively using PHP in template file is happening more and more often. Businesses and others are using Drupal and Wordpress in ways that they just cannot accommodate. I always at some point during development wish that I was working with Drupal 5 or Wordpress 1.0. Ahh... it was so easy back then.
PHP has come a long way since the first popular PHP 4. I have used PHP since PHP 2.0/FI and seen the changes that make it one of the most popular scripting languages ever. The thing is not many if any frameworks take advantage of the simpicity and power that PHP 5.3+ brings. Not only that but some are in an upward spiral and are using monolithic frameworks in an effort to fix the problems of complexity. But what they are doing is making pool of understanding more shallow and decreasing the amount of developers that want to use the product. Worse the teaching of PHP as a language is being diluted by the teaching of API's.
This! is not a good thing.

Berlinto vs. Drupal

In most CMS's there are conventions and thinking that is proprietary to each. This is counter-productive and creates a steep learning curve. If the CMS core or API's change in any way the developer must re-learn and refactor their code with each version or update.
Typically in Drupal to call a function between modules you would use.
     if (module_exists("module_name")) {
        module_name_function_name();
      }
Compared to the PHP object oriented method that Berlinto uses. It is the very simple and common PHP coding convention.
    $variable = new Class();
    $variable->method();
We as developers need to get back to this use of PHP. Everything does not have to be an API. The performance of OOP is no longer a factor in the decision to write clean polymorphic code. Berlinto is meant to be mostly a guide for developers. Allowing them to get past some of the grunt work. They can setup an application or CMS without being enslaved to auto-magic methods, conventions and configurations that do not suit all.
Don't worry I will still be working with Drupal and the Movico module. Many things in Berlinto I will just port to Movico. This so if a decision is made to get away from Drupal the transition to something like Zend will be easier via Berlinto. UPDATE: Berlinto is now called "Content Connection Kit", CCK.