How to set current page active when menu in php file

Active menu item is simple when we go with HTML but when we develop website through PHP, its little bit difficult. As in HTML we can simply call active class for each menu label, here we need to write some dynamic CSS, here our hope/clue is URL . Based on URL we can do some magic. Lets assume we have class called "current" and we want this class active based on page we areee...


Code is simple look how i convert,




<ul id="menu" >

          <li class="activemenu"><a title="Home" href="index.php">Home</a></li>

          <li class="activemenu"><a title="About us" href="about-us.php">About us</a></li>

          <li class="activemenu"><a title="services" href="services.php">Services</a></li>

          <li class="activemenu"><a title="Security Doors" href="security-doors.php">Security Doors</a></li>

         

          <li class="activemenu"><a title="Gallery" href="gallery.php">Gallery</a></li>

          <li class="activemenu"><a title="Contact Us" href="contact.php">Contact Us</a></li>

        </ul>


Dynamic CSS Menu reading page URL


<ul id="menu" >

          <li class="<?php if(basename($_SERVER['SCRIPT_NAME']) == 'index.php'){echo 'activemenu'; }else { echo ''; } ?>"><a title="Home" href="index.php">Home</a></li>

          <li class="<?php if(basename($_SERVER['SCRIPT_NAME']) == 'about-us.php'){echo 'activemenu'; }else { echo ''; } ?>"><a title="About us" href="about-us.php">About us</a></li>

          <li class="<?php if(basename($_SERVER['SCRIPT_NAME']) == 'services.php'){echo 'activemenu'; }else { echo ''; } ?> activemenu"><a title="services" href="services.php">Services</a></li>

          <li class="<?php if(basename($_SERVER['SCRIPT_NAME']) == 'security-doors.php'){echo 'activemenu'; }else { echo ''; } ?>"><a title="Security Doors" href="security-doors.php">Security Doors</a></li>

         

          <li class="<?php if(basename($_SERVER['SCRIPT_NAME']) == 'gallery.php'){echo 'activemenu'; }else { echo ''; } ?>"><a title="Gallery" href="gallery.php">Gallery</a></li>

          <li class="<?php if(basename($_SERVER['SCRIPT_NAME']) == 'contact.php'){echo 'activemenu'; }else { echo ''; } ?>"><a title="Contact Us" href="contact.php">Contact Us</a></li>

        </ul>


Now you can call your menu <?php include 'menufilename.php';?> on any php page.

How to fix W3C CSS3 validation errors for box-shadow?

Now a days so many people wants their website HTML and CSS bugs/error  free ,. So they test website by submitting  to major W3C validation website for finding  the errors, Anyway here i am explaining how to get rid of  from the issue.. box- shadow errors. Well we have other W3C errors too, but i will explain in my next post.

Just like others i also develop websites in better manner with latest web techniques like CSS3 and HTML 5 but when i test my website i always face more errors with CSS compared to HTML and the one of my most disturbing error is with box-shadow because i love developing websites with shadow effects rather than using Photoshop techniques ,as i always want my developed website load quickly. So whenever  we  need use box shadow effect its better to use like below,

box-shadow:0px  5px 5px  #eee;

in place of,
-moz-box-shadow: 0px  5px 5px  #eee;
-webkit-box-shadow: 0px  5px 5px  #eee;



Comments are welcome for this posts and also if you have any doubts, thanks for reading my post.
 

Onclick hide for single or multiple div, table,tr,.. Tags with the same function name Using Javascript

Onclick hide for single or multiple div, table,tr,.. Tags with the same function name can be done using IDs. Mostly these types of code are used for dynamic contents which are generated from Mysql and so on. Any way the code is as follows: <html>
<head>
<script>
function hide(str)
{
var elem = document.getElementById(str);
elem.style.display = 'none';
}

</script>
</head>
<body>

<h2 align="center">Using the display property of CSS</h2>

<a href="#" onclick="hide(this.id);" id="1">Here is some text which I want to hide</a>
<a href="#" onclick="hide(this.id);" id="2">Here is some text which I want to hide</a>
<a href="#" onclick="hide(this.id);" id="3">Here is some text which I want to hide</a>

</body>
</html> Note: This code also be used by putting ID s for div, table, tr and so on.. In the same time you are also able to call onclick function by setting them in a button. As you know in above I put id and I also called function in same anchor tag, if you observe. I hope this code is very useful for you. Happy coding

Code for moving particular area of the page

Code for moving particular area of the page is mainly useful when the web pages are lengthy and also for easily moving to top of the page from bottom of the same page. It's simple one line code with anchor tag and id.

Meanwhile, if you want to navigate to particular area of the same page than the anchor tag will be,<a href="#cf" >  and,
if you want to navigate to particular area of some other page than the anchor tag will be, <a href="onlinewebprt.html#cf" > , but condition is that particular are should be kept in id tag which is mentioned in the anchor tag. As here i mentioned id as cf so particular content will be in


<div id="cf">
 <p>----------------------</p> </div>


Displaying current date in textbox at page on load

Displaying current date in textbox at page on load is very with a single function, I checked this function by putting the script in between head tags but i didn't work, Then again i put in the body section then it working perfectly.
This function reads current system time of our PC. But i am not fully satisfy with this code i want to be with global internet date. Mean while the code is as follows , hope it will helpful you guys.

SEO for beginners

SEO for beginners this post  must be read by those peoples who are new to internet marketing. Basically the term SEO means Search Engine Optimization which include with different web tactics, commonly these SEO classified into two types.
  1. On Page Seo.
  2. Off Page Seo.
