Do you use SiteGround as a host by any chance? Two of my clients sites with 1.3.7 are toast right now (a third uses Zen 1.2.7 and I see no issues) with the same problem.
The site at first was displaying an error like the one ehdesign described and, when I looked at the generated source code, it wasn't calling up any template at all. I opened a ticket with SiteGround and they "applied a patch that fixed your problem" - no, not fixed. Now, instead of the site not displaying any template, it displays the default template. In the Admin, I am able to change it to the classic template but, even though it is still a choice in the Admin, it will not display the custom template.
This thread discusses the same problem and they were able to fix it by restoring the site with a backup. I would love to do the same but the backup contribution I added to both sites has vanished as well.
http://www.zen-cart.com/forum/showthread.php?t=62146
All the custom template files appear to be intact. I even uploaded my copy from my pc to the site, one that should have no files corrupted but it did not fix the problem.
I checked the files and I *think* the applied the 'patch' to the includes/classes/template_func.php file. I think it might be lines 27-54 that were altered as they are different from my original Zen install of 1.3.7:
Code:
<?php
/**
* template_func Class.
*
* @package classes
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: template_func.php 4580 2006-09-21 20:47:18Z wilt $
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
/**
* template_func Class.
* This class is used to for template-override calculations
*
* @package classes
*/
class template_func extends base {
function template_func($template_dir = 'default') {
$this->info = array();
}
function get_template_part($page_directory, $template_part, $file_extension = '.php') {
$directory_array = array();
# if ($dir = @dir($page_directory)) {
# while ($file = $dir->read()) {
# if (!is_dir($page_directory . $file)) {
# if (substr($file, strrpos($file, '.')) == $file_extension && preg_match($template_part, $file)) {
# $directory_array[] = $file;
# }
# }
# }
#
# sort($directory_array);
# $dir->close();
# }
$fileta = shell_exec("ls -1A $page_directory");
$fileta = ereg_replace("[\r|\n]", ' ', $fileta);
$fileta_be = explode(" ", $fileta);
foreach ($fileta_be as $fileto) {
if (substr($fileto, strrpos($fileto, '.')) == $file_extension && preg_match($template_part, $fileto)) {
$directory_array[] = $fileto;
}
}
sort($directory_array);
return $directory_array;
}
function get_template_dir($template_code, $current_template, $current_page, $template_dir, $debug=false) {
// echo 'template_default/' . $template_dir . '=' . $template_code;
if ($this->file_exists($current_template . $current_page, $template_code)) {
return $current_template . $current_page . '/';
} elseif ($this->file_exists(DIR_WS_TEMPLATES . 'template_default/' . $current_page, ereg_replace('/', '', $template_code), $debug)) {
return DIR_WS_TEMPLATES . 'template_default/' . $current_page;
} elseif ($this->file_exists($current_template . $template_dir, ereg_replace('/', '', $template_code), $debug)) {
return $current_template . $template_dir;
} else {
return DIR_WS_TEMPLATES . 'template_default/' . $template_dir;
// return $current_template . $template_dir;
}
}
function file_exists($file_dir, $file_pattern, $debug=false) {
$file_found = false;
$file_pattern = '/'.str_replace("/", "\/", $file_pattern).'$/';
if ($mydir = @dir($file_dir)) {
while ($file = $mydir->read()) {
if (preg_match($file_pattern, $file)) {
$file_found = true;
break;
}
}
}
return $file_found;
}
}
?>
But as I said, this only makes the default display. Not sure what to do (short of switching hosts). Any thoughts?
Bookmarks