PHP Message Board installation help

Hello all,

Virgin poster but am looking forward to learning a lot from here. I have a bit of php experience but still very much a rookie.

My problem is that I’ve been trying to install this simple message board but I’m just not quite sure when to start, the system is called Commentator.

The guide on the site is more suitable for someone with a bit more experience (I haven’t been able to get in contact with the developer either) so I just need a start then I’m sure I’ll work my way around it. I would have tried to do other message boards with better tutorials but this system is prefect for what I require.

Any help at all would be greatly appreciated!
Kadir.

Considering there are about 1000 Commentator programs around, and you didn’t ask a PHP question…

Tell us what program this is and where you downloaded it from so we can look at it and perhaps help you with installing it. Usually, most PHP software projects are just installed by loading them on your hosting site and running the install software for the application… (Sometimes you have to set up a database first.)

Help us help you with more info… Thanks…

The commentator I’m trying to use is http://ratherodd.com/commentator/
I know what I need to setup a DB first but I’m not quite sure the structure of it…

Thanks!

And yes your right, I don’t have any specific php questions because I haven’t run into any specific problems. When ever I try to run the php online I get:

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /nfs/c06/h02/mnt/91114/domains/nahgammin.com/html/commentator/commentator.php on line 57

and I’m sure it’s a problem of setting up a correct database…

Ahh hell with it, I’ll find one with a better installation guide.
Thanks all anyway…

Well, that one looks straight forward. It does have a lot of options that need to be set up for correct use.
But, so far it does not look too hard to set it up.

The error message you showed is basically a problem with your PHP syntax. Usually caused by missing a closing bracket. } And, that is in a for loop, if clause or while loop… If you decide to go with it, let us know and since we can look at it’s code we might be able to help. Or you can post your version of it and show us the parts that have errors in…

Okay so I’ve found another commentator system which also seems suitable. The system is one off tutorialzine ->http://tutorialzine.com/2010/06/simple-ajax-commenting-system/ (I’m aware it’s an ajax system but I’m having issues with the php file)

I’ve uploaded the files and everything is setup correctly but I still seem to get an error:

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /nfs/c06/h02/mnt/91114/domains/nahgammin.com/html/demo/comment.class.php on line 6

If I remove this line the system shows up correctly but obviously doesn’t function the same way. I will past the php code below and the message suggests an error on line 6 which I can’t find anything wrong with…

Any help is much appreciated!

<?php class Comment { [b]private $data = array(); <------ line 6 [/b] public function __construct($row) { /* / The constructor */ $this->data = $row; } public function markup() { /* / This method outputs the XHTML markup of the comment */ // Setting up an alias, so we don't have to write $this->data every time: $d = &$this->data; $link_open = ''; $link_close = ''; if($d['url']){ // If the person has entered a URL when adding a comment, // define opening and closing hyperlink tags $link_open = ''; $link_close = ''; } // Converting the time to a UNIX timestamp: $d['dt'] = strtotime($d['dt']); // Needed for the default gravatar image: $url = 'http://'.dirname($_SERVER['SERVER_NAME'].$_SERVER["REQUEST_URI"]).'/img/default_avatar.gif'; return '
'.$link_open.' '.$link_close.'
'.$link_open.$d['name'].$link_close.'
'.date('d M Y',$d['dt']).'

'.$d['body'].'

'; } public static function validate(&$arr) { /* / This method is used to validate the data sent via AJAX. / / It return true/false depending on whether the data is valid, and populates / the $arr array passed as a paremter (notice the ampersand above) with / either the valid input data, or the error messages. */ $errors = array(); $data = array(); // Using the filter_input function introduced in PHP 5.2.0 if(!($data['email'] = filter_input(INPUT_POST,'email',FILTER_VALIDATE_EMAIL))) { $errors['email'] = 'Please enter a valid Email.'; } if(!($data['url'] = filter_input(INPUT_POST,'url',FILTER_VALIDATE_URL))) { // If the URL field was not populated with a valid URL, // act as if no URL was entered at all: $url = ''; } // Using the filter with a custom callback function: if(!($data['body'] = filter_input(INPUT_POST,'body',FILTER_CALLBACK,array('options'=>'Comment::validate_text')))) { $errors['body'] = 'Please enter a comment body.'; } if(!($data['name'] = filter_input(INPUT_POST,'name',FILTER_CALLBACK,array('options'=>'Comment::validate_text')))) { $errors['name'] = 'Please enter a name.'; } if(!empty($errors)){ // If there are errors, copy the $errors array to $arr: $arr = $errors; return false; } // If the data is valid, sanitize all the data and copy it to $arr: foreach($data as $k=>$v){ $arr[$k] = mysql_real_escape_string($v); } // Ensure that the email is lower case: $arr['email'] = strtolower(trim($arr['email'])); return true; } private static function validate_text($str) { /* / This method is used internally as a FILTER_CALLBACK */ if(mb_strlen($str,'utf8')<1) return false; // Encode all html special characters (<, >, ", & .. etc) and convert // the new line characters to
tags: $str = nl2br(htmlspecialchars($str)); // Remove the new line characters that are left $str = str_replace(array(chr(10),chr(13)),'',$str); return $str; } } ?>

I think it is the “scope” of the variable…
Well, try removing the PRIVATE before that line and let me know if that fixes it.

If not, I can look deeper into the code tonight as I am working on this site a lot tonight.
Let us know…

I’ve tried removing the ‘private’ Ernie but I seem to get the same response.

After having a bit more time with it, I’ve updated my server to php 5.3.10 and now I get a similar error but slightly different.

Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /nfs/c06/h02/mnt/91114/domains/nahgammin.com/html/demo/comment.class.php on line 6

Now that I’ve placed the ‘private’ back and updated the php it worked. I should have double checked it from the start instead of assuming.

Thanks for your help anyhow Ernie!

Well, glad you got it working. “SCOPE” of variables are different in various versions of software. A lot of time a “Private” or “Global” makes the code not work. Glad you figured out the PHP version. I didn’t think of that. So, CONGRATS! CYA in the bitstream…

Sponsor our Newsletter | Privacy Policy | Terms of Service