Welcome to Geeklog, Anonymous Saturday, April 20 2024 @ 03:52 am EDT

Geeklog Forums

phpblock_lastarticles2


Status: offline

kino

Forum User
Newbie
Registered: 06/14/06
Posts: 14
Location:Japan
Hello,I'm kino.

I make phpblock_lastarticles2.
in static page.
Text Formatted Code

$include=array('mailmaga');  // The list with the article topicID to want to show
echo phpblock_lastarticles2(10,48,$include);

function phpblock_lastarticles2($numrows=10, $Length=50, $include)
{
    global $_CONF, $_TABLES, $LANG04;
        $inc = '';
        if (count($include)>0) {
           foreach ($include as $topic) {
                 if(strlen($inc)==0) {
                $inc .= " ( s.tid='" . $topic ."')";
                 } else {
                $inc .= " OR ( s.tid='" . $topic ."')";
                 }
           }
           $inc = ' AND (' . $inc . ' ) ';
        }
    $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)". $inc . " ORDER BY s.date DESC LIMIT " . $numrows;
    $result = DB_query($sql);
    $nrows = DB_numRows($result);    

    //Display title of stories.
    $i=0;
    $retval='';
    do{
                $A = DB_fetchArray($result);
                $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']);
                $retval .= $datestr .' '. $A['topic'] .'::';
                $title =  mb_strimwidth ($A['title'], 0, $Length);
                if ($ACCESS>0 AND $TACCESS>0)
                {
                        $retval .= '<a class="new-story" href="' . COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $A['sid']) . '">' . $title . '<span>' . $descr . '</span></a><br>' ;
                } else {
                        $retval .= '<span class="new-story">' . $title . "</span><br>";
                }
                $i++;
    }while ($nrows>$i);

    return $retval;
}
 
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 08/29/05
Posts: 985
Text Formatted Code
function phpblock_lastarticles2($numrows=10, $Length=50, $include)

should be

function phpblock_lastarticles2($numrows=10, $Length=50, $include=Array())
 
 Quote

Status: offline

kino

Forum User
Newbie
Registered: 06/14/06
Posts: 14
Location:Japan
Big Grin

Thank you.
I am exactly surely.
 Quote

Status: offline

Sniper12

Forum User
Regular Poster
Registered: 11/25/03
Posts: 81
Location:Denmark
I think this is grade, but is there a way so it don’t show up the stories that don’t have to be seen before charismas or another date in the future.
 Quote

All times are EDT. The time is now 03:52 am.

  • 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