A thing that you people observe in this post, that i am just giving introduction about SEO, i want to explain each and every part of seo with different posts so that you people can understand clearly. Mean while in On Page Seo work we handle meta tags, content writing, image optimization, anchor tags, head tags and so on..

Converting excel data to mysql database.

Converting excel data to mysql database is very important in those days because so many companies wants maintain their old/current excel data into mysql database so that they can access from any where by maintaining some authentication, not only authentication but also useful for particular record, attribute and so on..

In most cases this methodologies are useful for those who want convert their previous old excel data to mysql database. Mean while if you want Converting excel data to mysql database you have to follow three conditions and the conditions are,

Brief description of Ajax

Ajax is Asynchronous process with combination of JavaScript and Xml. It is a magical tool because the process is done within seconds. The main reason for using Ajax is to avoid burden on server. Hence it is a major rule for every programmer and web designer. The main difference between normal page and a page with Ajax come to real time is, in normal the whole page is loaded when action is called, where as in Ajax page particular section is loaded not a whole page.

How to connect a database in Php

                    Connecting the database in Php plays an important role. As I already mentioned in my previous article called introduction to php that connecting database comes under the categories of Dynamic. Mean while these connections are performed in two ways and the first one with example is as follows:-

<?
……………………………….

what is Traffic

                    As you know how a traffic is important for a website. Through traffic only a website becomes most popular in the same time your site status/ your business also improved. Mean while here I am explaining about Traffic and I am shore in my next post I will bring you lot of directories, links, search engines, techniques and much more that helps for increasing a traffic for a Website.

                    Here I am explaining some important points that is minimum need for a website to increase traffic. When ever a site is completed the first point is you have to Index your website to Google, because

Important links of Php for developing a website

                   As I all ready explained in my previous posts that about Php. Here again I came for you with few points that helps you developing a complete/perfect website in Php. The basic points here I am concentrating that as follows:-

1. What is the best editor for developing a Php website?
2. What are the important links for developing a Php web site?
3. How to search in Search Engines for particular codes or something else to get the solutions?

Why to choose Php

                    In those days as you see so many platforms are available such as Java, Asp.Net and so on... for developing a site or for software. Meanwhile each platform has its own capability and a particular weight, Then our question is why to choose Php, and the answer is very simple. Php is a type of platform that is mostly relevant for making websites in easy manner. You people can ask website design is also possible in Asp.net then why to choose Php, as it is true on both the sides meanwhile when you come to Asp.net all most all the sites are dynamic sites. Up to the mostly website designing is similar to Php, but when time of launching they have to purchase a software, which is very expensive in the result the projects made in Asp.Net is very

Source Code for Paginations in Php

                    Here again I am introducing one of the important code called Source Code for Paginations in Php. Before discussing about Source Code for Paginations in Php, Here we have to know first what Paginations is so that we can understand clearly about this code.

                    Ok, here I am discussing with small example when you guys go the search engines called Google, Yahoo or some thing else you type some matter in that box and when you click the search button

Example for pagination in Php

                   As I already mentioned the code in my topics called Codings. For more details about paginations visit Source code for paginations in Php in this Blog. Mean while here I am introducing an Example for pagination in Php with a small topic taken from my past project page. Change the table name, no. of pages display for each page, database connection name and so on…

                   Hence here is your code for pagination in Php with example i.e. is as follows written in two steps:-

Example for contact in Php

                    As I already mention the source code in a categorie called Codings, Here I am displaying the entire page that how it looks like in coding page who not understand there meanwhile you simply copy the code and paste in your page and make changes where I am written text as "YOUR COMPANY NAME","MAILID" and so on. I have confident you guys definitely understood and the source code as follows copy and paste presented below two steps-

Step1:-

Php source codes for Contact

                    In those days as you observer when you click "contact navigator" definitely a page will be opened, in that page you will see a form with some labels, textboxes and so on...with mentioning you to,
Enter your email id.
Enter your name.
Enter your contact no.
Select the time and so on…

Designing Tips in Php

                    Designing Tips in Php are the tips which make your page in a simple and stylish manner. The person who is interested in designing he must start with his career with html. Html is a foundation for Php and for form designing. Through html the structure is made, but for stylish look we use CSS, CSS means Cascading Style Sheets, Hence these CSS are used in .net and other platforms too, Thus CSS plays a wonderful role in so many platforms. Meanwhile when come to Php these CSS are written between the style tags under the head tags and the syntax is as follows:-

Validations in Php for a Checkbox

                   Validations in Php for Checkbox here why I am specifying the particular word because my friends ask me it is not possible as you given validation is not running if the more than 2 or 3 checkboxes are used in a form. Hence it is simple as I already tried when I am doing my assignments in html before I am learning the Php. Mean while the code as follows ,hopes it will helpful for you.

Validations in Php

                   Validations in Php plays an important role just like validations in Asp and other different platforms.

                    Validations in Php can be applied in two manners first one is writing the validation function for particular textbox or checkbox or whatever it may the content under the form i.e. is

Introduction to Php

                    In those days the word Php reaching to the peak levels if compare with other platforms. Php becomes a big competitors for all, even for a Microsoft's Asp and so on.., Hence it is an alternative for all the platforms and its syntax is much similar to 'C' and Perl.

                    So, what is Php? Some people called Php as Personal Home Page, but technical word for Php is Hypertext Pre Processor. Php is a server side scripting language just like Asp. Obviously the scripts are