Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 10-19-2010, 07:35 PM HELP NEEDED! please
Junior Talker

Posts: 2
Name: Mitch Gams
Trades: 0
So today ive attempted to create a page data handler for my new photography website system.
In on of my files in my project first calls these things:
PHP Code:
require_once("./config.php");
function 
check_content_status(){
    
$fetch = new fetchPageActions;
    
$main = new main_content_class;
    
$pg = isset($_GET["page"])? $_GET["page"]: 1;
    
$pga = isset($_GET["pageAction"])? $_GET["pageAction"]:"";
    
$fetchCount count($fetch->fetchPage);
    
$fetchIfs "";
    
$fetchAntiIfs "";
    
$find true;
    for(
$i=0$fetchCount>$i$i++) {
        if(
$pga==$fetch->fetchPage[$i]) {
            
$main->findPageData($fetch->fetchPgID[$pga]);
            
$find false;
        } else if(
$find && $pga!=$fetch->fetchPage[$i]) {
            if(
$i+1==$fetchCount) {
                
$main->findPageData($pg);
            }
        }
    }
}
$main = new main_content_class;
$main->getLinkData();
check_content_status();
$main->fetchPage($main->pageNumber$main->type$main->pageName$main->doSideBar); 
and when these things are called, its supposed to include another file adding some content to my website but it doesnt work.. I tweaked one small thing and it stopped working. I cant figure out what it is but maybe a fresh view will solve the mystery.. OH! and here is my main_content_class:
PHP Code:
class main_content_class {

    
/////////////////////////////////
    ////    Page content        ////
    ///////////////////////////////
    
    
public $pageName;
    public 
$pageNumber;
    public 
$date;
    public 
$data;
    public 
$status;
    public 
$doSideBar false;
    public 
$dos true;
    public 
$i 0;
    public 
$type;
    public 
$redirectCode;
    function 
findPageData($pgID) {
        if(empty(
$pgID)){
            
$pgID 1;
        }
        if(!
is_numeric($pgID)){
            die(
"page doesn't exist!");
        }
        
$ck mysql_query("SELECT * FROM mainContent WHERE page_id=".$pgID."");
        while(
$row mysql_fetch_array($ck)){
            
$this->i++;
        }
        if(
$this->== 0){
            die(
"page doesn't exist!");
        }else if(
$this->== 1){
            
$misc = new misc;
            
$get mysql_query("SELECT * FROM mainContent WHERE page_id='".$pgID."'") or die(mysql_error());
            while(
$row mysql_fetch_array($get)){
                
$this->pageName $row['name'];
                
$this->pageNumber $row['page_id'];
                
$this->date $row['date'];
                
$this->data $misc->bbcode($row['data']);
                
$this->status $row['show_status'];
                
$this->type $row['type'];
                
//////////////SIDE BAR/////////////////
                
if($row['show_side_bar'] == 'true'){ 
                    
$this->doSideBar true;
                } else if(
$row['show_side_bar'] == 'false') {
                    
$this->doSideBar false;
                }
                
/////////////END SIDE BAR//////////////
                
                ///redirection fixes below
                
if($this->type == "doregister") {
                    
$register = new register_class($_POST['username'], $_POST['pass'], $_POST['pass2'], $_POST['email'], $_POST['fname'],
                        
$_POST['lname'], $_POST['phone1'], $_POST['phone2'], $_POST['address1'], $_POST['address2'],
                        
$_POST['state'], $_POST['city'], $_POST['zip']);
                    
$this->redirectCode "doregister";
                }
            }
        }
    }
    function 
fetchPage($pid$ptype$pname$doSB) {
        require_once(
"./include/templates/loader.php");
        
$load = new load_templates;
    
    
///////////////////SIDE BAR OUTPUT//////////////////////
        
if($doSB == true) {
            
$this->startSidebar("<div id='sidebar'>""</div>""<h1>""</h1>""<div class='left-box'><ul class='sidemenu'>""</ul></div>""<li>""</li>");
        }
    
////////////////// PAGE DATA OUTPUT ///////////////////
        
if($ptype == "cpedits"){
            require_once(
$load->skinDir."pages/".$load->doPage[$this->type]);
            include(
"./include/templates/main_template/pages/cpedits.php");
        } else if(
$ptype == "login"){
            require_once(
$load->skinDir."pages/".$load->doPage[$this->type]);
        } else if(
$ptype == "register"){
            require_once(
$load->skinDir."pages/".$load->doPage[$this->type]);
        } else if(
$ptype == "reqnewpass"){
            require_once(
$load->skinDir."pages/".$load->doPage[$this->type]);
        } else if(
$ptype == "doregister"){
                    
//if(!isset($_POST['username'])) { 
                    //    $fetch = new fetchPageActions;
                        //die("index.php?pageAction=register");
                    //}
        
}
    
    }
    
