শুক্রবার, ৮ নভেম্বর, ২০১৩

Make Data base

CREATE TABLE IF NOT EXISTS `post` (
   `id` int(11) NOT NULL auto_increment,
   `title` varchar(255) NOT NULL,
   `detail` text NOT NULL,
   PRIMARY KEY  (`id`)
 )


Insert data in database

INSERT INTO `test`.`post` (`id`, `title`, `detail`)
 VALUES (NULL, 'Concept', 'Web Technologies'),
 (NULL, 'HTML', 'Basic HTML, Special Tags, Formatting Tags, HTML Forms'),
 (NULL, 'CSS', 'Basic CSS, Advanced Topics, '),
 (NULL, 'JAVASCRIPT', 'Syntax, Enable, Location, External, Operators, Variable'),
 (NULL, 'PHP BASIC PART1', 'Introduction To PHP'),
 (NULL, 'PHP Basic 2', 'Arrays and Array Functions'),
 (NULL, 'MySQL Basic', 'Introduction To MySQL'),
 (NULL, 'CMS', 'What is Joomla'),
 (NULL, 'XML', 'What is XML'),
 (NULL, 'PHP Date', 'What''s a timestamp'),
 (NULL, 'Files', 'Reading Files'),
 (NULL, 'JavaScript', 'Ajax Basics'),
 (NULL, 'File Formats', 'Creating PDF Files'),
 (NULL, 'MySQL Database Administrators', 'Understanding MySQL Table Types'),
 (NULL, 'PHP OOP', 'Understanding OOP Concepts');



Make CSS File

page_links
 {
  font-family: arial, verdana;
  font-size: 12px;
  border:1px #000000 solid;
  padding: 6px;
  margin: 3px;
  background-color: #cccccc;
  text-decoration: none;
 }
 #page_a_link
 {
  font-family: arial, verdana;
  font-size: 12px;
  border:1px #000000 solid;
  color: #ff0000;
  background-color: #cccccc;
  padding: 6px;
  margin: 3px;
  text-decoration: none;
 }


Config file

<!--?php   //Host name   $host = "localhost";         //Username   $user = "root";         //Password   $password = "";         //Database Name   $database = "blogs";   $db = mysql_connect($host, $user, $password);   if($db)   {    $select_db = mysql_select_db($database);    if(!$select_db)    {     echo 'Database Error:'. mysql_error();    }   }else   {    echo 'Connection Error:'. mysql_error();   }  ?-->


PHP file 

<!--?php require_once "config.php"; ?-->





Pagination || http://www.w3programmers.com
 <link href="style.css" rel="stylesheet" type="text/css" /></pre>
<table style="border: 1px #000000 solid;" width="400" cellspacing="2" cellpadding="2" align="center">
<!--?php $perpage = 5; if(isset($_GET["page"])) { $page = intval($_GET["page"]); } else { $page = 1; } $calc = $perpage * $page; $start = $calc - $perpage; $result = mysql_query("select * from post Limit $start, $perpage"); $rows = mysql_num_rows($result); if($rows) { $i = 0; while($post = mysql_fetch_array($result)) { ?-->
<tbody>
<tr style="background-color: #cccccc;">
<td style="font-weight: bold; font-family: arial;"></td>
</tr>
<tr>
<td style="font-family: arial; padding-left: 20px;"></td>
</tr>
<!--?php } } ?--></tbody>
</table>
<pre>



</pre>
<table width="400" cellspacing="2" cellpadding="2" align="center">
<tbody>
<tr>
<td align="center">
<!--?php <br ?-->
if(isset($page))

{

$result = mysql_query("select Count(*) As Total from post");

$rows = mysql_num_rows($result);

if($rows)

{

$rs = mysql_fetch_array($result);

$total = $rs["Total"];

}

$totalPages = ceil($total / $perpage);

if($page <=1 )

{

echo "<span id="page_links" style="font-weight: bold;">Prev</span>";

}

else

{

$j = $page - 1;

echo "<span><a id="page_a_link" href="index.php?page=$j">< Prev</a></span>";

}

for($i=1; $i <= $totalPages; $i++)

{

if($i<>$page)

{

echo "<span><a id="page_a_link" href="index.php?page=$i">$i</a></span>";

}

else

{

echo "<span id="page_links" style="font-weight: bold;">$i</span>";

}

}

if($page == $totalPages )

{

echo "<span id="page_links" style="font-weight: bold;">Next ></span>";

}

else

{

$j = $page + 1;

echo "<span><a id="page_a_link" href="index.php?page=$j">Next</a></span>";

}

}

