Pages

Sunday 31 March 2013

Site of the Week - rozmowa.nu


Hello everyone!!

             Hope you all doing great! This time the chosen site of the week is : rozmowa.nu


Things I liked about the site:
  • The colour scheme
  • use of bright and vibrant graphics
  • the sliding navigation
  • de-cluttered content presentation
                                        Hope this post was helpful. Keep tuned for more!
                                                                                                                                 - N K Sran

Saturday 23 March 2013

Site of the Week - eastafricanbakery.com


Hello everyone!!
              It is time for the site of the week. This time chosen one is : eastafricanbakery.com


What I really liked is:
  • the bakery theme is excellent
  • the navigation through the whole site
  • wonderful use of CSS
  • the graphics are beautifully used
  • the way the content is displayed
                    Click on the image to visit the site. Hope this post was helpful. Stay tuned for more!
                                                                                                                                                 - N K Sran

Saturday 16 March 2013

Site of the Week - www.tefaf.com

Hello everyone!!

             Hope you all doing great! This time the chosen site of the week is : www.tefaf.com


Things I loved about the site:
  • Subtle colour scheme
  • great use of graphics
  • easy navigation
  • unique style
  • de-cluttered content presentation


Sunday 10 March 2013

Site of the Week - winkttd.es

Hello everyone!!
              It is time for the site of the week. This time chosen one is : winkttd.es


What I really liked is:
  • the navigation through the whole site
  • wonderful use of CSS
  • the graphics
  • the way the content is displayed
                    Click on the image to visit the site. Hope this post was helpful. Stay tuned for more!
                                                                                                                                                 - N K Sran


Tuesday 5 March 2013

CSS - Minimum width for a page


A very handy CSS command that exists is the min-width command, whereby you can specify a minimum width for any element. This can be particularly useful for specifying a minimum width for a page.

Unfortunately, IE doesn't understand this command, so we'll need to come up with a new way of making this work in this browser. First, we'll insert a <div> under the <body> tag, as we can't assign a minimum width to the <body>:

<body>
<div id="container">

Next we create our CSS commands, so as to create a minimum width of 600px:

#container
{
min-width: 600px;
width:expression(document.body.clientWidth < 600? "600px": "auto" );
}

The first command is the regular minimum width command; the second is a short JavaScript command that only IE understands. Do note though, this command will cause your CSS document to invalidate so you may prefer to insert it into the head of each HTML document to get round this.

You might also want to combine this minimum width with a maximum width:

#container
{
min-width: 600px;
max-width: 1200px;
width:expression(document.body.clientWidth < 600? "600px" : document.body.clientWidth > 1200? "1200px" : "auto");
}

Monday 4 March 2013

10 PHP tips for faster execution

1. Unset or null your variables to free memory, especially large arrays.
2. echo is faster than print.
3. Use require() instead of require_once() where possible.
4. “else if” statements are faster than select statements aka case/switch.
5. Close your database connections when you’re done with them.
6. $row[’id’] is 7 times faster than $row[id], because if you don’t supply quotes it has to guess which index you meant, assuming you didn’t mean a constant.
7. ++$i is faster than $ i++, so use pre-increment where possible.
8. Make use of the countless predefined functions of PHP, don’t attempt to build your own as the native ones will be far quicker; if you have very time and resource consuming functions, consider writing them as C extensions or modules.
9. Methods in derived classes run faster than ones defined in the base class.
10. Just declaring a global variable without using it in a function slows things down (by about the same amount as incrementing a local var). PHP probably does a check to see if the global exists.

Sunday 3 March 2013

Site of the Week - nasaprospect.com

Hello everyone!!
          I am back with the site of the week: nasaprospect.com


   Hope this post was helpful. Keep designing!
                                                                                                                                         - N K Sran

How to convert PHP table to excel file

Hello everyone!!
                    Today I am posting an easy code to convert PHP table into an excel file. Here it is:

<?php


$SQL="SELECT * FROM tbl_name";
$result=mysql_query($SQL) or die("Error, query failed");

$num=mysql_numrows($result);

$export = mysql_query ( $SQL ) or die ( "Sql error : " . mysql_error( ) );

$fields = mysql_num_fields ( $export );

for ( $i = 0; $i < $fields; $i++ )
{
$header .=mysql_field_name( $export , $i ) ."\t";
}
while( $row = mysql_fetch_row( $export ) )
{
$line = '';
foreach( $row as $value )
{
if ( ( !isset( $value ) ) || ( $value == "" ) )
{
$value = "\t";
}
else
{
$value = str_replace( '"' , '""' , $value );
$value = '"' . $value . '"' . "\t";
}
$line .= $value;
}

$data .= trim( $line ) . "\n";
}

$data = str_replace( "\r" , "" , $data );

if ( $data == "" )

{

$data = "\n(0) Records Found!\n";

}
header("Content-type: application/octet-stream");

header("Content-Disposition: attachment; filename="filename.xls");

header("Pragma: no-cache");

header("Expires: 0");

print "$header\n$data";


?>

                                       Hope it was helpful to all. Keep tuned for more stuff.
                                                                                                                         - N K Sran