1
astaldaran
Can you look over
  • 2004/10/9 18:08

  • astaldaran

  • Just popping in

  • Posts: 73

  • Since: 2004/5/9 1


I get an error on a admin page of a module i made. This is my first module and the admin section is giving me trouble. Once i turned on the php debug I get the error

Quote:
Fatal error: Call to a member function on a non-object in /home/tamkin/public_html/redemptionmg/modules/qmagic/admin/index.php on line 102



Line 102 contains
$xoopsTpl->assign('quotes'$quotes);


Here is the entire code(minus begining and end tags and info):

$xoopsOption['template_main'] = 'quote_admin.html';
include (
'admin_header.php');
xoops_cp_header();
$table $xoopsDB->prefix('qmagic');
//check to see if there is a quote to be deleted
    
if (isset($_POST['Delete']))
    {
        
$dindex $_POST['qindex'];
        
$query "DELETE FROM $table WHERE index='$dindex'";
        
$xoopsDB -> query($query);

            
$xoopsTpl->assign('message'_MD_QM_DELETED);
    }
//checks to see if a quote needs approved
    
if (isset($_POST['Approve']))
    {
        
$uindex $_POST['qindex'];
        
$query "UPDATE $table SET $table.approved = '1' WHERE index='$uindex'";

             
$xoopsTpl->assign('message'_MD_QM_APPROVED);

    }
    
//checks to see if a quote needs updated
    
if (isset($_POST['S1']))
    {
        
$uindex $_POST['qindex'];
        
$quote $_POST['S1'];
        
$query "UPDATE $table SET $table.quote = '$quote' WHERE index='$uindex'";

            
$xoopsTpl->assign('message'_MD_QM_UPDATED);

    }
    
    
//gets all the quotes and lines them up with the user names of the submitters

$userdb $xoopsDB->prefix('users');
$query "SELECT $table.qid, $table.quote, $userdb.uname FROM $table$userdb WHERE $table.uid = $userdb.uid AND $table.approved = 0 ORDER by $table.qid desc";
$result $xoopsDB -> query($query);
//$R = mysql_num_rows($result);
$R $xoopsDB -> getRowsNum($result);
           
$i 0;
           while (
$i $R) {
           @
$qaprove=mysql_result($result,$i,"approved");
           @
$qindex=mysql_result($result,$i,"index");
           @
$qcontent=mysql_result($result,$i,"quote");
           @
$quser_name=mysql_result($result,$i,"uname");
            
$quotes $quotes."<table border="1" width="552" height="1">"
            
."<tr>"
            
."<form method="POST" action="">"
            
."<td width="63" height="1"><input type="submit value="_MD_QM_DELETE" name=Delete"></td>"
            
."<input type="hidden" value="$qindex" name="$qindex">"
            
."</form>";
            if (
$qaprove 0)
            {
            
$quotes $quotes."<form method="POST" action="">"
            
."<td width="64"><input type="submit" value="_MD_QM_APPROVE" name="Approve">"
            
."<input type="hidden" value="$qindex" name="$qindex">"
            
."</form>";
            }
            
$quotes $quotes."<td width="160" height="1">"
            
."User:  $quser_name"
            
."</td>"
            
."</tr>"
            
."</table>"
            
."<form method="POST" action="">"
            
."<p><textarea rows="5" name="S1" cols=50" value="$qcontent"></textarea></p>"
            ."
<input type="hidden" value="$qindexname="$qindex">"
            ."
</form>";

           ++
$i;
           }

           
$xoopsTpl->assign('quotes', $quotes);


xoops_cp_footer();


I don't know what the problem is...

2
Anonymous
Re: Can you look over
  • 2004/10/9 18:29

  • Anonymous

  • Posts: 0

  • Since:


I guess it must be this way?

include ('admin_header.php');
xoops_cp_header();
require_once 
XOOPS_ROOT_PATH.'/class/template.php';
if (!isset(
$xoopsTpl)) { 
$xoopsTpl = new XoopsTpl();
}
$xoopsOption['template_main'] = 'quote_admin.html';

3
astaldaran
Re:Can you look over
  • 2004/10/9 19:51

  • astaldaran

  • Just popping in

  • Posts: 73

  • Since: 2004/5/9 1


thanks. That got rid of the error but nothnig showed up. I figured out how not to use the template though for admin, it still looks good though(some of the official modules don't use templetes for admin). I got my model finished. It is a quote module where it chooses a random quote in the database and displays it and who submitted it. It also allows users that are logged in to submit a quote. Then the admin goes to the admin panel and can edit/approve/delete the post.

Login

Who's Online

198 user(s) are online (120 user(s) are browsing Support Forums)


Members: 0


Guests: 198


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits