Friday, March 2, 2012

Using your DIVs as Tables

Enjoy your coding!!!

<html>
<head>
<style>
  #container {
    display: table;
    }
  #row  {
    display: table-row;
    }

  #left, #right, #middle {
    display: table-cell;
    }
</head>
<body>
<div id="container">
  <div id="row">
   <div id="left">
     Left
   </div>
   <div id="middle">
      Middle
   </div>
   <div id="right">
       Right
   </div>
 </div>
</div>
</body>
</html>

Thursday, February 2, 2012

IIF in php


Syntax 
(expr1) ? (expr2) : (expr3) 
If expr1 is True, THEN do expr2, ELSE do expr3.

Sunday, January 29, 2012

How to change default Apache page?

If you wanna change the home page for your apache server, you can change it easily in httpd.conf which is located in D:\XAMPP\apache\conf\ Just add your desired file to be an index page for your site. :) Good Luck and all the best.


<IfModule dir_module>
    DirectoryIndex xxxx.php index.php index.pl index.cgi index.asp index.shtml index.html index.htm \
                   default.php default.pl default.cgi default.asp default.shtml default.html default.htm \
                   home.php home.pl home.cgi home.asp home.shtml home.html home.htm
</IfModule>

Tuesday, January 24, 2012

Joomla 2.5 is now released with multi-database support and easy update notification.


Joomla 2.5 is now release with multi-database support and easy update notification.

New Key Features :
  • Multi-database support with addition of Microsoft SQL Server.
  • Automatic notification when a Joomla or extension update is available. When logged into the control panel, site administrators will instantly have access to new notification buttons that allows them to see and act on the latest updates. In addition to updates for the Joomla CMS, a second button offers third party extension notification updates.
  • A better natural language search engine to the Joomla core. Complete with auto-completion and stemming (for example if you type “running” in a search field you also see run), it is faster and more versatile than the standard search.
Joomla 2.5 is truly a collaborative community-driven software project developed with the feedback gathered from more than 2.5 million Joomla forum posts, 540,000 Joomla forum members and data from more than 8,800 Joomla extensions.  To download Joomla 2.5, go to http://www.joomla.org/download.html.

You can find the list of other new features in this release at New Features in Joomla 2.5

source : joomla.org



Tuesday, January 17, 2012

Uploading and Save CSV file in MySQL database with PHP

Uploading and Save CSV file in MySQL database with PHP


 <?php  
 include("opendb.php");  
 //echo isset($_POST['submit']);  
 if(isset($_POST['submit']))  
 {  
      $filename=$_FILES['files']['name'];  
      $filename=date('U').$filename;   
      $add1 = "import/$filename";   
      move_uploaded_file($_FILES[files][tmp_name], $add1);  
      chmod($add1,0777);  
      basename($_FILES['files']['name'] );   
      $filename1="import/$filename";  
      $fcontents = file ($filename1);   
      echo sizeof($fcontents);  
      for($i=0; $i<sizeof($fcontents); $i++) {   
      $line = addslashes(trim($fcontents[$i]));   
      $arr = explode("\t", $line);   
      echo "<pre>";   
      print_r($arr);  
 //exit();   
 //echo $arr;  
 $Repl_arr=array("[","]");   
 //echo $Repl_arr;  
 foreach($arr as $key=>$val)  
 {  
      $arr[$key]=str_replace($Repl_arr,"",$arr[$key]);  
      $arr_new=$arr[$key];  
      $arr_new1 = explode(",", $arr_new);  
 }  
 //echo "<PRE>";  
 //var_dump($arr_new1);  
 /*  
 $date=explode("/", $arr_new1[0]);  
 $dd=$date[0];  
 $mm=$date[1];  
 $yy=$date[2];  
 if(strlen($dd)==1){  
 $dd="0".$dd;  
 }  
 if(strlen($mm)==1){  
 $mm="0".$mm;  
 }  
 $date1=$yy."-".$mm."-".$dd;  
 */  
 $name=$arr_new1[0];  
 $addr = $arr_new1[1];  
 //$email=$arr_new1[2];   
 //$amount=$arr_new1[3];  
 $sql = "insert into mytestupload set   
 tfield='$name',tfield1='$addr'";   
 //echo $sql;  
 //exit();  
 $qr=mysql_query($sql);  
 echo "-----------1 Row Inserted----------";  
 $sql ."<br><br>\n";  
 if($qr!=0)   
 $msg= "Data has been imported";  
 if(mysql_error()) {  
 echo mysql_error() ."<br>\n";  
 }  
 }  
 unlink($filename1);  
 unset($_POST);  
 $_POST['submit']='';  
 $_POST='';  
 //echo "<script>window.location=('addcsv.php');</script>";  
 } ?>  
 <html>  
 <head>  
 <title>Import CSV</title>  
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">  
 <link href="../css/decorate.css" rel="stylesheet" type="text/css">  
 </head>  
 <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">  
 <table width="100%" border="0" cellspacing="0" cellpadding="0">  
 <tr>   
 <td align="center" valign="top"><table width="100%" border="0">  
 <tr>  
 <td height="25" align="center" class="label">Import CSV Tax File </td>  
 </tr>  
 </table>  
 <table width="100%" border="0" cellpadding="3" cellspacing="0">  
 <tr>  
 <td valign="top"><form action="addbatchtext.php" method="post" enctype="multipart/form-data">  
 <table width="100%" border="1">  
 <tr>   
 <td width="30%" class="line2">File Name:</td>  
 <td width="70%" align="left" class="line2"><input name="files" type="file" class="inp"></td>  
 </tr>  
 <tr>  
 <td class="line2">&nbsp;</td>  
 <td align="left" valign="middle" class="line2">&nbsp;</td>  
 </tr>  
 <tr><td class="line2">&nbsp;</td>  
 <td align="left" valign="middle" class="line2">  
 <input name="submit" type="submit" class="buttons" value="Submit" ></td>  
 </tr>  
 </table>  
 </form></td>  
 </tr>  
 </table></td>  
 </tr>  
 </table>  
 </body>  
 </html>  

Monday, January 9, 2012

Hiding iframe border in IE

<iframe id="myiframe" name"myiframe" frameborder="0" width="900" height="600"></iframe>

Friday, January 6, 2012

Navigate rows in jqGrid (jQuery Grid)


Here's how to navigate rows in jqGrid (jQuery Grid)


function naviGrid(direct)
{
var gridArr = $('#list1').getDataIDs();                
var selrow = $('#list1').getGridParam("selrow");              
var curr_index = 0;                
for(var i = 0; i < gridArr.length; i++)                
{                    
if(gridArr[i]==selrow)                        
curr_index = i;                
}                
if(direct == 'back') //back                
{                    
if((curr_index-1)>=0)                        
$('#list1').resetSelection().setSelection(gridArr[curr_index-1],true);                
}                
if(direct == 'fwd') //forward                
{                    
if((curr_index+1)<gridArr.length)                        
$('#list1').resetSelection().setSelection(gridArr[curr_index+1],true);                
}
}