21
Zitat von Jörg Was heißt "gilt"? header.php klingt schon danach, als ob diese Datei einen Header baut, welcher in jeder Seite benötigt wird, also auch in der Startseite.
Naja das die Datei den Header für den Webshop aufbaut....und bei dem käuft so weit ich das beurteilen kann alles super...aber ich kann die Datei ja mal posten
<?php
/* ---------------------------------------------------------------------------
$Id: header.php 2087 2009-09-12 16:43:40Z hhgag $
H.H.G. multistore
http://www.hhg-multistore.com/
Copyright (c) 2005-2010 H.H.G. group
------------------------------------------------------------------------------
based on:
(c) 2003-2005 xt:Commerce (content.php 1344 2005-11-14); www.xt-commerce.com
------------------------------------------------------------------------------
Released under the GNU General Public License
------------------------------------------------------------------------------ */
// reset var
$box_smarty = new hhg_theme;
sdTemplate::configureSmarty($box_smarty);
$content_string = '';
$pos = 'header';
// set cache ID
if (!$box_theme->CacheCheck()) {
$cache = false;
$cache_id = null;
} else {
$cache = true;
$cache_id = STORE_ID . $_SESSION['language'] . $_SESSION['customers_status']['customers_status_id'] . $_GET['coID'];
}
// go trough if not cached
if (!$box_smarty->is_cached(DIR_FS_THEME_FOLDER . CURRENT_THEME . '/boxes/box_header.html', $cache_id) || !$cache) {
/*------------ Sprachen -------------*/
require_once (DIR_FS_CORE_INC . 'inc.hhg_get_all_get_params.php');
if (!isset($lng)) {
$lng = new language;
}
$count_lng = '';
reset($lng);
$box_content = array();
if(!$product->isProduct() && $cPath){
if (SEARCH_ENGINE_FRIENDLY_URLS != 'true')
$sCurcat .= '&cat='.$oUtils->getCurrCat();
else
$sCurcat .= '&cat=c'.$cPath;
$curpage = '&page='.($_GET['page']?$_GET['page']:1);
}
while (list($key, $value) = each($lng->catalog_languages)) {
$count_lng++;
if($value['code'] == "ru")
continue;
if($value['code'] == 'en') {
if(GEOIP_COUNTRY == 'United States') {
$value['code'] = 'enus';
}
}
switch($value['code']) {
case 'es':
$domain = 'es';
break;
case 'de':
$domain = 'de';
break;
case 'enus':
$domain = 'us';
break;
case 'fr':
$domain = 'fr';
break;
case 'ru':
$domain = 'ru';
break;
default:
$domain = 'com';
break;
}
$box_content[$value['id']] = array(
'ID' => $count_lng,
'LINK' => 'http://www.mainbrick.'.$domain.'/shop/?ncr=1',
'NAME' => $value['name'],
'IMAGE' => '<img src="'.DIR_WS_CATALOG.DIR_WS_THEME_FOLDER.CURRENT_THEME . '/img/langicons/' . $value['code'].'.png" alt="'.$value['name'].'" />',
'CODE' => $value['code'], 'ACTIVE' => ($_SESSION['languages_id'] == $value['id']));
/*
$box_content[$value['id']] = array(
'ID' => $count_lng,
'LINK' => hhg_href_link(basename($PHP_SELF) , 'language=' . $key . $curpage . $sCurcat . '&' . hhg_get_all_get_params(array(
'filter',
'language',
'currency',
'page',
'cat'
)), $request_type),'NAME' => $value['name'], 'IMAGE' => '<img src="'.DIR_WS_CATALOG.DIR_WS_THEME_FOLDER.CURRENT_THEME . '/img/langicons/' . $value['code'].'.png" alt="'.$value['name'].'" />',
'CODE' => $value['code'], 'ACTIVE' => ($_SESSION['languages_id'] == $value['id']));
*/
}
// Nach ID sortieren
ksort($box_content);
// dont show box if there's only 1 language
if ($count_lng > 1) {
$box_smarty->assign('LANGUAGES', $box_content);
}
/*------------ Warenkorb -------------*/
if ($_SESSION['customers_status']['customers_status_show_price'] == 1){
$box_smarty->assign('cart', 'true');
if ($_SESSION['cart'] && $_SESSION['cart']->count_contents() > 0){
$box_smarty->assign('cart_products', $_SESSION['cart']->count_contents());
$total = $_SESSION['cart']->show_total();
// Link zu der Kasse
$box_smarty->assign("checkoutlink", hhg_href_link(FILENAME_DEFAULT, 'module=checkout_shipping&sID=' . STORE_ID, 'SSL'));
if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount'] != '0.00') {
if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
$price = $total-$_SESSION['cart']->show_tax(false);
} else {
$price = $total;
}
$discount = $xtPrice->xtcGetDC($price, $_SESSION['customers_status']['customers_status_ot_discount']);
}
if ($_SESSION['customers_status']['customers_status_show_price'] == '1') {
if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 0) $total-=$discount;
if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) $total-=$discount;
if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) $total-=$discount;
$box_smarty->assign('TOTAL', $xtPrice->xtcFormat($total, true));
}
}else{
$box_smarty->assign('cart_empty', 'true');
}
}
else
$box_smarty->assign('cart_empty', 'false');
// Toplinks
$toplinks_array = $oTemplate->getLinks('toplinks');
$toplinks_string = '<ul id="sub-navigation">';
$i = 0;
$topmenu = array();
// Array durchlaufen
foreach($toplinks_array as $linktitle => $url){
$i++;
if(preg_match("#\{([g|c|a])\}\{translate\}(.*?)\{/translate\}\{(.*?)\}\{(.*?)\}#", $url, $url_parts)){
$cutomer_only = $url_parts[1];
$linktitle = umlaut($url_parts[2]);
$callback = $url_parts[3];
$url = $url_parts[4];
$sCurrModule = '';
if(preg_match("#coID:([0-9]*)#", $url, $contentpattern)){
$iCoID = $contentpattern[1];
$url = hhg_href_link(FILENAME_DEFAULT, 'coID='.$iCoID);
}
if(preg_match("#module:([a-z_]*)#", $url, $contentpattern)){
$sCurrModule = $contentpattern[1];
$url = hhg_href_link(FILENAME_DEFAULT, 'module='.$sCurrModule);
}
}
else
$linktitle = $url = '';
// Wenn eine Callback-Funktion angegeben, sie aufrufen
if($callback){
$ret = callNavFunc($callback, $title);
$linktitle = $ret["title"];
if(!$linktitle)
continue;
$addclass = "";
if($ret["class"])
$addclass = " ".$ret["class"];
}else{
$addclass = "";
$linktitle = _($linktitle);
}
// Aktuelle Seite = Seite im Link?
if(($sCurrModule && $sCurrModule == $_GET['module']) || ($iCoID && $iCoID == $_GET['coID']))
$is_current = true;
else
$is_current = false;
if($cutomer_only == 'a' || ($cutomer_only == 'g' && !isset($_SESSION['customer_id'])) || ($cutomer_only == 'c' && isset($_SESSION['customer_id'])) ){
$topmenu[] = array('class' => $addclass, 'url' => $url, 'active' => $is_current, 'title' => $linktitle);
}
}
$iIndex = -1;
// Anzahl der Menupunkte
$iCurrentItemCount = count($topmenu);
foreach($topmenu as $i=>$aItem){
if($aItem['active'])
$sClass = ' active';
else
$sClass = '';
// Index erhöhen
$iIndex++;
if($iIndex == 0)
$sIndexClass = 'first';
else if($iIndex == $iCurrentItemCount-1)
$sIndexClass = 'last';
else
$sIndexClass = '';
// Klasse
$sClass = trim($sIndexClass.' '.$sClass);
// Klasse
if($sClass)
$sClass = ' class="'.$sClass.'"';
if($aItem['active'])
$toplinks_string .= '<li'.$sClass.'><strong class="toplink-'.$i.'"><span>'.$aItem['title'].'</span></strong></li>';
else
$toplinks_string .= '<li'.$sClass.'><a href="'.$aItem['url'].'" class="toplink-'.$i.'"><span>'.$aItem['title'].'</span></a></li>';
}
$toplinks_string .= "</ul>\n";
$box_smarty->assign('toplinks', $toplinks_string);
// Begrüßung und Lonigbox im Header
if(!isset($_SESSION['customer_id']))
$greeting_string = _('Welcome').'! <a href="/shop/index.php?module=login" id="login_link">'._('Login').'</a> '._('or').' <a href="/shop/index.php?module=create_account">'._('register').'</a>';
else
$greeting_string = _('Welcome').', <a href="/shop/index.php?module=account">'.$_SESSION['customer_first_name']. ' '.$_SESSION['customer_last_name'].'</a>. <a href="/shop/index.php?module=logoff">'._('Log out').' »</a>';
$box_smarty->assign('greeting', $greeting_string);
$oTemplate->assignSearchBox($box_smarty);
}
$box_smarty->assign('box_TOPCATEGORIES', $theme->get_template_vars('box_TOPCATEGORIES'));
$box_smarty->assign('isproduct', $theme->get_template_vars('isproduct'));
$box_smarty->assign('isstartpage', $theme->get_template_vars('isstartpage'));
$box_smarty->assign('ischeckout', $theme->get_template_vars('ischeckout'));
$box_header = $box_smarty->fetch(DIR_FS_THEME_FOLDER . CURRENT_THEME . '/boxes/box_header.html', $cache_id);
$theme->assign('box_HEADER', $box_header);
Für das Infoportal wird das anscheinend mit Chunk realisiert
<!DOCTYPE html>
<html lang="[[++cultureKey]]">
<head>
<base href="[[++site_url]]" />
<title>[[*longtitle:default=`[[*pagetitle]]`]]</title>
[[canonical]]
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, follow" />
<meta name="keywords" content="[[*meta_keywords]]" />
<meta name="description" content="[[*meta_description]]" />
<meta name="generator" content="MODx Revolution CMS" />
<script type="text/javascript">document.documentElement.className="js"</script>
<link rel="stylesheet" type="text/css" href="[[++assets_url]]templates/mainbrickhp/css/style.css" media="screen, projection" />
<link rel="stylesheet" type="text/css" href="[[++assets_url]]templates/mainbrickhp/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
</head>
<!-- -------------------------------------------------------------------- -->
<!-- Site by AXIOM 3, Handcrafted Design and Development - info@axiom3.de -->
<!-- -------------------------------------------------------------------- -->
<body class="[[+bodyclass:default=`layout-m`]] lang-[[++cultureKey]]">
<div id="header" class="wrapper group">
<div id="country-selector">
[[++mb_country_name]] <a href="/start.html">(select country)</a>
</div>
<div id="logo">
<a href="[[++site_url]]">Mainbrick</a>
</div>
<div id="top-nav">
[[Wayfinder? &outerClass=`group` &excludeDocs=`[[++footer_menu_docs]]` &startId=`0` &rowTpl=`menu_item` &level=`1` &hereTpl=`menu_item_active`]]
</div>
</div>
PS:
Wie ich gerade sehe, hat die index.php anscheinend eine eigene Zeitmessung:
$mtime= microtime(); $mtime= explode(" ", $mtime); $mtime= $mtime[1] + $mtime[0]; $tstart= $mtime;
/* Set the actual start time */ $modx->startTime= $tstart;
Da würde ich mal schauen, ob dort irgendwo dokumentiert ist, wie man diese interne Zeitmessung aktiviert. Dann muss man nicht mit der externen Zeitmessung hantieren.
Ok das schau ich mal nach
[Edit Jörg: Zitatblöcke repariert]