ZF2: Configure a layout for each module with EdpModuleLayouts

May
20

I have newly acquainted with ZF2, and played with EdpModuleLayouts to configure different layout for each module. For someone with very limited exposure with ZF2, the instruction provided in EdpModuleLayouts is not quite enough. I've spent about an hour to make this simple thing work, and sharing my experience with others who may run into similar challenge.

Here is what you'll have to do to make EdpModuleLayouts work:

1. Install EdpModuleLayouts module in the "vendor" folder.

ZF2: ZF1 like URL Routing

May
16

ZF2 introduces a new routing for the framework which is similar to ZF1, but has slightly different semantics. The skeleton application ships with a default Application level router which takes matching controller/action to /application/controller/action URI. If you wish to keep it backward compatible with ZF1 type of matching, you may want to make the following changes to the module/Application/config/module.config.php file as below:

Netsuite invoke Saved Search in PHP - Example

May
08

I've created a fair amount of PHP code to create custom searches on Netsuite Platform. With introduction of 2012.2 endpoint late last year, my examples have to be rewritten using the 2012.2 PHP Tool Kit API.

Here are a few examples written with v2011.2 API.

How to change primary key values

May
06

To change values of existing integer field (`table` is the table name, and "id" is the column name), you may use the following update SQL command:

update `table` set id=id+10000;

Let's say that you have an ecommerce website, and you want your order number to begin 10001. But, you already have a handful of orders already so you'll just update the existing values.

If you're updating your primary key values, MySQL will automatically adjust auto_increment value to begin after the largest number stored in the database.

How to get Client IP address in PHP?

Apr
01

There are a number of array name/value pairs provided in the PHP's "predefined" $_SERVER variable, which you can use to extract client's IP address. Some of the IP related $_SERVER parameters retrieved from the web server are passed by the client in the form of HTTP header, so they can be easily spoofed.

Trap spambots from submitting forms with honeypot and PHP

Mar
27

One of the duties of webmaster is to prevent spambots from submitting web forms. If spammers are not blocked, the data collected from the visitors will contaminated with spams and it's a real nuisance to clean out this data every so often. I have been researching ways to block spams on web forms we have on our website, and found a solution that works reasonably well.

[SOLVED] Google Chrome not loading external stylesheet.css

Feb
27

We have a webpage with a link to external stylesheet, but the Google Chrome doesn't appear to load the stylesheet while Firefox, Mozilla and IE displays the page correctly. Only some versions of the Chrome is not applying the styles defined in the external .css file.

We've found the cause of the problem to be one of the following two scenarios:

How to scroll to the top after a form submission in iframe?

Feb
27

This is not very likely scenario, but we use an iframe to embed a third-party content containing a multi-page form with a varying length of contents. The submit button on the earlier page is down near the bottom, but the resulting page is short and the content appears on the top. So, when a user submits the form the resulting page is empty as the contents are all the way on the top, and the browser is scrolled down too far. How do you get around this problem?

I did a google search, and found a couple of solutions:

[SOLVED] Outlook stripping newline character - Sendgrid

Feb
21

We've recently modified our ecommerce web application, and replaced the native PHP mail functionality with a phpmailer and SMTP. It was a pretty straight forward change, and we kept the mail format to "Plain/Text" format and changed the mail host to "smtp.sendgrid.net". After the change, we've noticed that the newline "\n" wasn't interpreted correctly and the mail we received were all garbled up. After some investigation, we found 2 things that needed to be changed to correct the problem.

How to install Zend Framework 2 skeleton application?

Feb
07

For anyone getting started with Zend Framework 2 (or ZF2), the best way to get up and running quick is by installing the Zend Skeleton Application available on github. Here is the quick and easy way to get the skeleton application installed on Linux machine. You'll install the skeleton application first, and then we'll install ZF2.

1. Change directory to where you want to install ZF2 Skeleton Application.

Pages

Subscribe to Web Traffic Exchange RSS