blogs counter

blogs counter

Postby ogd39 on Tue Feb 20, 2007 7:42 am

Hello!
Would it be possible to create a blogs counter, which would show in real-time how many blogs do exist on a blogfarm?
and to meke this new data showable in a non-LT page (like "Displaying the most recent posts from all blogs" explanation in the wiki?)
Thanks
LT version installed : 1.2.6
ogd39
 
Posts: 287
Joined: Thu Jun 15, 2006 5:19 pm
Location: France

Postby tszming on Sat Feb 24, 2007 8:06 am

is it not difficult to add this function in fact,

but how would you fetch the data from LT to non-LT page, using Javascript?
tszming
 
Posts: 41
Joined: Thu Mar 09, 2006 1:17 pm

Postby jondaley on Sat Feb 24, 2007 12:04 pm

Do you have to do it via javascript?
I guess if I were tasked with making it show up in javascript, rather than php, I'd probably make a ajax'y sort of php page that would return the number, and then it could be called via javascript.
jondaley
Lifetype Expert
 
Posts: 6141
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Re: blogs counter

Postby markwu on Tue Feb 27, 2007 2:44 am

ogd39 wrote:Hello!
Would it be possible to create a blogs counter, which would show in real-time how many blogs do exist on a blogfarm?
and to meke this new data showable in a non-LT page (like "Displaying the most recent posts from all blogs" explanation in the wiki?)
Thanks


Here comes a exmpla, I think you can extent the function by yourself easily.

=== blogcount.php ====

Code: Select all
<?php
    if (!defined( "PLOG_CLASS_PATH" )) {
        define( "PLOG_CLASS_PATH", dirname(__FILE__)."/");
    }

    include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
   
    $blogs = new Blogs();
    $blogCount = $blogs->getNumBlogs();
    $javaScript = "document.write("$blogCount");";
   
    echo $javaScript;
?>


=== blogcount.html ====

Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
</HEAD>
<BODY>
<script type="text/javascript" src="blogcount.php"></script>
</BODY>
</HTML>



try to put both file under your lifetype root, and type http://yourdomain.blah/blogcount.html

You will see the blog count show up in html.

Mark
markwu
Lifetype Expert
 
Posts: 920
Joined: Wed Mar 31, 2004 1:59 pm


Return to Requests and Suggestions

cron