Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP
Author Message
spasticdonkey
RavenNuke(tm) Development Team



Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA

PostPosted: Mon Mar 23, 2009 6:33 pm Reply with quote

Been toying with fixing a minor glitch in a module, and can't quite seem to get it. The module lets you create and categorize documents, and it creates a wiki-style menu on the fly. Works great except for if you have any more than 9 documents in a catagory, then the order gets jumbled...

Well here's the function in question, and the glitch has to be in how the documents are ordered in the menu part of the code. Here's a Only registered users can see links on this board! Get registered or login! if interested.

Code:
function show_doc($id)

{
 
  global $prefix, $db, $sitename, $admin, $module_name, $admin_file;
 
  include_once("header.php");
  OpenTable();
  $id = intval($id);
  $result = $db->sql_query("SELECT * FROM ".$prefix."_docs WHERE id='$id'");
  $mypage = $db->sql_fetchrow($result);
  $myactive = intval($mypage['active']);
  $mytitle = stripslashes(check_html($mypage['title'], "nohtml"));
  $mysubtitle = stripslashes(check_html($mypage['subtitle'], "nohtml"));
  $mytext = stripslashes($mypage['text']);
  $mydate = $mypage['date'];
  $mycounter = intval($mypage['counter']);
 
  if ($db->sql_numrows() == 0 || ( ($myactive == 0) AND ( !is_admin($admin) ) ) )
  {
    echo "Sorry... This page doesn't exist.";
  }
  else
  {
    $stack = array();
    echo '<table width="100%">
      <tr>
        <td>';
    echo "
    <div style='float:right; width:30%; margin: 0 0 1em 1em;'>
    <table width='100%' style='border: 1px solid black; dodding:8px;'><tr><td valign='top'>";
    $catId = $GLOBALS['catId'] = intval($mypage['cat']);
    $i = 0;
    $menu = getRecursive(0, $catId, -1);
    $cnt = 0;
    $current = '';
    $get_next = false;
    $next_page = '';
    foreach ($menu as $item)
    {
      $appnd = '';
      if ($item['parent'] != 0)
      {
        $cnt++;
        $appnd = '-'.$cnt;
      }
      else
      {
        $cnt = 0;
        $i++;
      }
     
      if ($get_next)
      {
        $next_page = $item['id'];
        $get_next = false;
      }
     
      if ($item['id'] == $id)
      {
        echo "<div style='margin-left:".($item['level'] * 8)."px;'><strong>".$i.$appnd.".&nbsp;&nbsp;".$item['title']."</strong></div>";
        $current = $item['id'];
        $get_next = true;
        $currents_parent = $item['parent'];
      }
      else
      {
        echo '<div style="margin-left:'.($item['level'] * 8).'px;"><a href="modules.php?name=Docs&do=show_doc&id='.$item['id'].'" title="">'.$i.$appnd.'.&nbsp;&nbsp;'.$item['title'].'</a></div>';
      }
     
    }
   
    echo '
    </td>
    </tr>
    </table>
    </div>
    ';// end of menu block
   
    echo '<div class="title">'.$mytitle.'</div>';
    if (!empty($mysubtitle))
    {
      echo "\n<span class=\"tiny\"><em>&nbsp;&nbsp;&nbsp;&nbsp;$mysubtitle</em></span><br /><br />";
    }
    echo "<div>$mytext</div><br /><br />";
    if (!is_admin($admin)) $db->sql_query("UPDATE ".$prefix."_docs SET counter=counter+1 WHERE id='$id'");
   
    $sqlp = "SELECT id FROM ".$prefix."_docs WHERE id='$currents_parent' LIMIT 1";
    $resultp = $db->sql_query($sqlp);
    list($prev) = $db->sql_fetchrow($resultp);
   
   
    echo '</td>
      </tr>
    </table>
    <br />
    <div style="float:left; width: 70%;"><br />
      <div style="float:left;">'.( (!empty($prev)) ? '<a href="modules.php?name=Docs&do=show_doc&id='.$prev.'"><img src="images/left.gif" alt="" /> <strong>Previous</strong></a>' : '').'</div>
      <div style="float:right;">'.( (!empty($next_page)) ? '<a href="modules.php?name=Docs&do=show_doc&id='.$next_page.'"><strong>Next</strong> <img src="images/right.gif" alt="" /></a>' : '').'</div>
      <div align="center"><a href="modules.php?name=Docs"><strong>Home</strong></a></div>
    </div>
    <div style="float:right; width: 30%;">
    <div align="right"><span class="tiny">Last Updated: '.$mydate.' ('.$mycounter.' views)</span></div>
   
    ';
   
    if (is_admin($admin))
    {
      echo '
        <div align="right">
        [
        <a href="modules.php?name='.$module_name.'&amp;do=show_doc&amp;id='.$id.'&amp;edit_doc='.$id.'">Edit</a> |
        <a href="'.$admin_file.'.php?op=docs_delete&amp;id='.$id.'&amp;ok=0">Delete</a> |
        <a href="'.$admin_file.'.php?op=docs_change_status&amp;id='.$id.'&amp;active='.($myactive == 1 ? 1 : 0).'">'.($myactive == 1 ? 'Deactivate' : 'Activate').'</a>
        ]
        </div>
      ';
    }
  }
 
  CloseTable();
 
  include_once("footer.php");
}
 
View user's profile Send private message Visit poster's website
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Fri Apr 03, 2009 5:25 pm Reply with quote

spasticdonkey, did you ever get this issue sorted out?

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
spasticdonkey







PostPosted: Sat Apr 04, 2009 8:45 am Reply with quote

no i gave it several attempts, but to no avail.. not familiar enough with everything that is being done there w/ php. The author has been buzy and thought that maybe it might be an easy fix... Here's the module download, the site was down when I orginally posted.. http://nukecoder.com/shop_item-12.html
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP

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 ©