Aureole Posted October 13, 2007 Share Posted October 13, 2007 Ok for some reason it appears that you can't use classes/functions after including a file... A lot of code but just look at the comments... <?php session_start(); require_once('functions.swr3'); require_once('config.swr3'); require_once('classes/class_database.swr3'); require_once('classes/class_member.swr3'); $swr3->database = new database; $swr3->member = new member; $swr3->database->connect(); // If I try doing a simple num rows here it would work, e.g. : // $swr3->database->simple_num_rows('members'); // $database->output->member_count = $swr3->database->output; // print $database->output->member_count; // That would work fine... $swr3->member->is_logged_in(); $member->output->is_logged_in = $swr3->member->output; $swr3->member->is_supermoderator(); $member->output->is_supermoderator = $swr3->member->output; $swr3->member->is_administrator(); $member->output->is_administrator = $swr3->member->output; if(SYSTEM_OFFLINE == 1) { if($member->output->is_logged_in !== 1 || $member->output->is_supermoderator !== 1 || $member->output->is_administrator !== 1) { header('Location: offline.swr3'); } } if(SYSTEM_SHOW_PHP_ERRORS == 1) { error_reporting(E_ALL); } if($member->output->is_logged_in == 1) { // Ignore these comments and go on down to the next comment. //$swr3->member->last_action(); //$swr3->member->current_page('viewing the '.$html->output->page_title.''); } switch($_GET['act']) { case 'main'; main(); break; case 'members'; members_and_groups(); break; case 'forums'; cats_and_forums(); break; case 'stats'; stats(); break; case 'logs'; logs(); break; case 'settings'; settings_and_tools(); break; default: main(); break; } // All my functions here go here... I missed a few out, just skip on down to the next comment. <?php } function cats_and_forums() { $pagetitle = 'ACP - Forums & Categories'; include_once('inc/header.swr3'); echo '<div id="breadcrumbs"><p class="breadcrumbs"><a href="index.swr3" class="forum_title_a" title="Go to the Homepage.">'.SITE_TITLE.'</a> > ACP > Forums & Categories</p></div>'; echo '<div class="clearfix"><!--No Content--></div>'; ?> <div class="leftcolumn"> <?php if($_GET['do'] == 'createcat') { // And the next line is my problem... // The error I get is call to a member function on a non object. $swr3->database->simple_num_rows('categories'); $database->output->cat_count = $swr3->database->output; $next_cat = $database->output->cat_count + 1; ?> <div class="con_2_outer"> <div class="con_2_title"><h1>Create a Category</h1></div> <div class="con_2_inner_nopad"> <form name="createcat" id="createcat" method="post" action="admin/createcat.swr3?nextcat=<?php echo $next_cat; ?>"> <div style="width:200px;height:34px;line-height:34px;text-align:center;background:#000000;float:left;"><h3>Category Name</h3></div> <div style="width:456px;padding:6px;height:16px;background:#242424;float:left;border-top:4px solid #000000;border-bottom:2px solid #000000;border-right:4px solid #000000;"> <p class="content"><input type="text" id="catname" name="catname" class="fasttopictitle" tabindex="1" /></p> </div> <div style="width:200px;height:34px;line-height:34px;text-align:center;background:#000000;float:left;"><h3>Show Category</h3></div> <div style="width:456px;padding:6px;height:16px;background:#242424;float:left;border-top:4px solid #000000;border-bottom:2px solid #000000;border-right:4px solid #000000;"> <p class="content"><input type="text" id="catname" name="catname" class="fasttopictitle" tabindex="1" /> (Yes or No)</p> </div> <div class="clearfix"></div> <div style="width:672px;padding:6px 0px 6px 0px;background:#000000;text-align:center;" align="center"> <input type="submit" value="Create Category" class="submit" tabindex="3" /> </div> <input type="hidden" id="sent" name="sent" value="sent" /> </form> </div> </div> <?php } elseif($_GET['do'] == 'managecats') { ?> <div class="con_2_outer"> <div class="con_2_title"><h1>Manage Categories</h1></div> <div class="con_2_inner"> <p class="content"></p> </div> </div> <?php } elseif($_GET['do'] == 'createforum') { ?> <div class="con_2_outer"> <div class="con_2_title"><h1>Create a Forum</h1></div> <div class="con_2_inner"> <p class="content"></p> </div> </div> <?php } elseif($_GET['do'] == 'manageforums') { ?> <div class="con_2_outer"> <div class="con_2_title"><h1>Manage Forums</h1></div> <div class="con_2_inner"> <p class="content"></p> </div> </div> <?php } else { ?> <div class="con_2_outer"> <div class="con_2_title"><h1>...</h1></div> <div class="con_2_inner"> <p class="content">Choose an option from the right.</p> </div> </div> <?php } ?> </div> <div class="rightcolumn"> <div id="menu_outer"> <div id="menu_inner"> <div class="menu_title">ACP Sections</div> <div class="menu_item"><a href="admin.swr3" class="menu_item_a" title="">Main</a></div> <div class="menu_item"><a href="admin.swr3?act=members" class="menu_item_a" title="">Members & Groups</a></div> <div class="menu_item"><a href="admin.swr3?act=forums" class="menu_item_a" title="">Categories & Forums</a></div> <div class="menu_item"><a href="admin.swr3?act=stats" class="menu_item_a" title="">Statistics</a></div> <div class="menu_item"><a href="admin.swr3?act=logs" class="menu_item_a" title="">Logs</a></div> <div class="menu_item"><a href="admin.swr3?act=settings" class="menu_item_a" title="">Settings & Tools</a></div> <div class="menu_item"><a href="admin.swr3?act=bugs" class="menu_item_a" title=""></a></div> <div class="menu_title">Categories & Forums</div> <div class="menu_item"><a href="admin.swr3?act=forums&do=createcat" class="menu_item_a" title="">Create a Category</a></div> <div class="menu_item"><a href="admin.swr3?act=forums&do=managecats" class="menu_item_a" title="">Manage Categories</a></div> <div class="menu_item"><a href="admin.swr3?act=forums&do=createforum" class="menu_item_a" title="">Create a Forum</a></div> <div class="menu_item"><a href="admin.swr3?act=forums&do=manageforums" class="menu_item_a" title="">Manage Forums</a></div> </div> </div> </div> <?php } ?> ??? Quote Link to comment https://forums.phpfreaks.com/topic/73123-gah-what-the-hell/ Share on other sites More sharing options...
trq Posted October 13, 2007 Share Posted October 13, 2007 Your still using that $swr3 object for no apparent reason. Why make your code more convoluted than it need be? Its ridiculous. What is your exact error? Quote Link to comment https://forums.phpfreaks.com/topic/73123-gah-what-the-hell/#findComment-368841 Share on other sites More sharing options...
RichardRotterdam Posted October 14, 2007 Share Posted October 14, 2007 Indeed that swr3 object looks stupid. Why not just but your objects in normal variables like so $database = new database; $member = new member; that saves you a lot of hair pulling later on for further development Quote Link to comment https://forums.phpfreaks.com/topic/73123-gah-what-the-hell/#findComment-369164 Share on other sites More sharing options...
Aureole Posted October 14, 2007 Author Share Posted October 14, 2007 I have done now, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/73123-gah-what-the-hell/#findComment-369423 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.