Log in

View Full Version : Check if a template exists in the PHP file


Gary King
11-08-2006, 04:04 AM
How do I check if a template exists in the PHP file?

Adrian Schneider
11-08-2006, 04:09 AM
There are several ways you can do it. The easiest is if (!empty($vbulletin->templatecache['template_name']))
{
// template exists and is cached
}if it's not cached, then... you could use a query if ($vbulletin->db->query_first("
SELECT templateid
FROM " . TABLE_PREFIX . "template
WHERE title = 'template_name'
"))
{
// template exists
}