Category Archives: Script

Retrieve coordinates when click on image

Description: HTML forms allow the use of an image as a submit button, and the action triggers the send of the x and y coordinates of the click relative to the image size. However, why not take it to the … Continue reading

Posted in Javascript, Script | Tagged , , , | Leave a comment

Load different config files in in WordPress single implementation

Description: Having multiple databases on the same implementation of WordPress, you need to select the proper config file before running a selected script from command line Solution: Just add a parameter that describes the correct config you need, for example … Continue reading

Posted in Best practices, Script, Wordpress | Tagged , , | Leave a comment

Send array values from PhP form to JavaScript

Description: Having a PhP form, we need to manipulate in JavaScript an object that depends on the form input. Solution: The best way to do it is to use an encoded JSON object or an AJAX call. The AJAX call … Continue reading

Posted in Script | Tagged , , , , | 2 Comments

301 and 302 redirect, differences and implementation

Description: Is there any difference between 301 and 301 redirects ? Solution: Practically, there is limited difference between the two. To be precise, 301 redirect signals a permanent move of the page, while 302 reffers to a temporary move. This … Continue reading

Posted in Best practices, PhP, Script, Tools | Tagged , , , | Leave a comment

Zend Framework coding standards

Description: Guideline for coding in the Zend Framework. Solution: Use the following coding standards, derived from the original coding standards inherited from http://framework.zend.com/manual/en/coding-standard.overview.html : Class names: Classes_Upper_Case Function names: camelCaseFunction Constant names: CONSTANTS_USE_CAPITAL_LETTERS Configuration: UTF8 Return parameters(no direct $_GET or … Continue reading

Posted in Best practices, Script | Tagged , | Leave a comment

Ajax call forces redirect from HTTPS to HTTP return 302

Description: Calling an Ajax request from a HTTPS server redirects to the HTTP server causing a 302 redirect return message if the HTTP and HTTPS servers are on different IPs. Solution: Ajax calls through JavaScript will always redirect to HTTP. … Continue reading

Posted in PhP, Script | Tagged , | Leave a comment

Hide HTML fields with Javascript

Description: Hide or show different HTML fields when markup is changed. Solution: There are 3 aspects to take into consideration. First, we have to identify which element will dictate the change. This is done by adding the property onchange or … Continue reading

Posted in Script | Tagged | 1 Comment