Friday, 22 March 2013

css


HIDDEN SCROLL IN BORWSER

ADD ON TOP THE CSS FILE

html { overflow-x:hidden;}

How to Add Multi-language Support to a PHP Website


For Download open in new tab

http://www.bitrepository.com/php-how-to-add-multi-language-support-to-a-website.html

Generate Csv file using PHP


<?php
ob_start();
session_start();
include('config.php');

// output headers so that the file is downloaded rather than displayed
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=filename.csv');

// create a file pointer connected to the output stream
$output = fopen('php://output', 'w');

// output the column headings
//fputcsv($output, array('Subscribed User '));
fputcsv($output, array('Field1', 'Field2 ', Field3 '));

$rows = mysql_query("SELECT   Field1, Field 2, Field 3  FROM table ");

// loop over the rows, outputting them
while ($row = mysql_fetch_assoc($rows)) fputcsv($output, $row);

?>

PHP Basics: Accessing Remote URLs using cURL


http://tournasdimitrios1.wordpress.com/2010/10/17/php-basics-accessing-remote-urls-using-curl/

Hide Print Button While Printing A Page


<style type="text/css">

@media print {

.printer {

display: none;

}

}

</style>



<a href="javascript:window.print()" class="printer" ><img src="images/printer.jpeg" height="30" width="30" alt="Print" /></a>

pop Window

<script type="text/javascript">// 
function popitup(url) {
       newwindow=window.open(url,'name','scrollbars,height=500,width=500','scrollbars');
       if (window.focus) {newwindow.focus()}
       return false;
}
</script>

Twitter feed in php


<?php
$timeline="http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=Your twitter username ";
$xml= new SimpleXMLElement(file_get_contents($timeline));
$i=0;
print "<ul class=\"tweet_list\">";
foreach($xml ->children() as $tstatus)
    {
        $stat=$tstatus->text;
        $split= preg_split('/\s/',$stat);
        print "<li class=\"tweet\"><p class=\"tweet_text\">";
        foreach ($split as $word)
            {

                if (preg_match('/^@/',$word)) {
                               print " "."<a href=http://www.twitter.com/".substr($word,1).">".$word."</a>";
                               }
                               else if (preg_match('/^http:\/\//',$word)){
                                     print " "."<a href=".$word.">".$word."</a>";
                               }
                               else
                                   {
                                   print " ".$word;
                               }

                              
            }
print "</p>";
print "<span class=\"date\">".substr($tstatus->created_at,0,strlen($tstatus->created_at)-14)."</span>";
print "</li>";
$i++;
if ($i==5)
    {
       
        break;
    }
    }
print "</ul>";
?>

Social sharing


Social sharing content


https://www.addthis.com/get/sharing
            or
<a class="addthis_button" href="http://addthis.com/bookmark.php?v=250&amp;pub=xa-4b052bb8729b6bf2"><img src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pub=xa-4b052bb8729b6bf2"></script>

Simple Way

 <iframe src="https://www.facebook.com/plugins/like.php?href=YOUR SITE URL"
        scrolling="no" frameborder="0"
        style="border:none; width:450px; height:80px"></iframe>

All Social Plugins

https://developers.facebook.com/docs/plugins/ 

OR

jQuery Floating Social Share Plugin: floatShare

http://www.egrappler.com/jquery-floating-social-share-plugin-floatshare/

Upload excel Sheet data in mysql using Php


Upload excel Sheet data in mysql using Php

Note:Must require_once 'excel_reader.php';

I have not added html code only php code ,


Below code for two fields ,No,Name

if(isset($_POST['submit']))
{

$excelFileName = $_FILES['img_upload']['name'];
$uploadDir = '../uploadexcelfiles/';
$rand=rand(0,9999);
$uploadFile = $uploadDir . $excelFileName ;
$filename=$_FILES['img_upload']['name'];
$ext = substr($filename, strpos($filename,'.'), strlen($filename));

if($ext == '.xls' )
{
if (move_uploaded_file($_FILES['img_upload']['tmp_name'], $uploadFile))
{

$data = new Spreadsheet_Excel_Reader();
$data->setOutputEncoding('CP1251');
$data->read($uploadFile);


$flag=false;
for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++)
{
$sql = false;
for ($j = 1; $j <= $data->sheets[0]['numCols']; $j++)
{
if (isset($data->sheets[0]['cells'][$i][$j]) && $data->sheets[0]['cells'][$i][$j] == 'No')
{
$flag = true;
$i++;
}
if (isset($flag))
{
if (isset($data->sheets[0]['cells'][$i][$j]) && $data->sheets[0]['cells'][$i][$j] != "")
{
if ($j == 1)
{
$No = $data->sheets[0]['cells'][$i][$j];
$No = !empty($No) ? $No : null;
$sql = true;
}
if ($j == 2)
{
$Name = $data->sheets[0]['cells'][$i][$j];
$Name = !empty($Name) ? $Name : null;
$sql = true;
}

}
}//end flag if
}//end j for

if (isset($sql))
{
// Apply sql query

}//end if of SQL
$No = "";
$Name="";

}

}
}

}

Chrismas countdown


Christmas Countdown

<p><embed src="http://www.satisfaction.com/christmas-countdown-generator/countdown1.swf?x=http://www.satisfaction.com" quality="high" bgcolor="#000000" width="450" height="200" name="countdown1" align="middle" allowScriptAccess="samedomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /><br><a href='http://www.satisfaction.com/christmas-countdown-generator/'>Christmas Countdown</a></p>

VISIT
http://www.satisfaction.com/christmas-countdown-generator/

HOW TO GET THE SPAN VALUE IN JQUERY


HOW TO GET THE SPAN VALUE FROM HREF TAG IN JQUERY

<a id='cmbpg_child' selected >
<span id='title '>Iliyas</span>
</a>

var href = $("#cmbpg_child .selected span").text();

:selected Selector


http://api.jquery.com/selected-selector/

Second Example

<select id="title">
  <option value="1">Mr</option>
  <option value="2">Mrs</option>
  <option value="3">Miss</option>
</select>
 
$("#title option:selected").text(); 

POST DATA USING JQUERY


jquery url >>http://code.google.com/p/jqueryjs/downloads/list

function POST()
{
var getvaluefrominput= $('#INPUTID').val();
    $.ajax({
        type: 'POST',
        url: 'phppagename.php',
        data: "ID="+getvaluefrominput,
        success: function(msg)
        {

           alert(msg)
          $('#ID').html(msg);
         }
    });
}
<?php
function curPageName() {
return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
}
echo curPageName();

?>
Q=How to get the current file name
A=
<?php
$currentFile = $_SERVER["PHP_SELF"];
$parts = Explode('/', $currentFile);
echo $parts[count($parts) - 1];
?>

Q-Cuurent URL
<?php
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
?>
<?php
echo curPageURL();
?>

Favicon ICon

Step To Create Favicon Icon.

Find This Text : Windows, सभी फ़ोटोशॉप संस्करणों (इस चुनें अगर आप बस वेब साइट favicon बनाना चाहते हैं)

Click On Window Link ,After Downloaded  Extract It .

Open Folder copy "ICOFormat.8bi" file and Past into

C:\Program Files\Adobe\Adobe Photoshop CS5\Plug-ins\File Formats 

After past restart photoshop (means close then reopen it).

your image size should be 16(width) and select 4th option from drop down



File save as .icon


Enjoy.................
Support For All Browser
THEN ADD THIS CODE IN PAGE(If have header page then add in it below code )
<link rel="shortcut icon" type="image/x-icon" href="http://www.abc.com/favicon.ico" />