Talk martial arts at

Bookmark and Share

Cannot Redeclare Class error

Cannot Redeclare Class error

Postby Thoul » April 7th 2005, 12:08 am

Fatal error: Cannot redeclare class template in path\to\includes\template.php on line 30

This error sometimes appears after installing hacks or making certain other edits to your forum's files. In order to use the phpBB template system and .tpl files, each page must process the code contained in the includes/template.php file once. When a page tries to process this code a second time, the error above appears.

Fortunately, this is an easy error to fix. First, you need to locate this line in your includes/template.php file. It will be near the top of the file, about thirty lines down.
Code: Select all
class Template {

Now add this code before the line you just found:
Code: Select all
if ( class_exists('Template') )

The new code will prevent repeated processing of includes/template.php and therefore put an end to this error.
User avatar
Posts: 18551
Joined: July 30th 2002, 11:30 am
Location: USA

Return to phpBB 2: Troubleshooting

Who is online

Users browsing this forum: No registered users and 0 guests