Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
klatser
New Member
New Member


Joined: Sep 28, 2004
Posts: 3

PostPosted: Tue Sep 28, 2004 9:24 am Reply with quote

I wonder if it is posseble to print the article date above he articles subject.

My block (block-Last_5_Articles.php) now looks like:

Code:


<?php

if (eregi("block-Last_10_Articles.php", $_SERVER['PHP_SELF'])) {
    Header("Location: index.php");
    die();
}

global $prefix, $multilingual, $currentlang, $db;

if ($multilingual == 1) {
    $querylang = "WHERE (alanguage='$currentlang' OR alanguage='')";
} else {
    $querylang = "";
}
$content = "<table width=\"100%\" border=\"0\">";

$sql = "SELECT sid, title, comments, counter FROM ".$prefix."_stories $querylang ORDER BY sid DESC LIMIT 10";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
    $sid = $row[sid];
    $title = $row[title];
    $content .= "<tr><td align=\"left\"><strong><big>&middot;</big></strong>&nbsp;<a href=\"modules.php?name=News&amp;file=article&amp;sid=$sid\">$title</a></td><td align=\"right\"></td></tr>";
}
$content .= "</table>";

?>


You can see the block at: Only registered users can see links on this board! Get registered or login!

Is there someone who likes to help me???
 
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 17077

PostPosted: Wed Sep 29, 2004 9:30 pm Reply with quote

Are you referring to the news items in the center of your page or in the block on the right?
 
View user's profile Send private message
klatser
PostPosted: Tue Oct 05, 2004 11:06 am Reply with quote

It is for the block on the right.
 
Raven
PostPosted: Tue Oct 05, 2004 11:19 am Reply with quote

I would suggest looking at the nuke Old Articles block code. The date is used there.
 
klatser
PostPosted: Tue Oct 05, 2004 11:28 am Reply with quote

Old article looks like this:

Code:
<?php


/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

if (eregi("block-Old_Articles.php", $_SERVER['PHP_SELF'])) {
    Header("Location: index.php");
    die();
}

global $locale, $oldnum, $storynum, $storyhome, $cookie, $categories, $cat, $prefix, $multilingual, $currentlang, $db, $new_topic, $user_news;

if ($multilingual == 1) {
    if ($categories == 1) {
            $querylang = "where catid='$cat' AND (alanguage='$currentlang' OR alanguage='')";
    } else {
            $querylang = "where (alanguage='$currentlang' OR alanguage='')";
        if ($new_topic != 0) {
            $querylang .= " AND topic='$new_topic'";
        }
    }
} else {
    if ($categories == 1) {
           $querylang = "where catid='$cat'";
    } else {
        $querylang = "";
        if ($new_topic != 0) {
            $querylang = "WHERE topic='$new_topic'";
        }
    }
}
if (isset($cookie[3]) AND $user_news == 1) {
    $storynum = $cookie[3];
} else {
    $storynum = $storyhome;
}
$boxstuff = "<table border=\"0\" width=\"100%\">";
$boxTitle = _PASTARTICLES;
$sql = "SELECT sid, title, time, comments FROM ".$prefix."_stories $querylang ORDER BY time DESC LIMIT $storynum, $oldnum";
$result = $db->sql_query($sql);
$vari = 0;

$r_options = "";
if (isset($cookie[4])) { $r_options .= "&amp;mode=$cookie[4]"; }
if (isset($cookie[5])) { $r_options .= "&amp;order=$cookie[5]"; }
if (isset($cookie[6])) { $r_options .= "&amp;thold=$cookie[6]"; }

while ($row = $db->sql_fetchrow($result)) {
    $sid = $row[sid];
    $title = $row[title];
    $time = $row[time];
    $comments = $row[comments];
    $see = 1;
    setlocale(LC_TIME, $locale);
    ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime2);
    $datetime2 = strftime(""._DATESTRING2."", mktime($datetime2[4],$datetime2[5],$datetime2[6],$datetime2[2],$datetime2[3],$datetime2[1]));
    $datetime2 = ucfirst($datetime2);
    if($time2==$datetime2) {
        $boxstuff .= "<tr><td valign=\"top\"><strong><big>&middot;</big></strong></td><td> <a href=\"modules.php?name=News&amp;file=article&amp;sid=$sid$r_options\">$title</a> ($comments)</td></tr>\n";
    } else {
        if($a=="") {
                $boxstuff .= "<tr><td colspan=\"2\"><b>$datetime2</b></td></tr><tr><td valign=\"top\"><strong><big>&middot;</big></strong></td><td> <a href=\"modules.php?name=News&amp;file=article&amp;sid=$sid$r_options\">$title</a> ($comments)</td></tr>\n";
            $time2 = $datetime2;
            $a = 1;
        } else {
            $boxstuff .= "<tr><td colspan=\"2\"><b>$datetime2</b></td></tr><tr><td valign=\"top\"><strong><big>&middot;</big></strong></td><td> <a href=\"modules.php?name=News&amp;file=article&amp;sid=$sid$r_options\">$title</a> ($comments)</td></tr>\n";
            $time2 = $datetime2;
        }
    }
    $vari++;
    if ($vari==$oldnum) {
        if (isset($cookie[3])) {
            $storynum = $cookie[3];
        } else {
            $storynum = $storyhome;
        }
        $min = $oldnum + $storynum;
        $dummy = 1;
    }
}

if ($dummy == 1 AND is_active(Stories_Archive)) {
    $boxstuff .= "</table><br><a href=\"archive.html\"><b>"._OLDERARTICLES."</b></a>\n";
} else {
    $boxstuff .= "</table>";
}

if ($see == 1) {
    $content = $boxstuff;
}

?>


I found the date, but don't understand how to chance it to last articles in stat of random (sorry for my english)
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©