News Feed
Jobs Feed
Sections




News Archive
feed this:

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

Joshua Thijssen:
Dynamic form modification in Symfony2
March 20, 2014 @ 09:42:16

Joshua Thijssen has a new post to his site looking at a way to dynamically modify forms in a Symfony2-based application. Form handling can be a bit tricky (especially with more complex elements), and modifying them on the fly can be even more difficult.

Sometimes (or actually, a lot of the time), handling forms will go beyond the basics. And even though symfony2 gives you out-of-the-box a really clean way of creating forms, it sometimes just isn't enough. Fortunately, you are not alone in writing forms, and many posts exists with information on how to handle complex forms. In this post, I will try and demonstrate how to create a dynamic form where you can select a city based on the chosen province.

His example lets the user pick their province and then populates the other select with cities in that area. He includes the code for the form to create these two selects and how to pull out the list of provinces to populate the first. He goes through each part of the example code explaining the methods, what they're doing and how a pre-submit event can be used to populate the second list.

0 comments voice your opinion now!
dynamic form value modification symfony2 tutorial

Link: https://www.adayinthelifeof.nl/2014/03/19/dynamic-form-modification-in-symfony2

SitePoint PHP Blog:
Managing Gettext Translations on Shared Hosting
February 11, 2014 @ 13:09:19