?></td>
<td></td>
</tr>
</tbody>
</table>
<pre>


<!--?php <br ?-->  if(isset($page))
  {
   $result = mysql_query("select Count(*) As Total from post");
   $rows = mysql_num_rows($result);
   if($rows)
   {
    $rs = mysql_fetch_array($result);
    $total = $rs["Total"];
   }
   $totalPages = ceil($total / $perpage);
   if($page <=1 )
   {
    echo "<span id="page_links" style="font-weight: bold;">Pre</span>";
   }
   else
   {
    $j = $page - 1;
    echo "<span><a id="page_a_link" href="index.php?page=$j">< Pre</a></span>";
   }
   for($i=1; $i <= $totalPages; $i++)
   {
    if($i<>$page)
    {
     echo "<span><a id="page_a_link" href="index.php?page=$i">$i</a></span>";
    }
    else
    {
     echo "<span id="page_links" style="font-weight: bold;">$i</span>";
    }
   }
   if($page == $totalPages )
   {
    echo "<span id="page_links" style="font-weight: bold;">Next ></span>";
   }
   else
   {
    $j = $page + 1;
    echo "<span><a id="page_a_link" href="index.php?page=$j">Next</a></span>";
   }
  }
 ?>



Pagination using database

<?php
/*
Place code to connect to your DB here.
*/
include('config.php'); // include your code to connect to DB.

$tbl_name=""; //your table name
// How many adjacent pages should be shown on each side?
$adjacents = 3;

/*
  First get total number of rows in data table.
  If you have a WHERE clause in your query, make sure you mirror it here.
*/
$query = "SELECT COUNT(*) as num FROM $tbl_name";
$total_pages = mysql_fetch_array(mysql_query($query));
$total_pages = $total_pages[num];

/* Setup vars for query. */
$targetpage = "filename.php"; //your file name  (the name of this file)
$limit = 2; //how many items to show per page
$page = $_GET['page'];
if($page)
$start = ($page - 1) * $limit; //first item to display on this page
else
$start = 0; //if no page var is given, set start to 0

/* Get data. */
$sql = "SELECT column_name FROM $tbl_name LIMIT $start, $limit";
$result = mysql_query($sql);

/* Setup page vars for display. */
if ($page == 0) $page = 1; //if no page var is given, default to 1.
$prev = $page - 1; //previous page is page - 1
$next = $page + 1; //next page is page + 1
$lastpage = ceil($total_pages/$limit); //lastpage is = total pages / items per page, rounded up.
$lpm1 = $lastpage - 1; //last page minus 1

/*
Now we apply our rules and draw the pagination object.
We're actually saving the code to a variable in case we want to draw it more than once.
*/
$pagination = "";
if($lastpage > 1)
{
$pagination .= "<div class=\"pagination\">";
//previous button
if ($page > 1)
$pagination.= "<a href=\"$targetpage?page=$prev\">� previous</a>";
else
$pagination.= "<span class=\"disabled\">� previous</span>";

//pages
if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up
{
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";
}
}
elseif($lastpage > 5 + ($adjacents * 2)) //enough pages to hide some
{
//close to beginning; only hide later pages
if($page < 1 + ($adjacents * 2))
{
for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";
}
$pagination.= "...";
$pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>";
$pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>";
}
//in middle; hide some front and some back
elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
{
$pagination.= "<a href=\"$targetpage?page=1\">1</a>";
$pagination.= "<a href=\"$targetpage?page=2\">2</a>";
$pagination.= "...";
for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";
}
$pagination.= "...";
$pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>";
$pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>";
}
//close to end; only hide early pages
else
{
$pagination.= "<a href=\"$targetpage?page=1\">1</a>";
$pagination.= "<a href=\"$targetpage?page=2\">2</a>";
$pagination.= "...";
for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";
}
}
}

