Web
Web Programming
What are the useful fields of $_SERVER array in PHP
Jan 12th
The following table describes useful fields in $_SERVER array in PHP.
Name Description PHP_SELF Returns the filename of the current script SERVER_PROTOCOL Name and revision of the information protocol ‘HTTP/1.0‘ or ‘HTTP/1.1′ REQUEST_METHOD Returns the request method used to access (GET/POST/PUT) REQUEST_TIME Returns the timestamp from the beginning DOCUMENT_ROOT Returns the root directory under which the current script is executing. This directory is based on server’s configuration. HTTP_REFERER Returns the page address that referred HTTP_USER_AGENT Returns the contents of user agent extracted from HTTP header. This information is typically used for identification of user’s browser and operating system. REMOTE_ADDR Returns the More >How to include a CSS stylesheet in another style sheet – Use import url statement
Dec 10th
You can use “import url(..)” statement to include a CSS file with in an another. For example, you can include another css file (file2.css) in a style sheet file file1.css by placing following statement in file1.css.
@import url(file2.css);
The above url is relative and file2.css is expected to be available at the same directory level as file1.css.
Otherwise you can specify a complete URL or a relative URL as shown in the following examples.
Import from a directory with absolute path on the same server:
@import url(/css/file2.css);
Import from a directory with relative path on the same server:
@import url(../css2/file2.css);
Import from another server using More >
How to set various colors for A links using CSS
Dec 9th
The CSS supports following for <A> tag.
Name Description a:link Style is applied to all non-visited links a:visited Style is applied to all visited links a:hover Style is applied when mouse moves over a link a:active Style is applied to active links. A link becomes active when it is clickedIt is always recommended to specify the styles for a link in the same order as specified in the above table.
An example style specification:
<style type="text/css">
a:link {
color: #ff0000;
background-color: #00ffff;
text-decoration: none
}
a:visited {
color: #00ff00;
background-color: #ff00ff;
text-decoration: none
}
a:active {
color: #0000ff;
background-color: #ffff00;
text-decoration: none More > How to create rounded border for DIV, PRE like HTML elements
Dec 1st
The following CSS code enables rounded borders for elements like DIV, PRE etc. However it may not work in Internet Explorer (IE) as it is specific to certain browsers like Firefox.
pre {
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
The above CSS defines 3px radius for the rounded element. You can change it to a value of your choice.
How to define scrollable and fixed width DIV or PRE tag in HTML using CSS
Nov 30th
With fixed width websites, it is often desired to fix the maximum width of certain elements like <DIV>, <PRE> etc. However by fixing the maximum width of these elements, the content inside them may either disappear or may interfere with the content of element that appear near to them.
CSS supports an attribute “overflow” which can be used to define the way how browser should behave if the contents of such element tend to go beyond width or height of the element. The following are the possible values for “overflow” attribute.
Value Meaning auto Display horizontal or vertical scroll bar automatically when More >How to change bullet style for unordered list UL in HTML or CSS
Nov 30th
The unordered list “<ul>” supports an attribute named “type” that specifies type of display for bullets. The “type” attribute takes values: disc,circle,square.
The following displays a square instead of default disc style for bullets.
<ul type="square"> <li>One</li> <li>Two</li> <li>Three</li> </ul>
display looks like following
- One
- Two
- Three
Similarly, a disc style appears as follows:
- One
- Two
- Three
Similarly, a circle style appears as follows:
- One
- Two
- Three
Otherwise, you can use “list-style-type” attribute in CSS as shown below:
ul {
list-style-type: square;
}
You can customize the bullets further by specifying an image url in CSS as follows:
ul {
list-style-type: url("/images/arrow.jpg");
}
More >
How to display special characters in HTML
Nov 30th
HTML is a mark up language that uses characters like “<”, “>” as part of its syntax. So it provides a special escapes to display the special characters as is in HTML. The following table provides list of special characters and their HTML syntax.
Name Symbol HTML syntax Ampersand & & Cent ¢ ¢ Copyright © © Degree ° ° Greater Than > > Less Than < < Non-breaking Space Registered Trademark ® ® Trademark ™ ™
How to disable left indentation of LI tags in HTML
Nov 29th
The <li> tag can be used under an unordered list tag <ul> or ordered list tag <ol>.
The following shows how <li> tag can be used in an unordered list. Under unordered list, each <li> shows a bullet by default.
<ul> <li>One</li> <li>Two</li> <li>Three</li> </ul>
The above code appears in the browser as follows:
- One
- Two
- Three
You can use following CSS to disable left indentation:
ul {margin: 0;}
If you don’t want to display bullets, you can do the following.
ul {
list-style-type: none;
margin: 0;
}
You can use similar trick for ordered list
- as well.
More >
How to disable display of bullets for LI tags in HTML
Nov 29th
The <li> tag can be used under an unordered list tag <ul> or ordered list tag <ol>.
Unordered List The following shows how <li> tag can be used in an unordered list. Under unordered list, each <li> shows a bullet by default.
<ul> <li>One</li> <li>Two</li> <li>Three</li> </ul>
The above code appears in the browser as follows:
- One
- Two
- Three
If you don’t want each <li> item not to display its position as number under <ul>, you can add “list-style-type: none;” style to the <ul> tag.
<ul style="list-style-type: none;"> <li>One</li> <li>Two</li> <li>Three</li> </ul>
Ordered List The following shows how <li> tag can be used in an ordered list. Under ordered list, each More >
How to disable HTTPS or SSL in Apache server
Sep 17th
If your web server is not hosted using a dedicated IP address and doesn’t have a security certificate, it is implicit that you can’t host HTTPS service. In such cases, it is always better to disable HTTPS service so that there won’t be any unwanted service running in the server.
Use the following command to find if Apache is listening on HTTPS port.
[root@techpulp ~]# netstat -ntl | grep 43 tcp 0 0 :::443 :::* LISTEN [root@techpulp ~]#
To disable Apache from enabling HTTPS service, you need to comment the following line in /etc/httpd/conf.d/ssl.conf file.
#Listen 443
You need to restart the service to make the More >


Recent Comments