Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Blocks
Author Message
ibonic
Hangin' Around



Joined: Aug 12, 2009
Posts: 25

PostPosted: Mon Nov 16, 2009 8:45 am Reply with quote

This is a scrolling block that shows the weblinks, it works great in Php-nuke, but when I tried to install it in RavenNuke it doesnt work, I was hoping someone would know how to convert this to work in RavenNuke.


Code:


<?php

/************************************************************************/
/* Advanced Links Block                                             */
/* ===========================                                          */
/*                                                                      */
/* This is basically just an edit of the original block by Francisco.   */
/* Even though this is heavly edited, I think he deserves credit, so:   */
/*                                                                      */
/* 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.       */
/************************************************************************/
/*                                                                      */
/* Copyright © 2002 by Michael Bacoz                                    */
/* http://www.fatal-instinct.com                                        */
/*                                                                      */
/************************************************************************/

/************************/
/*      Variables       */
/************************/

$downloadstoshow = 5;
$usemarquee = 1;
$scrolldirection = "Up";

$most = "Most Hits";
$latest = "Latest Links";
$totalfiles = "Total Links";
$totalcategories = "Total Categories";
$totaldownloads = "Total Hits";
$hitstext = "Hits";

/************************/
/*     End Variables    */
/************************/

// Make sure people don't try and access it directly
if (eregi("block-Advanced_Links.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}

global $prefix, $dbi;

// Total Files
$result = sql_query("select * from ".$prefix."_links_links", $dbi);
$files = sql_num_rows($result, $dbi);

// Total Categories
$result = sql_query("select * from ".$prefix."_links_categories", $dbi);
$cats = sql_num_rows($result, $dbi);

// Total Downloads
$result = sql_query("select hits from ".$prefix."_links_links", $dbi);

$a = 1;
while(list($hits) = sql_fetch_row($result, $dbi)) {
     $total_hits = $total_hits + $hits;
      $a++;
}

$content .= "$totalfiles: $files<br>$totalcategories: $cats<br> $totaldownloads: $total_hits<br>";
 
if ($usemarquee == 1) {
   $content .= "<Marquee Behavior=\"Scroll\" Direction=\"$scrolldirection\" Height=\"140\" ScrollAmount=\"2\" ScrollDelay=\"100\" onMouseOver=\"this.stop()\" onMouseOut=\"this.start()\"><br>";
}

// Latest added
$content .= $latest."<br>";
$a = 1;
$result = sql_query("select lid, title, hits from ".$prefix."_links_links order by date DESC limit 0,$downloadstoshow", $dbi);

while(list($lid, $title, $hits) = sql_fetch_row($result, $dbi)) {
      $title2 = ereg_replace("_", " ", $title);
      
     $content .= "<strong><big>&middot;</big></strong>&nbsp;$a: <a href=\"viewlink-.html$lid\">$title2</a><br>[$hitstext: $hits]<br><br>";
      $a++;
}

// Most downloaded
$content .= "<br>".$most."<br>";
$a = 1;
$result = sql_query("select lid, title, hits from ".$prefix."_links_links order by hits DESC limit 0,$downloadstoshow", $dbi);

while(list($lid, $title, $hits) = sql_fetch_row($result, $dbi)) {
    $title2 = ereg_replace("_", " ", $title);
    $content .= "<strong><big>&middot;</big></strong>&nbsp;$a: <a href=\"viewlink-.html$lid\">$title2</a><br>[$hitstext: $hits]<br><br>";
    $a++;
}

?>


Thank you

*** Edited by Palbin to put code in code tags.
 
View user's profile Send private message Visit poster's website
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Mon Nov 16, 2009 9:08 am Reply with quote

Read this topic and see if you can get the block to work. If you still need help after reading let us know.
[ Only registered users can see links on this board! Get registered or login! ]

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
hicuxunicorniobestbuildpc
The Mouse Is Extension Of Arm



Joined: Aug 13, 2009
Posts: 1122

PostPosted: Mon Nov 16, 2009 7:03 pm Reply with quote

Here it is my convertion. I didnt test it yet but you can do it and let me know

Code:
<?php


/************************************************************************/
/* Advanced Links Block                                             */
/* ===========================                                          */
/*                                                                      */
/* This is basically just an edit of the original block by Francisco.   */
/* Even though this is heavly edited, I think he deserves credit, so:   */
/*                                                                      */
/* 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.       */
/************************************************************************/
/*                                                                      */
/* Copyright © 2002 by Michael Bacoz                                    */
/* http://www.fatal-instinct.com                                        */
/*                                                                      */
/************************************************************************/

/************************/
/*      Variables       */
/************************/

$downloadstoshow = 5;
$usemarquee = 1;
$scrolldirection = "Up";

$most = "Most Hits";
$latest = "Latest Links";
$totalfiles = "Total Links";
$totalcategories = "Total Categories";
$totaldownloads = "Total Hits";
$hitstext = "Hits";

/************************/
/*     End Variables    */
/************************/

// Make sure people don't try and access it directly
if ( !defined('BLOCK_FILE') ) {
   Header('Location: ../index.php');
   die();
}

global $prefix, $db;

// Total Files
$result = $db->sql_query("select * from ".$prefix."_links_links");
$files = $db->sql_numrows($result);

// Total Categories
$result = $db->sql_query("select * from ".$prefix."_links_categories");
$cats = $db->sql_numrows($result);

// Total Downloads
$result = $db->sql_query("select hits from ".$prefix."_links_links");

$a = 1;
while(list($hits) = $db->sql_fetchrow($result)) {
     $total_hits = $total_hits + $hits;
      $a++;
}

$content .= "$totalfiles: $files<br>$totalcategories: $cats<br> $totaldownloads: $total_hits<br>";

if ($usemarquee == 1) {
   $content .= "<Marquee Behavior=\"Scroll\" Direction=\"$scrolldirection\" Height=\"140\" ScrollAmount=\"2\" ScrollDelay=\"100\" onMouseOver=\"this.stop()\" onMouseOut=\"this.start()\"><br>";
}

// Latest added
$content .= $latest."<br>";
$a = 1;
$result = $db->sql_query("select lid, title, hits from ".$prefix."_links_links order by date DESC limit 0,$downloadstoshow");

while(list($lid, $title, $hits) = $db->sql_fetchrow($result)) {
      $title2 = ereg_replace("_", " ", $title);
       
     $content .= "<strong><big>&middot;</big></strong>&nbsp;$a: <a href=\"viewlink-.html$lid\">$title2</a><br>[$hitstext: $hits]<br><br>";
      $a++;
}

// Most downloaded
$content .= "<br>".$most."<br>";
$a = 1;
$result = $db->sql_query("select lid, title, hits from ".$prefix."_links_links order by hits DESC limit 0,$downloadstoshow");

while(list($lid, $title, $hits) = $db->sql_fetchrow($result)) {
    $title2 = ereg_replace("_", " ", $title);
    $content .= "<strong><big>&middot;</big></strong>&nbsp;$a: <a href=\"viewlink-.html$lid\">$title2</a><br>[$hitstext: $hits]<br><br>";
    $a++;
}

?>
 
View user's profile Send private message
ibonic







PostPosted: Mon Nov 16, 2009 10:11 pm Reply with quote

Hi unicornio, I tried it, changed one thing and now its works heres the complete working code, thank you very much for your help:

Code:
 

<?php

/************************************************************************/
/* Advanced Links Block                                             */
/* ===========================                                          */
/*                                                                      */
/* This is basically just an edit of the original block by Francisco.   */
/* Even though this is heavly edited, I think he deserves credit, so:   */
/*                                                                      */
/* 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.       */
/************************************************************************/
/*                                                                      */
/* Copyright © 2002 by Michael Bacoz                                    */
/* http://www.fatal-instinct.com                                        */
/*                                                                      */
/************************************************************************/

/************************/
/*      Variables       */
/************************/

$downloadstoshow = 5;
$usemarquee = 1;
$scrolldirection = "Up";

$most = "Most Hits";
$latest = "Latest Links";
$totalfiles = "Total Links";
$totalcategories = "Total Categories";
$totaldownloads = "Total Hits";
$hitstext = "Hits";

/************************/
/*     End Variables    */
/************************/

// Make sure people don't try and access it directly
if ( !defined('BLOCK_FILE') ) {
   Header('Location: ../index.php');
   die();
}

global $prefix, $db;

// Total Files
$result = $db->sql_query("select * from ".$prefix."_links_links");
$files = $db->sql_numrows($result);

// Total Categories
$result = $db->sql_query("select * from ".$prefix."_links_categories");
$cats = $db->sql_numrows($result);

// Total Downloads
$result = $db->sql_query("select hits from ".$prefix."_links_links");

$a = 1;
while(list($hits) = $db->sql_fetchrow($result)) {
     $total_hits = $total_hits + $hits;
      $a++;
}

$content .= "$totalfiles: $files<br>$totalcategories: $cats<br> $totaldownloads: $total_hits<br>";

if ($usemarquee == 1) {
   $content .= "<Marquee Behavior=\"Scroll\" Direction=\"$scrolldirection\" Height=\"140\" ScrollAmount=\"2\" ScrollDelay=\"100\" onMouseOver=\"this.stop()\" onMouseOut=\"this.start()\"><br>";
}

// Latest added
$content .= $latest."<br>";
$a = 1;
$result = $db->sql_query("select lid, title, hits from ".$prefix."_links_links order by date DESC limit 0,$downloadstoshow");

while(list($lid, $title, $hits) = $db->sql_fetchrow($result)) {
      $title2 = ereg_replace("_", " ", $title);
       
     $content .= "<strong><big>&middot;</big></strong>&nbsp;$a: <a href=\"modules.php?name=Web_Links&l_op=visit&lid=$lid\">$title2</a><br>[$hitstext: $hits]<br><br>";
      $a++;
}

// Most downloaded
$content .= "<br>".$most."<br>";
$a = 1;
$result = $db->sql_query("select lid, title, hits from ".$prefix."_links_links order by hits DESC limit 0,$downloadstoshow");

while(list($lid, $title, $hits) = $db->sql_fetchrow($result)) {
    $title2 = ereg_replace("_", " ", $title);
    $content .= "<strong><big>&middot;</big></strong>&nbsp;$a: <a href=\"modules.php?name=Web_Links&l_op=visit&lid=$lid\">$title2</a><br>[$hitstext: $hits]<br><br>";
    $a++;
}

?>
 
hicuxunicorniobestbuildpc







PostPosted: Tue Nov 17, 2009 5:41 am Reply with quote

I happy you solve your problem. What did u change? Can u specify what u modified. Thanks in advance
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating 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 ©