//next button
if ($page < $counter - 1)
$pagination.= "<a href=\"$targetpage?page=$next\">next �</a>";
else
$pagination.= "<span class=\"disabled\">next �</span>";
$pagination.= "</div>\n";
}
?>

<?php
while($row = mysql_fetch_array($result))
{

// Your while loop here

}
?>

<?=$pagination?>



Add CSS code in your header section

div.pagination {
padding: 3px;
margin: 3px;
}

div.pagination a {
padding: 2px 5px 2px 5px;
margin: 2px;
border: 1px solid #AAAADD;

text-decoration: none; /* no underline */
color: #000099;
}
div.pagination a:hover, div.pagination a:active {
border: 1px solid #000099;

color: #000;
}
div.pagination span.current {
padding: 2px 5px 2px 5px;
margin: 2px;
border: 1px solid #000099;

font-weight: bold;
background-color: #000099;
color: #FFF;
}
div.pagination span.disabled {
padding: 2px 5px 2px 5px;
margin: 2px;
border: 1px solid #EEE;

color: #DDD;
}

সোমবার, ৪ নভেম্বর, ২০১৩

Hide index page and other php page from url

RewriteEngine on

RewriteRule ^/?$ /innerpage.php
RewriteRule ^([a-z0-9]+)/?$ /$1/innerpage.php
RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/?$ /$1/$2/innerpage.php

RewriteRule ^innerpage.php$ / [R]
RewriteRule ^([a-z0-9]+)/innerpage.php$ /$1 [R]
RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/innerpage.php$ /$1/$2 [R]

রবিবার, ৩ নভেম্বর, ২০১৩

Important tools for development

http://demo41.pwcstores.com/servicelist
http://demo41.pwcstores.com/storelocator

http://demo41.pwcstores.com/affiliate
http://demo41.pwcstores.com/products

http://demo41.pwcstores.com/manufacturers
http://demo41.pwcstores.com/contactus

http://www.paulund.co.uk/creating-different-css3-box-shadows-effects

CSS Box Shadow

We are going to be using the CSS box shadow property which is one my favourite CSS properties which you will see in this tutorial how easy you can use it.
The box-shadow property allows you to easily create multiple drop shadows on box elements by specifying values for colour, size, blur and offset.
The box-shadow property accepts 2-6 options, the required options are horizontal offset and vertical offset, the two optional options are spread distance and colour.


The box-shadow property allows designers to easily implement multiple drop shadows (outer or inner) on box elements, specifying values for color, size, blur and offset.
Browser support is growing of late with Mozilla (Firefox), Webkit (Safari/Chrome/Konqueror), Opera and the IE9 Platform Preview all offering a decent implementation of the spec, although Mozilla and Webkit still require their respective -moz- and -webkit- prefixes (note Mozilla Firefox 4.0+ no longer requires the -moz- prefix).
Here’s a basic example:


http://www.css3.info/preview/box-shadow/


http://www.webcoachbd.com/css-tutorials/external-css

ওয়েব ডিজাইন হচ্ছে একটা ওয়েবসাইটের জন্য বাহ্যিক অবয়ব তৈরী করা।ওয়েব ডিজাইনারের মুল কাজ একটা সাইটের জন্য টেমপ্লেট বানানো,এখানে কোন এপ্লিকেশন থাকবেনা।যেমন লগিন সিস্টেম, নিউজলেটার সাইনআপ, পেজিনেশন, ফাইল আপলোড করে ডেটাবেসে সেভ করা,ইমেজ ম্যানিপুলেশন, যদি সাইটে বিজ্ঞাপন থাকে তাহলে প্রতিবার পেজ লোড হওয়ার সময় বিজ্ঞাপনের পরিবর্তন এগুলি এপ্লিকেশন, ওয়েব এপ্লিকেশন।এসব তৈরী করতে হয় প্রোগ্রামিং ল্যাংগুয়েজ দিয়ে।কোন প্রকার এপ্লিকেশন ছাড়া একটা সাইট তৈরী করা এটাই ওয়েব ডিজাইন, এধরনের ডিজাইনকে বলতে পারেন স্টাটিক ডিজাইন।ওয়েব ডিজাইনের জন্য এই ধারনাটি সাধারনত ব্যবহৃত হচ্ছে।