On the SitePoint PHP blog today Aurelio De Rosa makes some recommendations about handing gettext translations on shared hosting. The problem with shared hosting is the need to reset the web server (Apache) to get it to read the updated translation files. His workarounds uses an external script that can dynamically pull in the latest translations without the restart.`

For serious translations we can use Gettext. This approach enables us to have different files for every targeted language which helps in maintaining separation between the business logic, the presentation layer, and the translations (which we can see as an add-on of the presentation layer). With Gettext, we can parallelize the process because while we're working on some features of the website, translators can still work on translations using software like gettext functionality to set the current language and extract a "HELLO_WORLD" string. He then moves on to the use of the Audero Shared Gettext library. This library creates a "mirror" of the translation file requested and forces those updates into the current domain. Code examples of its use are included showing a basic pull and merge process.

0 comments voice your opinion now!
gettext tranlsation dynamic loading webserver shared hosting tutorial

Link: http://www.sitepoint.com/managing-gettext-translations-shared-hosting

DZone.com:
Configuration is code
November 20, 2013 @ 10:54:12

In this recent post to DZone.com Giorgio Sironi talks about how, despite it commonly not being intended this way, configuration files usually end up being "code".

You start out with a simple .ini file [and] after a while, you customize its values by deployment environment. [You] then substitute values in it, to remove duplication or substitute constants, for that matter. Finally, you start supporting dynamic values, because this gives you more flexibility. The thesis of this article is that an efficient solution for supporting the more complex use cases of configuration can be found, without piling up proprietary or open source libraries to parse more and more complex configuration files. This solution, namely, is to use a more powerful language: your own dynamic programming language.

He looks at the "back in the day" configuration types that Java frameworks used - mostly XML files with a tight coupling to the servlet using it. He steps back a bit and looks at what he calls the "properties of code" and relates it to this dynamic language for configuration he's been talking about.

0 comments voice your opinion now!
configuration dynamic language properties

Link: http://css.dzone.com/articles/configuration-code

Gonzalo Ayuso:
Dynamic routes with AngularJS and Silex
July 10, 2013 @ 10:58:11

Gonzalo Ayuso has a new post today showing how to set up dynamic routing for a Silex-based application using an AngularJS frontend.

These days I'm playing with AngularJS. Today I want to experiment with dynamic routes. Let me show your an example. It's very simple but: What happens if our application is big and it grows fast? We need to add new lines and reload the browser. With AngularJS we can add paramenters to the routes.

He shows how to work with these route parameters and how to use the partial in a DynamicController. He also gives some sample PHP code showing how it all works together with Silex and a Twig provider. The Twig provider changes the tags that it looks for away from the curly braces to the square ones (Angular uses the same tags for its templates too so they'd get confused otherwise).

0 comments voice your opinion now!
silex angularjs dynamic routing tutorial

Link: http://gonzalo123.com/2013/07/08/dynamic-routes-with-angularjs-and-silex

PHPMaster.com:
Master Dynamic Content with WordPress Shortcodes
July 09, 2012 @ 11:47:13

On PHPMaster.com today there's a new tutorial for the WordPress users out there looking to work with dynamic content and shortcodes to make your site easier to use and to bring more content to user's attention.

The advantages to using shortcodes are obvious. First and foremost, it allows page designs to become far more unique. It also relieves the website administrator from having to create a large list of custom fields in order to perform basic content insertion. [...] And, finally, shortcodes allow a design to come alive and be truly dynamic and interesting to the end user. Too many WordPress blogs and magazine websites have adhered to the format of a big title, a standard block of text, and comments. That no longer has to be case.

They talk about using the "functions.php" file for the custom functionality, who to use them in your posts and how to use them in the theme-specific instances. Using the "add_shortcode" you can relate these custom functions to their codes for both simple and more advanced calls (code included).

0 comments voice your opinion now!
wordpress dynamic content shortcode


PHPMaster.com:
Generating Invoices with Zend_Pdf
October 10, 2011 @ 09:07:15

On PHPMaster.com today there's a new tutorial about using the Zend_Pdf component of the Zend Framework to generate invoices from the billing data in your application.

The PDF format is currently the most used format to exchange documents. If you provide your website users with printable versions of invoices, event tickets and other similar documents, you'll most likely want to generate them as PDFs on the fly. In this article you will see how you can use Zend_Pdf to auto-generate PDF invoices.

The concept is pretty simple - take the rows of invoice data from your system and inject them into a new PDF document. They show you how to create an invoice layout that includes that data, a header with your company name, invoice-related information and the total/amount due at the bottom. The full code is included to help you create the Zend_Pdf object, apply the text to it (based on location in the document) and working with the default font. You can download the full source from github.

0 comments voice your opinion now!
invoices zendpdf zendframework dynamic tutorial pdf


Court Ewing's Blog:
Create and Validate a Choice List in a Symfony 2 Form
August 17, 2011 @ 08:28:21

Court Ewing has written up a new post to his blog about creating a "choice" list (a select list as defined by Symfony 2) with dynamic options and validating the resulting submission. His example uses Doctrine 2 entities to work with most of the data handling.

A standard select list can be created using Symfony's choice field type; it is pretty clear how to create a new choice field with simple, non-dynamic options (e.g. gender), but it gets a little more complicated when you want to create and validate a dynamically generated choice list.

He includes the code for a simple entity, a Post model to fetch the category information and the set up of the form element - a select list of post types/categories. He also includes a bonus section showing how you can achieve the same thing without a model to bind to. The code's a little bit more complex than the previous example, but it's basically just reproducing some of the validation and fetching logic manually.

0 comments voice your opinion now!
create validate tutorial symfony2 form select choice dynamic


RandomBugs.com:
Apache Dynamic Virtual Hosting and PHP security
June 07, 2011 @ 10:09:31

On the RandomBugs blog today there's a new post looking at some of the considerations made when setting up Apache and PHP for dynamic virtual hosting.

It's been a while since I configured the latest Dynamic Mass Virtual Hosting Server. Last time I used mod_vhost_alias to create a dynamic virtual hosting and it worked without any problem for what we need in that time. [...] Now, the problem is a little bit changed: We need a secure sever which should support ftp virtual users with quota and we don't have permission to change the packages, apply patches or recompile sources, because we need to be able to upgrade without to much stress.

Their biggest problem was dealing with the virtual users and handling the security for them to work with the files and hosts set up for them and only them. They tried both suPHP and a combination of mod_vhost_alias/php safe_mode/openbasedir but neither fit their needs. In the end it was mod_macro that did the trick with one caveat - you had to be more careful when adding the host to use the correct syntax in the configuration. It's split between multiple files and settings have to match across them.

0 comments voice your opinion now!
dynamic apache security hosting virtual tutorial


Leonid Mamchenkov's Blog:
Disable and enable CakePHP plugins on the fly
April 25, 2011 @ 11:45:17

Leonid Mamchenkov has a quick post to his blog showing how to enable and disable (well, restrict from enabling) CakePHP plugins on the fly - no need to modify config files if you only need it for a certain request.

I am currently working on a rather large project which is based on CakePHP framework. In order to simplify the task, I've broken down the whole application into a number of CakePHP plugins. Now, however, I want to enable/disable plugins on the fly. After a brief search around I couldn't find how to do that. Asking a question at #cakephp IRC channel did it. RabidFire instantly replied with the link that gave me an idea. 30 seconds later I had a working solution.

Since the plugins extend the main AppController, all it took was a beforeFilter() method call that looks at a request parameter for the plugin name, checks against an "allowed" array and throws an exception of it's not found or can't load it.

0 comments voice your opinion now!
cakephp plugin enable load plugin dynamic beforefilter tutorial


Wojciech Sznapka's Blog:
Dynamic LAMP setup for localhost development
March 24, 2011 @ 09:55:51

In a recent post to his blog Wojciech Sznapka shows you how to set up your local development environment so that you're not having to configure a VirtualHost (assuming you're using Apache, of course) each time you want to work on a new project.

If you are developing PHP application on your own PC, you probably have some vhost based configuration of your Apache. With some tricks, you can turn your Linux box into powerful development server without configuring vhost for every app. [..] We can ommit two lasts steps [of a typical setup process], limiting preparation of the environment only to place source code somewhere in filesystem. To achieve this we need mod_vhost_alias module for Apache2 and simple DNS server which will resolve local domain names for us.

His tip uses the mod_vhost_alias module for Apache and the dnsmasq tool to make the basic DNS server to resolve these custom domains. A few configuration changes later (included) and you're set to restart apache and be on your way.

0 comments voice your opinion now!
lamp development dynamic modvhostalias dnsmasq



Community Events











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


example security hack overview opinion podcast language introduction symfony2 package application release install unittest code framework hhvm component facebook composer

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