The post below describes an easy and quick way to write text over an existing image using PHP. You can use this method to watermark your images and can put it to use in number of other ways. First […]
PDO is a PHP extension that allows multiple PHP's database connections by creating a single cohesive interface. It allows code portability and compatibility across various platforms. It can be considered as a database access layer providing a uniform method of […]
The phar extension is used to put entire PHP applications into a single file called a "phar" (PHP Archive) for easy distribution and installation. It provides the means for distributing code as a single archive, that does not have to […]
To set timezone in php at user level, you have to use the function date_default_timezone_set(). This function is available in version 5 and later of PHP <?php date_default_timezone_set('America/Los_Angeles'); // To see a list of all supported time zones please […]
The customer review date changer extension for Magento is a small, lightweight plugin that allows you to change the date for customer reviews at your Magento store. While importing your store from one CMS like WordPress to Magento, you have […]
After transferring the magento store to new server and database you might find that the magento admin is not loading the CSS and JS files. Because of that, the design would look out of order and the categories pages would […]
In order to maintain all your tables and data the way it is, you often require to perform an incremental update for magento, doing it otherwise might make some of your data obsolete. Here is a simple step by step […]
A salt is a random data string that is used as an input to hash a password. The salt and the password are concatenated and encrypted with a cryptographic hash function and the output is then stored in the database. […]
While uploading to magento connect, we often receive an error “Invalid Pakage Name- the Package name without ext should be ……..”. We have to take care of few things while packaging and uploading extension to magento connect. Following is the […]
To send an email with multiple attachments using php, we would be using a class PHPMailer. You can download that class from this link: http://phpmailer.worxware.com/index.php?pg=sf&p=dl To add more than one attachments to our email we would be using the […]
What is BB code? Bulletin Bar Code or simply BB Code is a lightweight markup language that is used to impose strict formatting rules in discussion boards, forums and occasionally in blogs. Its main objective is to facilitate a […]
What is Nonce? Literally it means a number that can be used only once. Nonce is often a random or pseudo random number that is used in authentication protocols in preventing semantic URL and replay attacks using old communications. Each […]
I would like to share my personal observations and knowledge relating website security. You can add more by commenting this post. Password Hashing Passwords and other credentials must be stored hashed in Database. Use md5() or sha1() functions. Password Renew […]
Developers often require verifying the URLs of external sites in various situations like for Affiliate Program, Link Building and many more. We can create a simple function named verifyURL() which accepts the URL as string parameter and return Boolean if […]
It is good that magneto offers watermarking for securing the catalog/product images but this security is not sufficient for advance internet users. Suppose, following is the link for your watermarked image http://www.yourwebsite.com/media/catalog/product/cache/1/image/de684549e4151748e56ee0dd7902c19f/m/y/my-first-image.jpg But if anyone removes the cache/1/image/de684549e4151748e56ee0dd7902c19f part of […]
After moving Magento site to new server/location we often get "Error: 404 Not Found" while accessing the admin / back-end. The reason of this error is store_id and website_id should be set to "0" (zero). For some reason when you […]
If you are struggeling to integrate the google checkout with Magento and facing the following error in google checkout console We encountered an error trying to access your server at https://yourdomain.com/googlecheckout/api -- the error we got is Send failed with […]
Today someone asked me for help to integrate Jeditable with Yii CGridView. So I thought why not write a little tutorial that can help others as well. In this article I assume that you are comfortable working with Yii; you […]
In the scenarios where validation rules provided by the Yii framework won’t handle your requirements, you can create custom validation rules. One example is the "authenticate" validation rule provided in "LoginForm" model of Yii blog demo. You can create your […]
There is no simple method of overloading constructors in PHP. There are few workarounds to achieve this. I use the following technique. class UserIdentity extends CUserIdentity { public function __construct() { $arg_list = func_get_args(); switch(func_num_args()) { case 1: // calling […]
Below is the complete list of predefined validator aliases: boolean: alias of CBooleanValidator, ensuring the attribute has a value that is either CBooleanValidator::trueValue or CBooleanValidator::falseValue. captcha: alias of CCaptchaValidator, ensuring the attribute is equal to the verification code displayed in […]
Eager loading can be nested. For example, if for every comment, we also want to know its author, we could use the following ‘with’ find: // find all posts together with their author and the author's profile Post::model()->with('author','author.profile')->findAll();
By default, Yii displays a textbox to search (filter) within results/records displayed by CGridView. In order to change those textboxes to drop down list (combo boxes), all you need to do is to assign an array to "filter" property of […]
Let’s discuss example relationship given on following URL http://www.yiiframework.com/doc/guide/1.1/en/database.arr If you want to be able to filter results in grid using Posts’ author name then modify the search function of Post model to similar to the one given below.
To use your custom css file globally, set the cssfile property in config file 'components'=>array( 'widgetFactory'=>array( 'widgets' => array ( 'cssFile' => '/css/style-gridview.css', ) ), );
To retrieve a cookie with the specified name: $cookie=Yii::app()->request->cookies[$name]; $value=$cookie->value; To send a cookie: $cookie=new CHttpCookie($name,$value); Yii::app()->request->cookies[$name]=$cookie;
In view file $this->uniqueid (controller name) $this->action->Id (action name) ($this is CController instance) In other files Yii::app()->controller->id Yii::app()->controller->action->id
Source: http://www.yiiframework.com/wiki/25/using-cautocomplete-to-display-one-value-and-submit-another/ Don’t forget to use the attached Javascript and CSS files. This code does not work with jQuery UI auto complete. Javascript File CSS File
You can also configure modules’ components in the main config file 'modules'=>array( 'my'=>array( 'components'=>array( 'foo'=>array( 'class'=>'FooComponent', 'a'=>'hello', ), ), ), ),
The following validation rule uses an error message that is different from the default one class Post extends CActiveRecord { public function rules() { return array( array('title, content', 'required', 'message'=>'Please enter a value for {attribute}.'), // ... other rules ); […]
A convenient drop down to select page size and save in User state. Step 1: On top of my controller action for the gridview (if you used CRUD, this is actionAdmin() ) i added: // page size drop down changed if […]
Step 1: In config/main.php, add following element to "components" array 'cache'=>array( 'class'=>'system.caching.CApcCache', ), Step2: In config/main.php, add following element to " components[‘db’] " array 'schemaCachingDuration' => 3600 Step 3: Comment out the following line of index.php defined('YII_DEBUG') or […]
Download and extract this file in protected/extensions directory. In config/main.php file, add the following element to components array 'image'=>array( 'class'=>'application.extensions.image.CImageComponent', 'driver'=>'GD', ) Now in action, insert the following code and modify paths $model->Picture = CUploadedFile::getInstance($model,'Picture'); if( is_object($model->Picture) ) […]
Step 1. Put this method into your WebUser class: public function getFlashKeys ( ) { $counters=$this->getState(self::FLASH_COUNTERS); if(empty($counters)) return array(); return array_keys($counters); }
If you want to link content of cell in Grid View to some page e.g In orders list, if you want customer’s name to be link that takes admin to customer’s detail page, change the columns of CGrid View as […]
Issue: Twitter Library developed by "Jaisen Mathai" throws an exception when uploaded on Media Temple Servers. EpiOAuthException::raise(Object(EpiCurlManager), false) #1 /nfs/c07/h03/mnt/12345/domains/abcde.com/html/protected/components/twitter/EpiOAuth.php(367): EpiOAuthResponse->__get('_resp')
If you would like to inform the user, that his changes were successfully saved, you could add the following line to your Controller: Yii::app()->user->setFlash('success',"Data saved!"); Displaying the flash message in a view is done by if( Yii::app()->user->hasFlash('success') ) { […]
Here’s how I installed it, taken from zend forums (http://www.zend.com/forums/index.php?t=msg&th=7855). This worked for me in Windows 7. Modify the paths below as needed for your installation of Windows 7. Download and install the latest JRE for Windows: http://java.com/en/download/manual.jsp Download and […]
This website uses cookies to provide necessary website functionality, improve your experience and analyze our traffic. By using our website, you agree to our Privacy Policy and our cookies usage.