    function 
doesnotexist(){
        
$this->pageName "does not exist";
    }
    
//////////////////////////////////
    ////        Side Bar        /////
    ////////////////////////////////
    
public $n 0;
    function 
startSidebar($boxStart$boxEnd$titleStart$titleEnd$containerStart$containerEnd$linkStart$linkEnd) {
    
//require_once './config.php';
    //$mysql = new mysql_class("localhost", "root", "root", "gal");
            
echo $boxStart;
        
$load = new load_templates;
        
$sql "SELECT * FROM nav_bar WHERE parent='true' order by parent_id";
        
$get mysql_query($sql) or die(mysql_error() . '<br />'$query2);
        
$i 0;
        while(
$row mysql_fetch_array($get)) {
            
$parent_id[$i] = $row['parent_id'];
            
$parent_name[$i] = $row['text'];
            
$i++;
        }
        
$parentc count($parent_id);
        for(
$r=0$parentc $r$r++) {
            
#### Parent Title ####
            
echo $titleStart."".$parent_name[$r]."".$titleEnd;
            
#### Container Start ####
            
echo $containerStart;
            
$sql "SELECT * FROM nav_bar WHERE parent='false' AND parent_id='".$parent_id[$r]."' order by lorder";
            
$get mysql_query($sql) or die(mysql_error() . '<br />'$query2);
            while(
$row mysql_fetch_array($get)) {
                echo 
$linkStart."<a href='".$row['link']."'>".$row['text']."</a>".$linkEnd;
            }
            
#### Container End
            
echo $containerEnd;
        }
                    echo 
$boxEnd;
    }
    
    
    
//////////////////////////////////
    ////    Header Link data    /////
    ////////////////////////////////

    
public $title = array();
    public 
$link = array();
    public 
$pg_num = array();
    public 
$getHeaderLinks "";
    function 
getLinkData(){
        
$get mysql_query("SELECT * FROM head_links"); //id="current"
        
while($row mysql_fetch_array($get)) {
            
$this->title[$this->i] = $row['name'];
            
$this->link[$this->i] = $row['link'];
            
$this->pg_num[$this->i] = $row['page_id'];
            
$this->i++;
        }
        
$count count($this->title) - 1;
        
$this->0;
        while(
$count >= $this->i) {
            isset(
$this->links)? $this->links " ";
            isset(
$this->title)? $this->title " ";
            
$this->getHeaderLinks $this->getHeaderLinks." <li ".$this->isCurrent($this->pg_num[$this->i])."><a href='".$this->link[$this->i]."'><span>".$this->title[$this->i]."</span></a></li>";
            
$this->i++;
        }
    }
    function 
isCurrent($id) {
        if(isset(
$_GET['pageAction'])) {
            
$pga = isset($_GET["pageAction"])? $_GET["pageAction"]:"";
            
$action = array("login"=>"15","register"=>"16","gallery"=>"17","portfolio"=>"18","changepass"=>"19","reqnewpass"=>"20");
            if((
$pga=="login") || ($pga=="register") || ($pga=="gallery") || ($pga=="portfolio") || ($pga=="changepass") || ($pga=="reqnewpass")) {
                if(
$id==$action[$pga]) {
                    return 
'id="current"';
                }
            }
        } else if(isset(
$_GET['page'])) {
            
$pg = isset($_GET['page'])? $_GET['page']:"";
            if(empty(
$pg)){
                
$pg 1;
            }
            if(
$id==$pg){
                return 
'id="current"';
            }
        } else if(!isset(
$_GET['page']) AND !isset($_GET['pageAction']) AND $id==1) {
            return 
'id="current"';
        }
    }
    

    
    

msgphp is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-19-2010, 08:02 PM Re: HELP NEEDED! please
Skilled Talker

Posts: 52
Trades: 0
Hi,

You should enable error reporting, and paste here the errors.

TO enable error reporting you can add this piece of function:

error_reporting(E_ALL);

....at the start of your php code just after <? ...

See You Soon!
webmastertalker is offline
Reply With Quote
View Public Profile
 
Old 10-20-2010, 05:01 AM Re: HELP NEEDED! please
Junior Talker

Posts: 2
Trades: 0
oh! thank pal!
topstarclub is offline
Reply With Quote
View Public Profile
 
Old 10-20-2010, 05:39 AM Php Code Issue
Skilled Talker

Posts: 52
Trades: 0
Quote:
Originally Posted by topstarclub View Post
oh! thank pal!
You're welcome, and note this kind of php issue is very common so keep it in mind, if you don't see any error on page but the code isn't working "almost always" :

1. You don't have anything to show up..
2. or probably You're php server isn't enable to show up errors...

Good Luck if do you have other php issues just open a dedicated thread...
webmastertalker is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to HELP NEEDED! please
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.14642 seconds with 12 queries