Ясное дело, что всего не упомнить. Версия-то у меня есть, но толку от этого нет. Изменения вношу, но не отображается ничего совершенно.
Ни ошибок, ни изменений.
вот index.php
function get_mtime() {
$mtime = microtime();
$mtime = explode(' ', $mtime);
$mtime = $mtime[1] + $mtime[0];
return $mtime;
}
$time1 = get_mtime();
//core file
ini_set("display_errors", "1");
// -------------------------INITIALIZATION-----------------------------//
//make sure that URL does not contain something like index.php/?parameter1=1&... //
//include core files
include("./cfg/connect.inc.php");
include("./includes/database/mysql.php");
include("./cfg/functions.php");
include("./cfg/general.inc.php");
include("./core/core_errors.php");
include("./cfg/appearence.inc.php");
include("./cfg/category_functions.php");
include("./cfg/language_list.php");
include("./cfg/company.inc.php");
include("./cfg/product.inc.php");
include("./cfg/shipping.inc.php");
include("./cfg/votes.inc.php");
include("./cfg/redirect.inc.php");
//caching
$cache_options = array(
'cacheDir'=>$_SERVER['DOCUMENT_ROOT'].ereg_replace($_SERVER['HTTP_HOST'], "", CONF_SHOP_URL).'/core/cache/',
'lifeTime'=>86400);
$cache_categories_id = 'category';
require_once('./core/core_caching.php');
$CacheLite = new Cache_Lite($cache_options);
//for Yandes dont read session paths
$ref = $_SERVER['HTTP_USER_AGENT'];
if (!eregi("Yandex",$ref)) session_start();
ini_set("display_errors", "1");
ini_set("magic_quotes_runtime", "0");
//init Smarty
require 'smarty/smarty.class.php';
$smarty = new Smarty; //core smarty object
$smarty_mail = new Smarty; //for e-mails
//select a new language?
if (isset($_GET["new_language"]))
{
if ($_SESSION["current_language"] != $_GET["new_language"])
{
$_SESSION["current_language"] = $_GET["new_language"];
header("Location: ".$_SERVER["HTTP_REFERER"]);
}
}
//current language session variable
if (!isset($_SESSION["current_language"]) ||
$_SESSION["current_language"] < 0 || $_SESSION["current_language"] > count($lang_list))
$_SESSION["current_language"] = 0; //set default language
//include a language file
if (isset($lang_list[$_SESSION["current_language"]]) && file_exists("./languages/".$lang_list[$_SESSION["current_language"]]->filename))
include("./languages/".$lang_list[$_SESSION["current_language"]]->filename); //include current language file
else
{
die("<font color=red><b>ERROR: Couldn't find language file!</b></font>");
}
//connect to the database
db_connect(DB_HOST,DB_USER,DB_PASS) or die (db_error());
db_select_db(DB_NAME) or die (db_error());
mysql_query('SET NAMES '.DB_CHARSET);
//get currency ISO 3 code
$currency_iso_3 = (defined('CONF_CURRENCY_ISO3')) ? CONF_CURRENCY_ISO3 : "USD" ;
$smarty->assign("currency_iso_3", $currency_iso_3);
//load all categories to array $cats to avoid multiple DB queries (frequently used in future - but not always!)
if ($cats_str = $CacheLite->get($cache_categories_id))
{
$cats=unserialize($cats_str);
}
else
{
$cats = array();
$i=0;
$q = db_query("SELECT categoryID, name, parent, products_count, description, picture FROM ".CATEGORIES_TABLE." where categoryID<>0 ORDER BY name") or die (db_error());
while ($row = db_fetch_row($q))
{
$cats[$i++] = $row;
}
$CacheLite->save(serialize($cats), $cache_categories_id);
}
//del install
if (isset($_POST["install_comlite"]))
{
if (!isset($_POST["del_install"])) $_POST["del_install"] = 0;
if (!strcmp($_POST["del_install"], "on")) $_POST["del_install"] = 1;
else $_POST["del_install"] = 0;
if ($_POST["del_install"]==1 && file_exists("install.php")) unlink("install.php");
header("Location: index.php");
}
//hurl's
if(isset($_GET["catalog_hurl"]))
{
$q = db_query("SELECT categoryID FROM ".CATEGORIES_TABLE." where hurl='".mysql_real_escape_string($_GET["catalog_hurl"])."'") or die (db_error());
$row = db_fetch_row($q);
if($row)
{$_POST["categoryID"] = $row[0];}
else
{
//echo "not found";
//header("HTTP/1.0 404 Not Found");
//virtual('404.php');
header("Location: http://".CONF_SHOP_URL."/404/");
exit;
}
}
if(isset($_GET["tags_hurl"]))
{
$q = db_query("SELECT * FROM ".TAGS_TABLE." WHERE hurl='".mysql_real_escape_string($_GET["tags_hurl"])."' OR tag='".mysql_real_escape_string($_GET["tags_hurl"])."'") or die (db_error());
$row = db_fetch_row($q);
if($row) {$_POST["tagID"] = $row[2];}
else {
//header("HTTP/1.0 404 Not Found");
//virtual('404.php');
header("Location: http://".CONF_SHOP_URL."/404/");
exit;
}
}
if(isset($_GET["product_hurl"]))
{
$q = db_query("SELECT * FROM ".PRODUCTS_TABLE." where hurl='".mysql_real_escape_string($_GET["product_hurl"])."'") or die (db_error());
$row = db_fetch_row($q);
if($row)
{$productID = $row[0];}
else {
//header("HTTP/1.0 404 Not Found");
//virtual('404.php');
header("Location: http://".CONF_SHOP_URL."/404/");
exit;
}
}
//set $categoryID
if (isset($_GET["categoryID"]) || isset($_POST["categoryID"]))
$categoryID = isset($_GET["categoryID"]) ? $_GET["categoryID"] : $_POST["categoryID"];
else $categoryID = 0;
$categoryID = (int)$categoryID;
//$productID
if (!isset($_GET["productID"]))
{
if (isset($_POST["productID"]))
{
$productID = (int)$_POST["productID"];
}
}
else
{
$productID = (int)$_GET["productID"];
}
//and different vars...
if (isset($_GET["register"]) || isset($_POST["register"]))
$register = isset($_GET["register"]) ? $_GET["register"] : $_POST["register"];
if (isset($_GET["update_details"]) || isset($_POST["update_details"]))
$update_details = isset($_GET["update_details"]) ? $_GET["update_details"] : $_POST["update_details"];
if (isset($_GET["order"]) || isset($_POST["order"]))
$order = isset($_GET["order"]) ? $_GET["order"] : $_POST["order"];
if (isset($_GET["check_order"]) || isset($_POST["check_order"]))
$check_order = isset($_GET["check_order"]) ? $_GET["check_order"] : $_POST["check_order"];
if (isset($_GET["proceed_ordering"]) || isset($_POST["proceed_ordering"]))
$proceed_ordering = isset($_GET["proceed_ordering"]) ? $_GET["proceed_ordering"] : $_POST["proceed_ordering"];
if (!isset($_SESSION["vote_completed"])) $_SESSION["vote_completed"] = array();
//checking for proper $offset init
$offset = isset($_GET["offset"]) ? $_GET["offset"] : 0;
if ($offset<0 || $offset % CONF_PRODUCTS_PER_PAGE) $offset = 0;
// sort order
if (isset($_GET["sort"]))
{
switch ($_GET["sort"])
{
case "name": $_SESSION["sort"] = "name"; break;
case "Price": $_SESSION["sort"] = "Price"; break;
case "in_stock": $_SESSION["sort"] = "in_stock"; break;
case "product_code": $_SESSION["sort"] = "product_code"; break;
case "customers_rating": $_SESSION["sort"] = "customers_rating"; break;
default: $_SESSION["sort"] = CONF_SORT_PRODUCT; break;
}
switch ($_GET["order"])
{
case "asc": $_SESSION["order"] = "asc"; break;
case "desc": $_SESSION["order"] = "desc"; break;
default: $_SESSION["order"] = CONF_SORT_PRODUCT_BY; break;
}
}
else
{
if (!isset($_SESSION["sort"])) $_SESSION["sort"] = CONF_SORT_PRODUCT;
if (!isset($_SESSION["order"])) $_SESSION["order"] = CONF_SORT_PRODUCT_BY;
}
// $smarty -> assign("sort", $_SESSION["sort"]);
// $smarty -> assign("order", $_SESSION["order"]);
if (CONF_CURRENCY_AUTO == 1)
{
$fh = @fopen('http://www.cbr.ru/scripts/XML_daily.asp','r');
$data = "";
if($fh) {
while(!feof($fh)) @$data.=fread($fh,4096);
fclose($fh);
preg_match('#<CharCode>USD</CharCode>.*?<Value>(.*?)</Value>#si',$data,$resultUSD);
preg_match('#<CharCode>EUR</CharCode>.*?<Value>(.*?)</Value>#si',$data,$resultEUR);
$resultUSD[1] = strval(str_replace(",",".",$resultUSD[1])) > 0 ? strval(str_replace(",",".",$resultUSD[1])) : 1;
$resultEUR[1] = strval(str_replace(",",".",$resultEUR[1])) > 0 ? strval(str_replace(",",".",$resultEUR[1])) : 1;
if ((round($resultUSD[1], 2) != '') && (round($resultUSD[1], 2) != 0))
{
define("CURR_USD", round($resultUSD[1], 2));
define("CURR_EUR", round($resultEUR[1], 2));
}
}
}
if (!defined("CURR_USD")) {define("CURR_USD", CONF_CURRENCY_USD);}
if (!defined("CURR_EUR")) {define("CURR_EUR", CONF_CURRENCY_EUR);}
$smarty->assign("product_category_path","");
// -------------SET SMARTY VARS AND INCLUDE SOURCE FILES------------//
if (isset($productID)) //to rollout categories navigation table
{
$q = db_query("SELECT categoryID FROM ".PRODUCTS_TABLE." WHERE productID='$productID'") or die (db_error());
$r = db_fetch_row($q);
if ($r) $categoryID = $r[0];
}
//set Smarty main page
$f = file("./core/aux_pages/index");
$out = implode("", $f);
$smarty->assign("index", $out);
$f_c = file("./core/aux_pages/contact");
$out_c = implode("", $f_c);
$smarty->assign("contact_info", $out_c);
//set Smarty main page
$f_cnt = file("./core/aux_pages/live_counts");
$out_cnt = implode("", $f_cnt);
$smarty->assign("live_counts", $out_cnt);
//set Smarty include files dir
$smarty->template_dir = "./css/css_".CONF_COLOR_SCHEME."/theme";
$smarty_mail->template_dir = "./css/css_".CONF_COLOR_SCHEME."/theme/mail";
//assign core Smarty variables
$smarty->assign("lang_list", $lang_list);
$smarty->assign("lang_list_count", count($lang_list));
if (isset($_SESSION["current_language"])) $smarty->assign("current_language", $_SESSION["current_language"]);
// - following vars are used as hidden in the customer survey form
$smarty->assign("categoryID", $categoryID);
if (isset($productID)) $smarty->assign("productID", $productID);
if (isset($_GET["currency"])) $smarty->assign("currency", $_GET["currency"]);
if (isset($_GET["user_details"])) $smarty->assign("user_details", $_GET["user_details"]);
if (isset($_GET["aux_page"])) $smarty->assign("aux_page", $_GET["aux_page"]);
if (isset($_GET["show_price"])) $smarty->assign("show_price", $_GET["show_price"]);
if (isset($_GET["adv_search"])) $smarty->assign("adv_search", $_GET["adv_search"]);
if (isset($_GET["searchstring"])) $smarty->assign("searchstring", $_GET["searchstring"]);
if (isset($register)) $smarty->assign("register", $register);
if (isset($order)) $smarty->assign("order", $order);
if (isset($check_order)) $smarty->assign("check_order", $check_order);
//set defualt main_content template to homepage
$smarty->assign("main_content_template", "home.tpl.html");
// includes all .php files from includes/ dir
$includes_dir = opendir("./includes");
while ( ($inc_file = readdir($includes_dir)) != false )
if (strstr($inc_file,".php"))
{
include("./includes/$inc_file");
}
// output:
//security warnings!
// if (file_exists("./install.php"))
// {
// echo WARNING_DELETE_INSTALL_PHP;
// }
// if (file_exists("./forgot_password.php"))
// {
// echo WARNING_DELETE_FORGOTPW_PHP;
// }
//
// if (!is_writable("./products_pictures") || !is_writable("./templates_c"))
// {
// echo WARNING_WRONG_CHMOD;
// }
//echo($_SERVER["REQUEST_URI"]);
//show Smarty output
// header("Content-Type: text/html; charset=".DB_CHARSE);
if (isset($_SERVER["HTTP_REFERER"]) && !strpos($_SERVER["HTTP_REFERER"], 'cart')) $_SESSION["go_back"] = $_SERVER['HTTP_REFERER'];
if (isset($_SESSION['go_back'])) $go_back = $_SESSION['go_back']; else $go_back = "";
$smarty->assign("go_back", $go_back);
$smarty->display("./css/css_".CONF_COLOR_SCHEME."/theme/index.tpl.html");
$time2 = get_mtime();
$totaltime = $time2 - $time1;
//echo '<br /><br />Time, sec: '.$totaltime;
$mypages = array('1', '2');
$p = array();
$q1 = db_query("SELECT id, title, text FROM ".AUX_TABLE." WHERE id IN (". implode(',' , $mypages) .") ORDER BY id DESC") or die (db_error());
while ($row = db_fetch_row($q1))
{
$p[] = $row;
}
$smarty->assign("my_pages",$p);
а вот home.tpl.html
{* front-end homepage*}
<div class="top">
<h1>{$smarty.const.STRING_GREETINGS}</h1>
</div>
<div class="middle">
<div style="width: 100%; margin-bottom: 30px;">
{* special offers *}
{if $special_offers ne NULL}
<table cellspacing="0" cellpadding="5px" width="100%">
{section name=i loop=$special_offers}3
{if $smarty.section.i.index is div by 3}<tr style="text-align: justify; vertical-align: top;">{/if}
<td style="text-align: center; width: 30%">
<a href="./{$special_offers[i][5]}">
<img src="./products_pictures/{$special_offers[i][2]}" border="0" alt="{$special_offers[i][1]|replace:'"':'"'}" />
</a><br />
<a href="./{$special_offers[i][5]}">{$special_offers[i][1]}</a><br />
<font style="color: #FFF"><b>{$special_offers[i][3]}</b></font>
</td>
{if ($smarty.section.i.index+1) is div by 3}</tr>{/if}
{/section}
</table>
{/if}
{* end of special offers *}
{$index}
{section name=i1 loop=$my_pages}
<div>
<h2>{$my_pages[i1][1]}</h2>
<p>{$my_pages[i1][2]}</p>
</div>
{/section}
</div>
</div>
<div class="bottom"> </div>
уж извините за засорение форума, но может я в код "не туда" вставляю. иначе почему не выходит ничего.