How to create Tag Cloud Page in wordpress

Posted by druva | HTML, php, utils, wordpress | Tuesday 26 January 2010 4:43 am

After exploring to create a cloud page  this is the way i have created one for my site

Follow the steps

1) create a php file with tagcloud.php

<?php
/*
Template Name: Tag Cloud
*/
?>

<?php get_header(); ?>

    <div id="content" class="narrowcolumn">
 		<h3 style="font-family:Arial, Helvetica, sans-serif; color:#CC6600">Tags Cloud</h3>
        <div class="tag_cloud">
            <?php wp_tag_cloud('number=0'); ?>
        </div>

    </div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

2) upload this file to server in your theme folder
in my case as i am using default theme i have uploaded to “totusinfo\blog\wp-content\themes\default”

3) Login to admin section click on create a page
4) Enter title of your page
5) Choose Tag Cloud from the Template Drop Down and click update/create

Now your tag cloud page is ready
EnJoy!!!!!

 

Include PHP files in HTML pages using .HTACCESS

Posted by admin | HTML, php, utils | Tuesday 8 September 2009 12:40 am

Usually, its not possible to include PHP files into HTML pages. Here i got a way for this which works. Its nothing but using .HTACCESS.

Create a .HTACCESS file in the root folder or a specified folder.
Add the below code  into your .HTACCESS file

Options +FollowSymLinks
AddType application/x-httpd-php .htm

Thats it

Now, you can include PHP files into your Static HTML Pages.

 

How to remove html tags from given text using PHP

Posted by druva | HTML, php, utils | Wednesday 24 December 2008 7:42 am

function stripHtmlTags($text){

	$strippedtext = preg_replace(
					array(
						'@<head[^>]*?>.*?</head>@siu','@<style[^>]*?>.*?</style>@siu','@<script[^>]*?.*?</script>@siu','@<object[^>]*?.*?</object>@siu',
						'@<embed[^>]*?.*?</embed>@siu','@<applet[^>]*?.*?</applet>@siu','@<noframes[^>]*?.*?</noframes>@siu',
						'@<noscript[^>]*?.*?</noscript>@siu','@<noembed[^>]*?.*?</noembed>@siu',

						'@<((br)|(hr))@iu','@</?((address)|(blockquote)|(center)|(del))@iu','@</?((div)|(h[1-9])|(ins)|(isindex)|(p)|(pre))@iu',
						'@</?((dir)|(dl)|(dt)|(dd)|(li)|(menu)|(ol)|(ul))@iu','@</?((table)|(th)|(td)|(caption))@iu',
						'@</?((form)|(button)|(fieldset)|(legend)|(input))@iu','@</?((label)|(select)|(optgroup)|(option)|(textarea))@iu',
						'@</?((frameset)|(frame)|(iframe))@iu',
					),
					array(
						' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',"\n\$0", "\n\$0", "\n\$0", "\n\$0", "\n\$0", "\n\$0","\n\$0", "\n\$0",
					),
					$text );

	return strip_tags($strippedtext);
}

echo stripHtmlTags("<div><strong>blog.totusinfo.com</strong></div>");
 

email validation using regular expression with PHP

Posted by druva | CSS, php, utils | Tuesday 23 December 2008 7:05 am

<?php
if(!empty($_POST['email'])){
	$regularexp = "^[A-Za-z0-9\.|-|_]*[@]{1}[A-Za-z0-9\.|-|_]*[.]{1}[a-z]{2,5}$";
	$email = $_POST['email'];
	$validemail = ereg($regularexp, $email);
	if ($validemail)
	{
		echo "<div style='color:green;'> <b>'$email'</b> is a valid email</div>";
	}
	else
		echo "<div style='color:red;'> <b>'$email'</b> is not a valid email</div>";
}else{
	echo "<div style='color:red; font-weight:bold;'> Please enter email</div>";
}
?>
<html>
	<body>
	<h2>Email Validator</h2>
	<form method="post">
		<div style="width:50px; font-family:Verdana, Arial, Helvetica, sans-serif; float:left; padding-top:3px;">
			Email:
		</div>

		<div style="width:300px">
			<input type="text" name="email" />
		</div>

		<input type="submit" />
	</form>
	</body>
</html>
 

remove an array element from array in php

Posted by druva | php | Saturday 8 November 2008 2:15 pm

While trying to delete any element from i am not able to find any function

      unset($arr[array_search($element, $arr)]);