PHP Nuke Nederland
 
•   Home  •  Downloads  •  Your Account  •  Forums  •
PHP-Nuke Nederland: Forums

PHP-Nuke Nederland :: View topic - Last 5 Articles block
 Forum FAQ  •   Search   •  Memberlist  •  Usergroups   •  Register   •    •  Profile  •  Log in to check your private messages  •  Log in

 
Post new topicReply to topic
View previous topic Log in to check your private messages View next topic
Author Message
bjornju
Beginner
Beginner


Joined: Apr 01, 2008
Posts: 9

PostPosted: Mon 12 May 2008 6:29 Reply with quoteBack to top

Ik wil mijn Last 5 articles block aanpassen.
Ik heb daarvoor een module gevonden, maar dan is het om één of andere reden niet meer mogelijk om topics te maken voor de nieuwsberichten.

Ik had vervolgens de gedachten om het module om te zetten in een block.
Nu is mijn vraag, welke regels moet ik eruit halen om het block te laten werken.
Had de verwijzingen naar mainfile, footer, header e.d al weggehaald, maar misschien moet er nog meer weg.
Of misschien werkt het gewoon niet en moet ik het last 5 articles block aanpassen naar de wensen die ik heb.

Code:
if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
    die ("You can't access this file directly...");
}
/* Stories setting */
$limit = 5; // display how many articles per topic
$index = 1;
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
// Function to cut long text
function cut($str,$max){
$count = strlen($str);
if($count >= $max) {
for ($pos=$max;$pos>0 && ord($str[$pos-1])>=127;$pos--);
if (($max-$pos)%2 == 0)
$str = substr($str, 0, $max) . "...";
else
$str = substr($str, 0, $max+1) . "...";
return $str;
}
else {
$str = "$str";
return $str;
}
}

function index(){
global $limit, $prefix, $db, $module_name;
    include("header.php");
    $sql = "SELECT topicid,topicname,topictext FROM ".$prefix."_topics where displayhome='1' ORDER BY displayorder";
    $result = $db->sql_query($sql);
    while ($row = $db->sql_fetchrow($result)) {
    $topicid = $row[topicid];
    $topicname = $row[topicname];
    $topictext = $row[topictext];
   $cnt = $db->sql_numrows($db->sql_query("SELECT sid FROM ".$prefix."_stories where topic=$topicid"));
   if ($cnt > 0){
   OpenTable();
   
   echo "<center><img></center><br>";
   echo "<table>\n"
      ."<tr>\n"
      // Topics
      //."<td><B>:: $topictext</B></td>\n"
      // Link to topic
      //."<td> <a>meer ...</a> </td>\n"
      
      
      ."</tr>\n"
      ."</table>\n";
   // Bold line below topic title
   echo "<table>\n"
      ."<tr>\n"
      // Topic line's color. You could change the color code to suit your theme
      //."<td><img></td>\n"
      ."</tr>\n"
      ."</table>\n";
   // Here you could limit the news shown in a topic by changing the
   // value 'limit 5' to 'limit 10' or whatever you want. Default is 5.
    $sql2 = "SELECT sid, catid, aid, title, time, comments, counter, topic, informant, score, ratings FROM ".$prefix."_stories where topic=$topicid ORDER BY sid DESC limit 0,$limit";
    $result2 = $db->sql_query($sql2);
   while ($row2 = $db->sql_fetchrow($result2)) {
       $s_sid = $row2[sid];
       $catid = $row2[catid];
       $aid = $row2[aid];
       $title = $row2[title];
       $time = $row2[time];
       $comments = $row2[comments];
       $counter = $row2[counter];
       $topic = $row2[topic];
       $informant = $row2[informant];
       $score = $row2[score];
       $ratings = $row2[ratings];
   $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]"; }
   $Y = substr($time, 0, 4);
   $M = substr($time, 5, 2);
   $D = substr($time, 8, 2);
   // Date (D=day, M=month, Y=year) - can be changed to other format such as $M.".".$D.",".$Y;
   $time = $D."-".$M."-".$Y;
   // Cut the long title to avoid stretch on the table.
   // The value '35' is the lenght of the text.
   // You may change it to suit your theme. Default is 35.
   $title = cut($title,150);

   echo "<table>\n"
      ."<tr><td>\n"
      ."<table>\n"
      //."<tr>\n"
      // News titles begin from here
      ."<td></td>\n"
      ."<td> <strong><big>·</big></strong>"
      ." <a>$title</a></td>\n"
      // Here you can add more info of the news at the ($comments comments)
      // such as ($counter reads) or (Informant: $informant) or (Score: $score).
      ."<td> $time </td>\n"
      ."<td></td>\n"
      ."</tr></table></td></tr></table>\n"
      ."<table>\n"
      ."<tr>\n"
      ."<td></td>\n"
      ."<td></td>\n"
      ."<td></td>\n"
      ."</tr>\n"
      ."</table>\n";
        }
   CloseTable();
    }
   echo "<BR>";
   }
   echo $copy;
    include("footer.php");
}

