Code to get Title and Link in WordPress RSS Feed

Friday, August 5th, 2011 PHP Scripts, Programming

<?php

$con = file_get_contents(‘http://www.xxxxxx.com/blog/feed/’);/* Feed Url */
$title = getlinks(“<title>”, “</title>”, $con); // gets Title and stored in array
$url = getlinks(“<link>”, “</link>”, $con); // gets Url and stored in array

echo “<ul>”;
for($i=0; $i < 6; $i++)
{
echo ‘<li><a href=”‘.$url[$i].’” title=”‘.$title[$i].’” >’.urldecode($title[$i]).’</a></li>’;
}
echo “</ul>”;

function getlinks($s1,$s2,$s)
{
$myarray=array();
$s1 = strtolower($s1);
$s2 = strtolower($s2);
$L1 = strlen($s1);
$L2 = strlen($s2);
$scheck=strtolower($s);

do
{
$pos1 = strpos($scheck,$s1);
if($pos1!==false)
{
$pos2 = strpos(substr($scheck,$pos1+$L1),$s2);
if($pos2!==false)
{
$myarray[]=substr($s,$pos1+$L1,$pos2);
$s=substr($s,$pos1+$L1+$pos2+$L2);
$scheck=strtolower($s);
}
}
}
while (($pos1!==false)and($pos2!==false));
return $myarray;
}

?>

TAGS:

Creating Link Boxes in CSS

Saturday, September 11th, 2010 Style Sheet Designs

<html>
<head>
<style type=”text/css”>
a:link,a:visited
//Styles to be applied in link Box

{
display:block;
font-weight:bold;
color:#FFFFFF;
background-color:#98bf21;
width:120px;
text-align:center;
padding:4px;
text-decoration:none;
}
a:hover,a:active
{
background-color:#7A991A;
}
</style>
</head>

<body>
<a href=”default.asp” target=”_blank”>This is a link</a>
</body>
</html>

Output:

The link box will be created with the Specified Styles.

To set an Background Image and repeat the image Horizontally by using CSS

Monday, August 30th, 2010 Style Sheet Designs

<html>
<head>
<style type=”text/css”>
body
{
background-image:urlC:\Users\systemuser\Pictures\flower.jpg’);
background-repeat:repeat-x;
}
</style>
</head>
<body>
<h1>Hai Friends!!</h1>
</body>
</html>

Output:

The image in the given URL will be set as the Background  with the Text “Hai Friends!!”.

External css

Monday, August 23rd, 2010 Style Sheet Designs

Steps:

1:Create new html file and copy link.html code and save it as link.html.

2.Create  new css file and copy external.css code and save it as external.css.

3.link.html will connect css externally.

4.Run link.html to get output.

link.html:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

<html xmlns=”http://www.w3.org/1999/xhtml”>

<head>

<link rel=”stylesheet” type=”text/css” href=”external.css” />

<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />

<title>CSS</title>

</head>

<body>

<h3 align=”center”>External css</h3>

<p>This page uses external CSS.</p>

<p>p.first class code</p>

</body>

</html>



external.css:

body{ background-color:#00CCCC;}

p { color:#FFFFFF;

}

h3{ color:#000000;

text-decoration:underline;

text-transform:uppercase;

}

p.first{

color:#33FFCC;

}

output:

External css

This page uses external CSS.

p.first class code

TAGS:

Explode function in php

Monday, August 23rd, 2010 Basic PHP

How to split a name using explode function?
1. Get the name in a variable
2. Specify the position from which you need to split the name.
3. If you need to split the name after an underscore, use “_”.
4. If you need to split the name after @, use “@”.

<?php

$name  = “john_abraham@gmail.com”;
$pieces = explode(“_”, $name);
echo “firstname = $pieces[0]“.”<br />”;

$pieces = explode(“@”, $name);
echo “username = $pieces[0]“;

?>

Output will be displayed as:
firstname = john
username = john_abraham

TAGS:

IF Statement In PHP

Monday, August 23rd, 2010 Basic PHP

<html>
<head>
<title>IF statements in PHP.</title>
</head>
<body>

<?php

$name = “Rose”;

if ( $name == “Rose” )

echo “Your name is Rose!<br />”;

else

echo “Welcome to my homepage!”;
?>
</body>
</html>

Output:

If the Given input is Rose,the output will be

Your name is Rose!

Else

Welcome to my homepage!

Switch Case in Java Script

Monday, August 16th, 2010 javascript

<html>
<body>
<head>
<title>Switch Case </title>
</head>
<body>
<script type=”text/javascript”>
var d = new Date();
theDay=d.getDay();
switch (theDay)
{
case 5:
document.write(“<b>Finally Friday</b>”);
break;
case 6:
document.write(“<b>Super Saturday</b>”);
break;
case 0:
document.write(“<b>Sleepy Sunday</b>”);
break;
default:
document.write(“<b>I’m really looking forward to this weekend!</b>”);
}
</script>
</body>
</html>

/*This JavaScript will generate a different greeting based on what day it is. Note that Sunday=0, Monday=1, Tuesday=2, etc.*/

Output:

I’m really looking forward to this weekend!

Java Script for Mouse Events

Monday, August 9th, 2010 javascript

<html>
<head>
<script type=”text/javascript”>
function mouseOver()
{
document.getElementById(“b1″).src =”b_blue.gif”;
}
function mouseOut()
{
document.getElementById(“b1″).src =”b_pink.gif”;
}
</script>
</head>

<body>
<img border=”0″   src=”E:\pictures\baby.jpg” id=”b1″
onmouseover=”mouseOver()” onmouseout=”mouseOut()” /></a>
</body>
</html>

output:

The function mouseOver() causes the image to shift to “b_blue.gif”.

The function mouseOut() causes the image to shift to “b_pink.gif”.

To upload a file using php

Thursday, August 5th, 2010 Basic PHP

Steps:

1. Create new html file and copy upload.html code and save it as upload.html.

2. Create new php file and copy uploader.php code and save it as uploader.php.

3. Run upload.html, then it will display the html data.

4. Click browse button and select any file or image and press upload button.

5. Then it will transfer that specific file or image to the created folder and display the output as file is uploaded.

upload.html:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>upload</title>
</head>

<body>
<form enctype=”multipart/form-data” method=”post” action=”uploader.php”>
<input type=”file” name=”file” />
<input type=”submit” name=”submit” value=”upload” />
</form>
</body>
</html>

It displays the output as:

uploader.php
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Untitled Document</title>
</head>

<body>
<?php
if(isset($_REQUEST['submit']))
{
$to=”uploaded/”.$_FILES['file']['name'];
move_uploaded_file($_FILES['file']['tmp_name'],$to);
echo “file is uploaded”;

}
?>
</body>
</html>

//create a new folder uploaded

TAGS:

Program to insert Background Image

Monday, August 2nd, 2010 Style Sheet Designs

<html>
<head>
<style type=”text/css”>
body {background-image:url(‘systeuser/desktop/bc.jpg’);}/*inserting background image*/
</style>
</head>
<body>
<h1>Hello!</h1>
</body>
</html>

output:

Hello!

(If u run this code in Internet Explorer,the background image will be displayed with “Hello!” Message).

Search

 

Blogroll

  • Copywriting blog Searchenginegenie’s official copywriting blog
  • Linkbuilding blog Searchenginegenie’s official link building blog – tips and tricks
  • PPC Blog Searchenginegenie’s official PPC blog – Pay per clicks
  • Programming Blog Searchenginegenie’s official programming blog
  • SEO Blog Searchenginegenie’s official SEO blog
  • SEO News Searchenginegenie’s official news on internet and SEO
  • Web Design blog Searchenginegenie’s official web designing blog
  • What's Hot @ SEG Most recent whacky happenings @ SEG