Tags » Code Snippet

Get Browser Details Using PHP

This PHP function can be used to get the details of the browser.

function getBrowser()
$u_agent = $_SERVER['HTTP_USER_AGENT'];
$bname = 'Unknown';
$platform = 'Unknown';
$version= "";

//First get the platform? 321 more words
Code Snippet

Go back to the previous page in PHP

Although there are many methods to do this, I prefer the following code to go back to the previous page in PHP.

$url = basename($_SERVER['PHP_SELF']);
$query = $_SERVER['QUERY_STRING'];
$url .= "?".$query;
$_SESSION['current_page'] = $url;

… 109 more words
Code Snippet

Re-sampling Image In PHP

When a user uploads a high quality image, you might have to reduce the image size or re-sample to show it in smaller screens or as thumbnails so the loading time can be reduced. 110 more words

Code Snippet

Codeigniter - Placing assets folder

While many practices are followed while placing the assets folder in Codeigniter, I feel that the best place is in the root folder along with the application directory as shown below. 61 more words

Code Snippet

Remove index.php from URL in Codeigniter

Open applications/config/config.php and make the following changes :


$config['index_page'] = 'index.php';


$config['index_page'] = '';

And add the following code to a new file and save it as .htaccess inside the root folder : 21 more words

Code Snippet

Add Overlay For A Background Image In CSS

If you are looking for a cross browser solution to add an overlay to a background image with css, look no more. Here I’m adding a black transparent overlay to the header image. 64 more words

Code Snippet

How To Capture a Page Title Using PHP

Since we know that the title of the page in html will be inside the title tag, we can use the following regular expression to capture the page title of a page easily. 48 more words

Code Snippet