Page 2 of 2

Re: Sticky Data

Posted: Thu Dec 23, 2010 1:33 pm
by jzmwebdevelopment
OK now I feel like an egg I forgot to remove exit;

I have the following errors:

Notice: Undefined variable: sOutput in /home/devnoo/public_html/Nyken/Admin/includes/class/class.navigation.php on line 15 = $sOutput .= ''."\n";

but I have not touched the above files

Notice: Undefined variable: Message in /home/devnoo/public_html/Nyken/Admin/editpage.php on line 75 = echo $Message - witch is set as the error success message within the if valid.

Any Ideas?

Re: Sticky Data

Posted: Thu Dec 23, 2010 1:44 pm
by ccsdg
lots of things happening Jess :)

1. Did the exit; solve your problem of your form not appearing? is it appearing yet?
2. $sOutput: It may not be a problem in the class itself but a problem in a variable you passed to the class. You'd want to check what the value of the $sOutput was before line 15, and work your way backwards until you see something obvious.
3. where does $message get its info from immediately before it's called? As with $sOutput you want to work backwards from 75.

kinda hard to know where we are in your code so this might not be the right solution.

Re: Sticky Data

Posted: Thu Dec 23, 2010 2:03 pm
by jzmwebdevelopment
ccsdg wrote:lots of things happening Jess :)

1. Did the exit; solve your problem of your form not appearing? is it appearing yet?
2. $sOutput: It may not be a problem in the class itself but a problem in a variable you passed to the class. You'd want to check what the value of the $sOutput was before line 15, and work your way backwards until you see something obvious.
3. where does $message get its info from immediately before it's called? As with $sOutput you want to work backwards from 75.

kinda hard to know where we are in your code so this might not be the right solution.
1. Appearing

2. Nothing that I can spot

Code: Select all


include ('class.pageManager.php');

class Navigation{

	public function mainMenu(){
	
		$pageManager = new PageManager();
		
		$aAllPages = $pageManager->getAllPages();
		
		$sOutput .= ''."\n";

3.

Code: Select all


    
    if($formEdit->getValid() == true){
        
            $EditedPage->setPageName = $database->escape_value($_POST["Name"]);
                
            $EditedPage->setPageContent = $database->escape_value($_POST["PageContent"]);
                
           $EditedPage->savePage();
        
        $Message = "Page Updated";
        
    }else{
        
        $Message = "You Have An Error Mate";
    }
}



Re: Sticky Data

Posted: Thu Dec 23, 2010 2:26 pm
by ccsdg
1. Great :)

2.

Code: Select all

$sOutput .= ''."\n";
the operator .= means "take the original value of the LEFT side, before this current line, and add the RIGHT side to itself." What do you think the original value of $sOutput was before this current line?

3. I looked at your original code. If you go one block bigger, you go to an isset($_POST['submit']) block. Try running mentally through your code if you loaded the page the first time (with no $_POST). Do you think $Message would exist in that case?

Re: Sticky Data

Posted: Thu Dec 23, 2010 4:25 pm
by jzmwebdevelopment
ccsdg wrote:1. Great :)

2.

Code: Select all

$sOutput .= ''."\n";
the operator .= means "take the original value of the LEFT side, before this current line, and add the RIGHT side to itself." What do you think the original value of $sOutput was before this current line?

3. I looked at your original code. If you go one block bigger, you go to an isset($_POST['submit']) block. Try running mentally through your code if you loaded the page the first time (with no $_POST). Do you think $Message would exist in that case?
2. I am unsure

3. No because nothing is being submited

Re: Sticky Data

Posted: Thu Dec 23, 2010 4:36 pm
by ccsdg
$sOutput:

Code: Select all

 public function mainMenu(){
        
                $pageManager = new PageManager();
                
                $aAllPages = $pageManager->getAllPages();
                
                $sOutput .= ''."\n";
You would want to EITHER change the .= to a =, OR declare $sOutput = "something" (or = null, at least) so that the next line (.=) can have something to 'add to'. It looks like you were trying to put a fullstop after something, but you haven't declared that something. Alternatively, maybe you really just wanted a dot and a new line and it wasn't supposed to be after anything. Either are acceptable.

$Message:
Yep. That's where your error is coming from. One thing you could do is make sure the page without $_POST and the page with $_POST have a variable $Message. For the page without $_POST this would be an empty string, and for the page with $_POST you would modify that variable to one of the error messages you mentioned.

HTH

Re: Sticky Data

Posted: Thu Dec 23, 2010 8:12 pm
by jzmwebdevelopment
$sOutput = Fixed

$Message: = It is the same page

Code:

Code: Select all


        $Message = "Page Updated";
        
    }else{
        
        $Message = "You Have An Error Mate";
    }
}


$formEdit->openFieldset();
$formEdit->makeInputBox("Name","Name","CheckInput(this.id);");
$formEdit->makeTextArea("Content", "PageContent", "20","70", "CheckInput(this.id);");
$formEdit->makeSubmitButton("submit","Edit Page");
$formEdit->closeFieldset();

$newNavigation = new Navigation();


?>

     <?php echo $newNavigation->mainMenu();?>

    <h1  class="Heading">Edit Page</h1>
    
    <?php echo $Message ?>