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

Thomas Weinert:
FluentDOM 5 + XML Namespaces
August 07, 2014 @ 10:50:22

In this new post to his site Thomas Weinert shows how to use the FluentDOM library (a PHP implementation of a Javascript library by the same name) when XML namespaces are involved.

FluentDOM 5 allows to register namespaces on the DOM document class. These are not the namespaces of a loaded document, but a definition of namespaces for your programming logic.

He compares it to both a PHP example, using the DOMXpath handling and a Javascript sample using its own xmlDocument functionality. Finally he compares these examples to the few lines of FluentDOM code to handle the same kind of evaluation. He wraps up the post with a brief mention of the "appendElement" function that wraps serveral operations in one for easy element additions.

0 comments voice your opinion now!
fluentdom xml namespace tutorial javascript domxpath element

Link: http://www.a-basketful-of-papayas.net/2014/08/fluentdom-5-xml-namespaces.html

Master Zend Framework:
Howto Handle External Form Element Dependencies with FormElementManager
April 22, 2014 @ 11:58:07

The Master Zend Framework site has posted a tutorial wanting to help you understand external form element dependencies with help from FormElementManager.

Zend Framework 2, like all great PHP frameworks, provides thorough infrastructure for creating forms in your application. Whether that's form objects, form elements, fieldsets, validation groups or that they interact with so many other components in the Zend Framework 2 default libraries. But how do you handle external dependencies? [...] So what if you need a custom form element in your application, one which will render a list of articles from a database table? [...] In today's post, we're going to look at how to create such a custom element, extending the existing select element.

He walks you through the steps you'll need to make the custom element and hook it into the FormElementManager for correct use:

  • Create a New Form Element
  • Implement the getFormElementConfig Method
  • Create a New Form Object
  • Instantiate the Form Via the FormElementManager

Code is included for each step of the way so you can ensure you end up with a working example.

0 comments voice your opinion now!
external form manager element dependencies external tutorial

Link: http://www.masterzendframework.com/zend-form/handle-external-form-element-dependencies-with-formelementmanager

PHPMaster.com:
Setting Custom Error Messages for Zend_Form_Element
October 11, 2012 @ 08:58:37

On PHPMaster.com today there's a new post for all the Zend Framework (v1) users out there. In it, Aurelio De Rosa shows you how to set custom error messages for elements in a Zend_Form.

In this article I'll show the solution to a common problem which arises when a developer has to create a non-English website or application that is based on the Zend Framework. How do we mark a field of a Zend_Form which is a Zend_Form_Element as invalid, showing one or more custom error messages? The problem is mainly caused by the native counter-intuitive methods of the Zend_Form_Element class which I'll explain in more details.

He's included a basic example showing the creation of a form and the setup of a text element and some validators to match. He makes a controller and view to handle the output and submission then shows how to use "setErrors" (and "setErrorMessages") of the Zend_Form elements to setup that custom error. This only lets you set one message, though, regardless of the point of failure. To stop things when there's an error, you have to set the "breakChainOnFailure" parameter on the validator to false - then the message will make more sense.

0 comments voice your opinion now!
zendframework1 zendform custom error message element tutorial


TechPortal:
Custom Zend Framework Form Elements
August 01, 2012 @ 08:28:00

In this new post to the TechPortal, Gavin Corbett introduces you to Zend_Form elements (a part of the Zend Framework, v1) and how to create a custom one.

Creating forms in Zend Framework (ZF) is easy, but creating and managing complex forms can get messy! Using config files is perfectly good if you use standard Zend Form elements; it is quick and easy to setup a form in a few minutes however you will have limited control over how the form is rendered. If you want to display your own custom form element correctly in Zend Framework then some configuration is needed in order to achieve this with a config file.

He includes an example of first creating a basic form with a header and a single field element and validating the results of the submission. Building on that, he shows you how to create a custom "EmailAddress" form element and how to add in a view helper to style the output a bit.

0 comments voice your opinion now!
zendframework zendform element custom tutorial


Lorna Mitchell's Blog:
Fetching Namespaced XML Elements With SimpleXML
November 04, 2010 @ 10:48:14

Lorna Mitchell has a new post to her blog with a quick example of how to get namespaced values with SimpleXML out of a properly formatted XML file.

Recently I was working with some google APIs and needed to retrieve some namespaced elements from the result set. This confused me more than I expected it to so here's my code for the next time I need it (and if you use it too, then great!) I was reading from their analytics data feed API, this returns a few key fields and then multiple tags, each with namespaced children.

