If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Simple error that I can't find

This is the code that I'm working with right now. I'm missing a bracket somewhere but I'm not really well versed in PHP. Can you help me find it? I've currently got a parse error in line 133 if that helps but I suspect the error is before that point.

If you use this forum's [php]...[/php] tags around your code, it will be much easier to read (I'm assuming you actually indent your code? ).

Anyway, you need one more "}" in your index() method to balance things out. It may just go at the end (as I tried, below, after manually indenting it), but double-check the logic to make sure that's right:

Well thank god that parse error is now gone. Thanks so much!! Too bad I now have a fatal error that I have no idea of what its saying :-(
Fatal error: Cannot access private property Document::$title in /home6/vickysdi/public_html/catalog/controller/account/login.php on line 11
Like I said before... I'm not really familiar with php. I get that this has something to do with public and private classes or whatever but thats about where my understanding ends. Can you walk me through this one or if you know whats wrong, correct it? Thanks again for your help!

// this would doubly not work, since it's private and not static:
$result == ControllerAccountLogin::validate();

However, since the controller's index method is already using validate() itself, one might wonder why anything external to that class would need to call it -- maybe you just need a public "getter" method to grab the $error class variable and check it?

PHP Code:

public function getError()
{
return $this->error;
}

If, on the other hand, it makes sense for the validate() method to be directly accessible, just change its declaration to public -- but keep in mind the OOP concept of encapsulation, making class properties and methods available outside of the class only when necessary (and logical).

"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation

Um... Wow. You spoke complete greek to me ... Soooo... Maybe you overestimated my knowledge in php lol... I have no idea of what you were trying to tell me... sorry!! Any chance you can simply tell me replace this bit of code with this? And from now on I promise not to mess with any more code because apparently I suck at it

Well, at least part of your confusion is due to me seeing things in your second post that weren't there, so it may not be as bad as you think. (I'm not sure where I got the idea that the error message said anything about that validate() method, other than I suppose it was in my mind after looking at the first post.)

The error appears to be about this line:

PHP Code:

$this->document->title = $this->language->get('heading_title');

Without knowing anything about your "document" object, nor now it gets into the class in question in the first place, it would be hard to know for sure what's going on. However, the gist of the problem would still seem to be the same, your code is trying to access the private property $title from the Document object $document -- and that's what "private" means in this context: it cannot be accessed except by methods of that Document class (and you are trying to access via a method in a different class, your ControllerAccountLogin class). So, you need to look at that class and see if there is, perhaps, a public "setter" method or such that allows you to set the document title from code external to the $document object/class.

"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation

There has to be an easier way... I really didn't change that much! Ugh... I have no idea of when to do or where to even go to look at the document class. All I know is that this particular php code its one of the codes for the login page for customers wanting to login to their account. I honestly doubt that helps you at all but I don't know what else to do . Do you know of anyone who can simply look at my file manager for my website and fix what I messed up? I know you are trying to help and I really appreciate it..

The quick and dirty "fix" would be to find the Document class's file. I'm guessing it might be /home6/vickysdi/public_html/catalog/document.php, but that's just a guess based on where your login class was. If you find it, and somewhere in the Document class definition you find either of these:

PHP Code:

private $title;// orprotected $title;

...just change "private" or "protected" to "public".

But this could be a real kludge if directly changing the title might have some unwanted side-effects.

"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation