Showing posts with label xml. Show all posts
Showing posts with label xml. Show all posts

Monday, March 1, 2010

Create xml rss feed with PHP

First, write a script like below;

<?php header('Content-type: text/xml'); ?>

<?php $phpver = phpversion(); ?>

<rss version="2.0">
<channel>
<title>SapuraTIE</title>
<description>Sapuratie</description>
<language>en-US</language>
<link>http://thegreatestpost.blogspot.com/</link>
<copyright>Your copyright</copyright>
<generator>
XML/RSS feed generator by thegreatestpost(PHP version
<?php echo $phpver; ?>)
</generator>

<managingEditor>Site Editor</managingEditor>
<webMaster>Webmaster Email</webMaster>



<?php
require_once('db_connect.php'); //your connection to database

$query = "SELECT id,content_title,content_data,content_date,
content_page FROM sapurastie_article
WHERE content_section <> 10 AND
content_language =
$lang ORDER BY content_date DESC LIMIT 0,15"; //your query
$execute = mysql_query($query) or die(mysql_error());

while($result = mysql_fetch_array($execute)) {
?>
//Start create item
<item>
<title> <?=htmlentities(strip_tags($result['content_title'])); ?></title>
<description>
<?=htmlentities(strip_tags(substr($result['content_data'],0,500)."...",'ENT_QUOTES'));
?>

</description>

<pubDate>
<?php
echo date('r', strtotime($result['content_date'])); ?>
</pubDate>
<guid>http://thegreatestpost.blogspot.com</guid>
</item>
<?php } ?>

</channel>
</rss>

then, the output will be like;



Created by: thegreatestpost.



Tuesday, February 10, 2009

What is AJAX (Programming)

Ajax, or AJAX techniques used to create interactive (Asynchronous JavaScript and XML), is a group of interrelated web developmentweb applications or rich Internet applications. With Ajax, web applications can retrieve data from the server asynchronously in the background without interfering with the display and behavior of the existing page. The use of Ajax has led to an increase in interactive animation on web pages. Data is retrieved using the XMLHttpRequest object or through the use of Remote Scripting in browsers that do not support it. Despite the name, the use of JavaScript and XML is not actually required, nor do the requests need to be asynchronous. The acronym AJAX has thus changed to the term Ajax, which does not represent these specific technologies.


Source : http://en.wikipedia.org

Note (site to get sourcecode):

http://www.java2s.com/
http://www.javascriptkit.com/