Beispiel #1
0
        $crumbs[] = array('name' => $p['menu_name'], 'link' => $p['path']);
    }
    if (!strlen($page['template'])) {
        if (cf\Page::isDescendantOf($page, 'catalog')) {
            $page['template'] = 'category';
        } else {
            $page['template'] = 'page';
            //resolveTemplate($page['parent_id']);
        }
    }
    function includePage(&$page, &$crumbs, $pathInfo)
    {
        global $smarty;
        return require_once dirname(__FILE__) . '/' . $page['template'] . '.php';
    }
    $pageFound = false;
    if (file_exists(dirname(__FILE__) . '/' . $page['template'] . '.php')) {
        $pageFound = includePage($page, $crumbs, $pathInfo);
    }
    if (strlen($pathInfo['notfound']) && !$pageFound) {
        $page = cf\Page::get('error404');
        includePage($page, $crumbs, $pathInfo);
    }
    $smarty->assign('page', $page);
    $smarty->assign('crumbs', $crumbs);
    $tpl = file_exists(dirname(__FILE__) . '/templates/' . $page['template'] . '.tpl') ? $page['template'] : 'page';
    $smarty->display("{$tpl}.tpl");
} catch (Exception $e) {
    header("Location: /error404");
    exit;
}
Beispiel #2
0
         if (strlen($pathInfo['found'])) {
             $pid = $pathInfo['page_id'];
             if (strlen($pathInfo['notfound'])) {
                 $p = cf\Page::get($pid);
                 if (!(cf\Page::isDescendantOf($p, 'catalog') && ($productId = cf\Product::findByPath($pathInfo['notfound']))) && $p['permalink'] != 'articles') {
                     $pid = 'error';
                 }
             }
         } else {
             $pid = 'error';
         }
     }
 } catch (Exception $e) {
     $pid = 'error';
 }
 $page = cf\Page::get($pid);
 $pageText = cf\api\page\getText($page['id']);
 $crumbs = array();
 foreach ($page['branch'] as $p) {
     $crumbs[] = array('name' => $p['menu_name'], 'link' => $p['path']);
 }
 if (cf\Page::isDescendantOf($page, 'catalog')) {
     $page['template'] = $productId ? 'product' : 'category';
 }
 if (strlen($page['template']) && file_exists($_SERVER['DOCUMENT_ROOT'] . '/' . $page['template'] . '.php')) {
     require_once $_SERVER['DOCUMENT_ROOT'] . '/' . $page['template'] . '.php';
 }
 $tpl = 'page';
 if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/templates/' . $page['code'] . '.tpl')) {
     $tpl = $page['code'];
 }
Beispiel #3
0
<?php

require_once cf\Config::path . 'api/form.php';
require_once cf\Config::path . 'cart.php';
if (cf\api\cart\isempty()) {
    $page = cf\Page::get('empty');
    return;
}
$orderform = cf\api\form\get('order');
$clientInfo = cf\api\form\results($orderform);
if ($clientInfo) {
    cf\api\cart\add($_REQUEST['delivery']);
    $payMethod = '';
    if ($_REQUEST['pay']) {
        $paymentPage = cf\Page::get($_REQUEST['pay']);
        $payMethod = $paymentPage['menu_name'];
    }
    $orderId = cf\Cart::order($clientInfo['name'], $clientInfo['email'], $clientInfo['phone'], $clientInfo['address'], $clientInfo['comments'], $payMethod);
    $smarty->assign('orderId', $orderId);
    $page = cf\Page::get('success');
} else {
    $smarty->assign('orderform', $orderform);
    $smarty->assign('deliveries', cf\api\shop\getProducts('delivery'));
    $smarty->assign('payment', cf\api\page\getHierarchy('pay', false, 1));
}
Beispiel #4
0
<?php

require_once cf\Config::path . 'api/form.php';
$feedback = cf\api\form\get('feedback');
if (cf\api\form\send($feedback)) {
    $page = cf\Page::get('sent');
    return;
}
$smarty->assign('feedback', $feedback);