switch ($op) {
    default:
    index();
    break;
}

?>
View user's profileSend private message
bjornju
Beginner
Beginner


Joined: Apr 01, 2008
Posts: 9

PostPosted: Mon 12 May 2008 21:33 Reply with quoteBack to top

Met wat knip en plak werk heb ik inmiddels het Last 5 articles block aankunnen passen naar dit;

Code:
if ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}

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

if ($multilingual == 1) {
    $querylang = "WHERE (alanguage='$currentlang' OR alanguage='')";
} else {
    $querylang = "";
}
$content = "<table>";
$sql = "SELECT sid, title, time, comments, counter FROM ".$prefix."_stories $querylang ORDER BY sid DESC LIMIT 0,5";
$result = $db->sql_query($sql);
while (list($sid, $title, $time,  $comments, $counter) = $db->sql_fetchrow($result)) {
   
    $Y = substr($time, 0, 4);
   $M = substr($time, 5, 2);
   $D = substr($time, 8, 2);
   
   $time = $D."-".$M."-".$Y;
      
    $title = stripslashes($title);
   $content .= "<tr><td>";
   $content .= "</td><td>";
    $content .= "<strong><big>·</big></strong>";
    $content .= " <a>$title</a>";
    $content .= "</td><td>";
    $content .= "$time";
   $content .= "</td><td>";
    $content .= "</td></tr>";
   
   
   

}
$content .= "</table>";

?>


Maar wanneer ik er nog een tabel bijvoeg;

Code:
if ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}

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

if ($multilingual == 1) {
    $querylang = "WHERE (alanguage='$currentlang' OR alanguage='')";
} else {
    $querylang = "";
}
$content = "<table>";
$sql = "SELECT sid, title, time, comments, counter FROM ".$prefix."_stories $querylang ORDER BY sid DESC LIMIT 0,5";
$result = $db->sql_query($sql);
while (list($sid, $title, $time,  $comments, $counter) = $db->sql_fetchrow($result)) {
   
    $Y = substr($time, 0, 4);
   $M = substr($time, 5, 2);
   $D = substr($time, 8, 2);
   
   $time = $D."-".$M."-".$Y;
      
    $title = stripslashes($title);
   $content .= "<tr><td><table><td>";
   $content .= "</td><td>";
    $content .= "<strong><big>·</big></strong>";
    $content .= " <a>$title</a>";
    $content .= "</td><td>";
    $content .= "$time";
   $content .= "</td><td>";
    $content .= "</td></tr></table></td></tr></table><table><tr><td>";
   $content .= "</td><td>";
    $content .= "</td><td>";
    $content .= "</td></tr>";
   
   
   

}
$content .= "</table>";

?>


Werkt het block niet meer.
Iemand een idee wat er mis gaat?
View user's profileSend private message
Display posts from previous:      
 Donaties   Adverteren 
Wilt u het forum steunen, dan kunt u nu eenvoudig doneren met PayPal.
Post new topicReply to topic
View previous topic Log in to check your private messages View next 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



Powered by phpBB © 2001, 2005 phpBB Group

Web site powered by PHP-Nuke

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest © 2004-2008 by BlueLion.
SEO enhanced with the Sitemapper script
You can syndicate our news using the file backend.php or ultramode.txt
Powered by PHP Powered by MySQL Apache Webserver Valid robots.txt
PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Pagina rendering: 0.15 seconden


[Valid News RSS]

RSS Feeds:
[RSS 2.0 News Feed]
[RSS 2.0 Download Feed]
[RSS 2.0 Forum Feed]
[RSS 2.0 Link Feed]
:: fisubsilver shadow phpbb2 style by Daz :: PHP-Nuke theme by BlueLion ::