Creating multi-level category system with PHP & Yii (MVC Framework) in not just a simple undertaking. Many Developer usage different type to handle this specific. They may possibly create 3 tables for initial level, subsequent level as well as 3rd level category (parent, sub category as well as sub sub cateogry). The best method to acquire multi-level category using recursive…
Category Archives Php
Users can upload images with uploadify and when uploadify sends the image to my controller I simply attach the sessionid as a parameter. Step One. Create function on own controller app/controller/PagesController.php Step 2 create view file for display <h1>Uploadify Demo</h1> <?php echo $this->Form->create('Setting', array('url'=>'#','type' => 'file')); ?> <div id="queue"></div> <?php echo $this->Form->input('file_upload',array('type' => 'file', "id"=>'file_upload', 'div'=>false,'label'=>false,"multiple"=>"true"));?> <?php echo $this->Form->input('police_no',array('id'=>'police_no', 'div'=>false,'label'=>false));?>…
Add search to your site Once you've created your custom search engine, you can add the Custom Search element to your site so that visitors can use it. To do this, you'll need to copy some code and paste it into your site's HTML where you want your search engine to appear.<form method="get" action="GoogleSearch.htm" target="_top"> <table border="0" align="right" cellpadding="0" cellspacing="0"> …
How can direct import controller function in ctp file. Some Time we need to direct import controller function in ctp file then given below function is very use full. You can try it Firstly create method on controller file $this->requestAction('/ControllerName/MethodName/);
Some time we logout from application, then we got successfully massage you are logout , but we click back button then we see we reach also last page where we logout. I solve this problem with given below function. Add below code in your AppController.php public function beforeRender() { $this->disableCache(); }
i got a requirment wherein i user add date in US(English) format but user want to display spanish language/or Other Language.First Method :/* Windows con apachesetlocale(LC_TIME, 'Spanish'); *//* Apache con linux *//* setlocale(LC_TIME, 'es_ES'); */// setlocale(LC_TIME, 'de_DE'); // echo strftime('%A, %d. %B %Y'); /* setlocale(LC_TIME, 'es_MX'); */setlocale(LC_TIME, 'es_ES'); //pase language code echo $fecha=strftime('%B %d %Y',strtotime('01-09-2012'));// Output septiembre 01 2012Second Method function converttospanish($paramdate){$str=$paramdate;$month = array("","enero", "febrero",…
Learn how to use the PHP GD library in your PHP program to generate dynamic images. Learn how to create and manipulate the GIF, PNG and JPG images.<?php# Note: Install GD laibreries $filename = '194_card.jpg';//orignal file $filename1 = '1.png';//save file name whoes you save list($current_width, $current_height) = getimagesize($filename);$left = 0; //crop left margin$top = 0;//crop right margin$crop_width = 1056; $crop_height = 400;$canvas = imagecreatetruecolor($crop_width,…
How can save images without use of browser with the help of Curl.Some time we need save url image help of code without open browser This function save image without open link.$url="http://google.com/imagename.jpg"; $ch = curl_init($url);$fp = fopen(‘folderpath/card1.jpg', 'wb');// folder path where you save imagecurl_setopt($ch, CURLOPT_FILE, $fp);curl_setopt($ch, CURLOPT_HEADER, 0);curl_exec($ch);curl_close($ch);fclose($fp);Note : One of the main reasons to use cURL to save…
How can import excel file data in mysql with the help of php. To import excel data into php-mysql records first create a table with required fields. Make database connection. Open excel file and read columns one by one and store in variables.First Method******************* import excel data to php code****************/$handle = fopen("Book1.csv", "r");while (($data = fgetcsv($handle)) !== FALSE) { $num…