Subject: phpblock_lastarticles

Posted on: 02/02/07 10:03pm
By: ivy

Hi all, Japanese member, nakanishi created phpblock_lastarticles. You can download it from here. phpblock_lastarticles() shows Last articles. ex)http://www.geeklog.jp/ ex)http://www.geeklog.jp/staticpages/index.php/news Please use it in Staticpages.PHP

Re: phpblock_lastarticles

Posted on: 02/02/07 11:17pm
By: jmucchiello

This isn't really a phpblock as you cannot call it from within the block control nor from COM_formatBlock. This is just code you can call within GL. I guess there really isn't a better place to put in on this website. But you should not name the function phpblock_ since it does not follow the interface for normal GL blocks.

Re: phpblock_lastarticles

Posted on: 03/02/07 01:38am
By: ivy

Thanks for reply, jmucchiello.

We can use it in PHP block correctry.
If you use it in Staticpage.PHP, you can use option of the function, too.

Re: phpblock_lastarticles

Posted on: 21/06/07 03:31pm
By: Anonymous

:banghead: Who's install the phpblock_lastarticles, on my Geeklog system?
Help - me

Thanks

Re: phpblock_lastarticles

Posted on: 24/06/07 10:17am
By: beewee

There's another block that does nearly the same, search for 'story by topic block' or something like that.

Re: phpblock_lastarticles

Posted on: 11/09/08 08:16am
By: ::Ben

:banghead: Who's install the phpblock_lastarticles, on my Geeklog system?
Help - me

Thanks



This is an old post but for the future...

Do not forget

PHP Formatted Code
$exclude=array('');  
 echo phpblock_lastarticles(10,50,$exclude);
 


like this one:

PHP Formatted Code


function phpblock_lastarticles($numrows=10, $Length=50, $exclude)
{
    global $_CONF, $_TABLES, $LANG04;
    //$Length=50;
    //$numrows=10;
    //Get appropriate stories from DB
       
        $exc = '';
        if (count($exclude)>0) {
           foreach ($exclude as $topic) {
             $exc .= " AND s.tid!='" . $topic ."'";
           }
        }

    $sql = "SELECT STRAIGHT_JOIN s.sid, s.tid,s.title, s.date, s.group_id,s.owner_id,s.perm_owner,s.perm_group,s.perm_members,s.perm_anon,t.topic,s.introtext from {$_TABLES['stories']} as s, {$_TABLES['topics']} as t WHERE s.title<>'' AND (s.tid = t.tid) AND (s.draft_flag = 0)". $exc . " ORDER BY s.date DESC LIMIT " . $numrows;
    //    echo $sql;
    $result = DB_query($sql);
    $nrows = DB_numRows($result);    

    //Display title of stories.
    $i=0;
    $retval='';
    do{
                $A = DB_fetchArray($result);
                //$descr = filter_ALL_HTML($A['introtext']);
                //$descr = mb_strimwidth ($descr, 0, 256, "...");
                $datestr = substr($A['date'],0,10);
                $TACCESS=SEC_hasTopicAccess($A['tid']);
                $ACCESS=SEC_hasAccess($A['owner_id'], $A['group_id'] ,$A['perm_owner'] ,$A['perm_group'] ,$A['perm_members'] ,$A['perm_anon']);

                $title =  mb_strimwidth ($A['title'], 0, $Length);
                if ($ACCESS>0 AND $TACCESS>0)
                {
                        // $title=COM_truncate($A['title'],$Length,'...');
                        $retval .= '<h1><br/><a class="non-ul" href="' . $_CONF['site_url'] . '/article.php?story=' . $A['sid']. '">' . $title . '<span>' . $descr . '</span></a></h1>' ;
                } else {
                        // $title=COM_truncate($A['title'],$Length,'...');
                        $retval .= '<h1><br/><span class="non-u">' . $title . "</span></h1>";
                }
                $retval .= ' on '. $datestr .'  Topic '. $A['topic'] .'<br/>';
                $i++;
    }while ($nrows>$i);

    return $retval;
}


 $exclude=array('');  
 echo phpblock_lastarticles(10,50,$exclude);

Re: phpblock_lastarticles

Posted on: 18/11/08 07:28am
By: Anonymous

Hi. Please help me how use this phpblock in geeklog 1.5.1?
on 1.4.1 it working great. but after upgrading on one of my geeklog sites it's stop working. Newbie needs your help :banghead: Oops!

Re: phpblock_lastarticles

Posted on: 08/12/08 06:23pm
By: Anonymous

someone help me with instalation this block on Geeklog 1.5.1 please Cry

Re: phpblock_lastarticles

Posted on: 09/12/08 05:02am
By: beewee

This one works: http://www.geeklog.net/forum/viewtopic.php?showtopic=36939

Geeklog - Forum
https://www.geeklog.net/forum/viewtopic.php?showtopic=74052