Bad Boy Blog, an unofficial Diddy and Bad Boy fan blog

Bookmark and Share

Template->make_filename(): Error - file does not exist

Template->make_filename(): Error - file does not exist

Postby Thoul » December 7th 2003, 3:22 pm

phpBB wrote:Template->make_filename(): Error - file does not exist


This is a commonly seen phpBB error message. Unfortunately, this one is not very helpful and can be hard to track down. The error means that phpBB can not find a template file it needs to display a page. As you may notice, the name of the missing template file is not displayed. Sometimes the name will be displayed, but this is most often not the case.

To fix this error, you need to determine which template file is missing. There are a few ways to do this.

  1. If you have recently installed a hack that added new template files, be sure you've added these new files in every template. While most hack instructions will only tell you to add or edit files in the subSilver template, you really need to make those changes to every template installed on your forums.
  2. If you have recently installed a new template, and previously installed any hacks that added new template files, then you have a similar situation. Add the hack(s) template files to the new template. Please note that using a prehacked forum package does, in this sense, count as previously installing hacks that add new template files.
  3. The "hard way" to find out which template files are missing is to compare a list of all the files in every template's directory. If some templates are missing files that are present in another template, copy those files to the template that does not have them.


Another method of determining which template file is missing involves fixing an error within the error message itself. I mentioned earlier that this error message often does not include the name of the file that is missing. Originally, it was designed to always include the filename, but changes in phpBB have broken this functionality in phpBB 2.0.4 - 2.0.11. Please note that phpBB 2.0.12 and the eXtreme Styles hack both fix this problem. To repair this error and ensure that the filename is always displayed in the error message, make the following change to includes/template.php. View the page that presented the error again and you'll see which file is missing.

Code: Select all
#
#-----[ FIND ]------------------------------------------
#
	function make_filename($filename)
	{
		// Check if it's an absolute or relative path.
		if (substr($filename, 0, 1) != '/')
		{
       		$filename = phpbb_realpath($this->root . '/' . $filename);
		}

		if (!file_exists($filename))
		{
			die("Template->make_filename(): Error - file $filename does not exist");
		}

		return $filename;
	}

#
#-----[ REPLACE WITH ]------------------------------------------
#
	function make_filename($filename)
	{
		$old_filename = $filename;
		// Check if it's an absolute or relative path.
		if (substr($filename, 0, 1) != '/')
		{
       		$old_filename = $this->root . '/' . $old_filename;
    		$filename = phpbb_realpath($this->root . '/' . $filename);
		}

		if (!file_exists($filename))
		{
			if ( !$filename )
			{
				$filename = $old_filename;
			}
			die("Template->make_filename(): Error - file $filename does not exist");
		}

		return $filename;
	}


This code is also available for download as a hack.
User avatar
Thoul
Admin/Webmaster
 
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