How to solve the eval()’d code error on PhpBB?

Sometimes when you are messing with the files or templates of PhpBB, you might accidentally create some error.

One specific issue is the eval()’d code error that one might encounter if one doesn’t edit the templates and/or files properly. You are likely to get an error similar to this :

Parse error: syntax error, unexpected ‘}’ in home/test/public_html/testforum.com/includes/template.php(230) : eval()’d code on line 292

In such case, you have edited the coding on the template file and changed the codings but you have made some error. For example, you could have forgotten to add a line of code or repeated the same statement again. I had actually faced a similar problem. However, on my forum, I could see the index page without any problem, but the real error occurred when I tried to open individual threads/topics. I’m going to post about how I solved the issue.

What everybody is likely to do after getting such error is to try to find out the line the error’s showing – line 292 and then check where the “}” is missing. But, that is completely wrong way to do it. You won’t be able to find out any error on the template.php file. What you need to know is that the error occured while parsing the information contained on a separate file, not the template.php file. So, there’s no point in looking for error in that file. In most cases, the error lies on the body section of the template you are currently using. Here’s how I solved the problem.

First of all, I went to the Styles tab on PhpBB administration panel.

Then I clicked on the Templates options. Since CA Vintage was the theme I had been using at that time, I clicked on Edit.

As I had said before, the error lies on the body part of the current template that you are using. So, in my case, it was the body part of CA Vintage template. On the next page, select viewtopic_body.html and then click on Select template file button.

The content of the viewtopic_body.html file will now be listed on the text area just below it. You have to now, manually inspect the codes for any kind of errors. For example, repetition of same statements, improper closing of statements, incomplete coding, syntax error, or you might have forgotten to put some code etc. In my case, it was two End If‘s that was causing the problem. There should have been only one, so the problem was obviously repetition of statements.

I then removed one of the End If‘s and then clicked on Submit.  Problem solved!

That’s it. It’s just that these errors occur due to carelessness on your own part. You have to make changes to templates if you want to install plugins, modify the template as per your need etc. so you need to be extra careful while adding new lines of codes or removing the old ones – an error in a single code might impede the smooth running of your forum and hence, you’ll have another problem on your shoulder to find out where the error is occuring. It’s pretty  troublesome to search for errors in the coding if you don’t know where to look. I hope this guide helped you because now you know where to look for the error. Good luck.

Note : If you cannot find error on your own, you can always ask for help on PhpBB Community forums. Just post the code out there and the users will let you know where the error is.

Leave a Reply

Your email address will not be published. Required fields are marked *