Quote:
Originally Posted by elhermanos
First, This was not implemented on a WoW website, But on a flyff php based template, which can be seen [Only registered and activated users can see links. Click Here To Register...]. And it's not triumphco one. It's mine. The conquer version of this template is not and won't be released.
|
Sorry, mixed it up with TriumphCO (which is a WoW template). The live serverfeed has nothing to do with the template what-so-ever, you can run it on a blank page if you so wish, I just grabbed a template quickly to get some styling onto it.
jQuery code (on top of my head, don't have it on this computer)
Code:
$(document).ready(function() {
setInterval(function() {
$.ajax({
type:"POST",
url:"/ajax/feed.php",
dataType:"json",
success:function(response) {
if($("ul.feed li:first").html() != response)
{
$("ul.feed").prepend('<li>' + response + '</li>').find("li:first").hide().show("blind", {percent: 100}, 350);
$("ul.feed li:last").remove();
}
});
}, 2500);
});
Will fetch data from feed.php every 2.5 seconds, which should return the latest happening. If it's already the latest one, it won't update.
feed.php should just grab the latest object from a database template, and echo it out.
If you're implementing this, use MySqli.
Code:
//setup your connection
$item = mysql_fetch_assoc(mysql_query("SELECT * FROM happenings ORDER BY id DESC LIMIT 0,1"));
echo $item['content'];
HTML:
Code:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<ul class="feed">
</ul>
CSS:
Code:
.feed {
height: 240px;
}
.feed li {
padding: 12px;
border-bottom: 1px solid #122;
width: 90%;
margin-left: 5px;
color: #b19e7a;
}
Then the rest takes place in the source. At the event you wish to add to the database (such as loot a DB, login/logout etc) simply just add a row to the table, simple as that.