The trick is to grab the current document's namespaces (via getNamespaces), finding the key for the ones you want and grabbing them as children.

0 comments voice your opinion now!
simplexml namespace element xml tutorial


Sameer Borate's Blog:
Adding HTML5 'Canvas' element to Wordpress
April 08, 2010 @ 11:22:14

WordPress users that have been interested to explore some of what HTML5 has to offer should check out the latest post from Sameer Borate. He shows how to embed a HTML5 Canvas element you can use to make a "drawable" area of your page. You can test to see if your browser supports it by scrolling to the end of the post.

Only if partially, but HTML 5 is slowly getting increased support from various browsers. Some of the HTML 5 features like '˜canvas' and '˜video' are supported by browsers like Firefox, Safari, Google Chrome and Opera. [...] The Canvas element consists of a drawable region defined in HTML on which you can dynamically draw graphics and animations using Javascript. The canvas API provides a nice set of drawing functions to play with.

His example detects to see if the browser has canvas support (using Modernizr), creates a div container to hold the region and creates a Javascript to define the canvas as a 520 by 220 pixel box. The animation should be loaded automatically.

0 comments voice your opinion now!
wordpress canvas html5 element tutorial


ZendCasts.com:
Writing Composite Zend_Form Elements
March 15, 2010 @ 11:33:48

A recent tutorial (screencast) has been posted to the ZendCasts.com site looking at creating custom Zend_Form elements when you need something more than just the usual, simple elements.

This video should help you build your own composite Zend_Form element. We'll be building a phone element. The phone element will have 3 textboxes, one for geographic location, area code and local code. In the following videos will add a custom cell phone validator and some ajax validation.

You can grab a copy of the source if you'd like to follow along or you can just look around the repository to find the source for this and other great lessons from the site.

0 comments voice your opinion now!
composite zendform element screencast tutorial zendframework


Matthew Weier O'Phinney's Blog:
Creating composite elements
April 14, 2009 @ 10:25:53

Based on an example in a previous blog post (seen here) Matthew Weier O'Phinney wanted to clear a few things up on the "date of birth" element he had mocked up in his Zend_Form example.

In my last post on decorators, I had an example that showed rendering a "date of birth" element [...]. This has prompted some questions about how this element might be represented as a Zend_Form_Element, as well as how a decorator might be written to encapsulate this logic. Fortunately, I'd already planned to tackle those very subjects for this post!

To be able to use the element in its current state the key lies in the setValue method. More correctly in the overriding of the setValue method. He includes an example class that is smart enough to use that custom form element. It has get and set methods for each of the date fields (month/day/year) and the set/getValue methods that can interact using them. He wraps this all up inside a form decorator and creates an instance of the Date element to help create and handle the properties it has.

0 comments voice your opinion now!
create composite element date zendform decorator custom


Jani Hartikainen's Blog:
Complex custom elements in Zend_Form
October 23, 2008 @ 12:09:55

In this new post Jani Hartikainen shows a quick and easy method for creating a custom form element in your Zend Framework application. His example is a custom time element.

The alternatives would be creating custom view helpers to output the custom form elements, and using the viewscript decorator. Creating a custom view helper would also require a custom form element class, and it would be a bit tricky. [...] I think the viewscript approach is the most flexible and simplest to implement, so I chose to go with that.

His example defines a time field made up of three drop down lists, one each for hours, minutes and seconds. Included is the code to make the element (including a regular expression for validation) and the view script to display it.

0 comments voice your opinion now!
zendform zendframework complex custom element time tutorial


Neil Garb's Blog:
Compound elements with Zend_Form
July 17, 2008 @ 11:13:03

In a recent entry to his blog, Neil Garb shows his method for creating compound elements in a Zend_Form object in your Zend Framework website.

Zend_Form can save you a lot of time. It almost completely abstracts away the most boring and error-prone aspects of developing secure and standards-compliant HTML forms. But one thing it doesn't do out of the box is compound elements, such as three-field dates. In this post I'll show you the easiest way to do this ZF-style.

He goes through the creation of the sample controller, an example of a custom element (the multiple date drop-downs he mentioned) and how to handle the validation in a "Zend Framework way" via an isValid call.

0 comments voice your opinion now!
compount element zendform zendframework



Community Events





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


laravel tips zendserver language community conference introduction development list application developer threedevsandamaybe release series framework deployment interview podcast code api

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