Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 09:09 pm EDT

Geeklog Forums

phpblock_lastarticles


Status: offline

ivy

Forum User
Full Member
Registered: 11/25/04
Posts: 314
Location:Tokyo Japan
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
Geeklog Japan https://www.geeklog.jp
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 08/29/05
Posts: 985
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.
 Quote

Status: offline

ivy

Forum User
Full Member
Registered: 11/25/04
Posts: 314
Location:Tokyo Japan
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.

Geeklog Japan https://www.geeklog.jp
 Quote

Wendel

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

Thanks
 Quote

Status: offline

beewee

Forum User
Full Member
Registered: 08/05/03
Posts: 969
Location:The Netherlands, where else?
There's another block that does nearly the same, search for 'story by topic block' or something like that.
Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France

: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

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


like this one:

Text 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);

I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Zmxn

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!
 Quote

Zmxn

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

Status: offline

beewee

Forum User
Full Member
Registered: 08/05/03
Posts: 969
Location:The Netherlands, where else?
This one works: http://www.geeklog.net/forum/viewtopic.php?showtopic=36939
Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
 Quote

All times are EDT. The time is now 09:09 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content