Need framework? Why not Yii?

What is Yii?

Yii is a high-performance PHP framework, not so complicated like Symphony or Zend.

About performance!

The graph below shows how efficient Yii is. We compared Yii with other PHP frameworks.

In the graph, RPS (request per second) describes how many requests an application can process per second. The higher the number, the more efficient a framework is.

Yii performance

As we can see that Yii outperforms all other frameworks in this comparison. The performance advantage of Yii is especially significant when the widely used APC extension is enabled.

What about Yii features?

  • Model-View-Controller (MVC) design pattern
  • Database Access Objects (DAO), Query Builder, Active Record, DB Migration
  • Form input and validation
  • AJAX-enabled widget
  • Authentication and authorization
  • Skinning and theming
  • Web services
  • Internationalization (I18N) and localization (L10N)
  • Layered caching scheme
  • Error handling and logging
  • Security
  • Unit and functionality testing
  • Automatic code generation
  • Friendly with third-party code
  • Detailed documentation
  • Extension library

all what you need ;)

My personal experience.

To test this framework, i create an online CV –
I have seen it was easy and intresting.
Further development of this project and will write a more detailed description.


If you are looking framework, why not Yii? Easy for beginners and full of features for more advanced users.

SugerCrm: How to disable Ajax for a specific module

You also have option of disabling the AjaxUI for modules or across the entire system.
From 6.3 version, SugarCrm have admin section for disabling the AjaxUI on a per module basis (/index.php?module=Administration&action=ConfigureAjaxUI).
It can also be done manually in the config override with a line like:

$sugar_config['addAjaxBannedModules'][] = "Acounts";

That would cause links to the Acounts module in SugarCrm no longer attempt to load via the AjaxUI, and use the normal URL structure.

If You want, you have also option of totally disabling the AjaxUI with the following code.


Remove duplicate values from an array in PHP

Today’s chalenge: How to remove the duplicate values from a PHP array?

after short search i found solution array_unique.

How this function works:


$input = array(1, 2, 2, 3, 3, 4);

$result = array_unique($input);

var_dump($result); ?>

will output:
array(4) {
[0]=> int(1)
[1]=> int(2)
[3]=> int(3)
[5]=> int(4)

Remember: Output of array_unique() will have the same key of input array.

XML to PHP array

Some times when working in PHP you need a way to convert an XML document into a serializable array. If you ever tried to serialize() and then unserialize() a SimpleXML or DOMDocument object, you know what I’m talking about.

Assume the following XML snippet:

<show name="The Simpsons">


I found quick but little dirty way to do convert such axml document to an array, using type casting and JSON functions. After this i can ensure there are no exotic values that would cause problems when unserializing:

$a = json_decode(json_encode((array) simplexml_load_string($tv)),1);

After this we get:

    [show] => Array
            [@attributes] => Array
                    [name] => The Simpsons)
            [husband] => Homer
            [wife] => Marge
            [kid] => Array
                    [0] => Bart
                    [1] => Lisa
                    [2] => Maggie



MIT launchesApp Inventor public Beta

the Android apps creation tool is no longer being managed by Google. MIT worked up its own version.

Now you can go and log into the MIT App Inventor with valid Google ID.

App Inventor lets you develop applications for Android phones using a web browser and either a connected phone or emulator. The App Inventor servers store your work and help you keep track of your projects.

You build apps by working with:

  • The App Inventor Designer, where you select the components for your app.
  • The App Inventor Blocks Editor, where you assemble program blocks that specify how the components should behave. You assemble programs visually, fitting pieces together like pieces of a puzzle.
  • Your app appears on the phone step-by-step as you add pieces to it, so you can test your work as you build. When you’re done, you can package your app and produce a stand-alone application to install.

Converting date in PHP from yyyymmdd to yyyy mm dd format

I have dates in the following format (yyyymmdd, 18751104, 19140722) and i need normal date (yyyy mm dd, 1875 11 04, 1914 07 22).

1. first you can use strtotime and date functions (this will fail with dates before the Unix epoch at the start of 1970. )
// prints 1995 Oct 12
echo date("Y M d", strtotime("19951012"));

2. Alternative which will work with dates before 1970
<?php // Returns the year as an offset since 1900, negative for years before
$parts = strptime("18951012", "%Y%m%d");
$year = $parts['tm_year'] + 1900; // 1895
$day = $parts['tm_mday']; // 12
$month = $parts['tm_mon']; // 10 ?>

3. simple method – date_parse_from_format

<?php $parsed_date = date_parse_from_format('Ymd', $date); ?> 

4. substr because it’s probably the lightest way to do it

mktime(substr($date, 0, 4), substr($date, 4, 2), substr($date, 6, 2));

Delete default input value on click

I hate this task: „Delete default value of an input text on click„. Many times i use code like this

<input type="text" value="" name="email"
onblur="if (this.value == '') {this.value = '';}"
onfocus="if (this.value == '') {this.value = '';}" />

Forget about this! I would recommend you try HTML5 solution below which uses the placeholder attribut.

<input name="Email" type="text" value="" placeholder="" />

How To Reset Joomla Password

Information database editing.

  1. Get a randomly generated 32 character string such as:
  2. Add that random string to the new password.
  3. Perform an MD5 hash of the combined string.
  4. Add this string into the _users table in the joomla db followed by a : and the 32 character string.

This sets the password as „password“.

Getting WordPress to save your FTP Information

If your a WordPress user which runs WordPress on a server then you’ll know that each time you install or remove a plugin you need to provide FTP information in order for WordPress to  get authorization to add or remove a plugin.

But did you know you can get WordPress to remember the FTP information? Which means you won’t have to constantly keep typing in your password each time you add or remove a plugin!

All you need to do is locate your wp-config.php file which is located within the first directory of your wordpress installation.  Once you’ve located the wp-config.php file open it up in some form of text editor, you edit it via your webhost control panel or over FTP it’s up to you.

Now once you’ve got your wp-config.php file open this is where I will say, DON’T CHANGE ANYTHING. This file (while small) controls part of your WordPress installation and changing any part of it can stuff up your WordPress powered website unless you know what your doing. Luckily we won’t be changing anything just adding a couple of lines to the file. Scroll down to the bottom of the wp-config.php file until you see ?> This represents the closing tag of a PHP script. Add the following just before the end PHP tag:

/* WordPress FTP Information (For removing the constant password request on plugin install and removal) */

define("FTP_HOST", "");
define("FTP_USER", "username");
define("FTP_PASS", "password");

Change the example data to your settings. If you are unsure of your FTP account details contact your host, im sure they’d happily enlighten you!

Save your changes to your wp-config.php file. You can now go ahead and test out your addition by installing a plugin using the Add new feature you should fine that the plugin will install without requesting your FTP password.