add new route for testing esi tag

This commit is contained in:
Manuel Raynaud
2013-11-20 10:09:12 +01:00
parent 64c5991838
commit a436adf438
7 changed files with 16 additions and 7 deletions

View File

@@ -90,13 +90,13 @@ class ViewListener implements EventSubscriberInterface
$response = new Response($content, $parser->getStatus() ?: 200);
}
/* $response->setCache(array(
$response->setCache(array(
'last_modified' => new \DateTime(),
'max_age' => 600,
's_maxage' => 600,
'private' => false,
'public' => true,
));*/
));
$event->setResponse($response);
} catch (ResourceNotFoundException $e) {

View File

@@ -67,7 +67,6 @@ class Thelia extends Kernel
if ($this->debug) {
ini_set('display_errors', 1);
}
ini_set('display_errors', 1);
$this->initPropel();
}

View File

@@ -13,6 +13,11 @@
<default key="_view">includes/addedToCart</default>
</route>
<route id="esi-minicart" path="/mini-cart">
<default key="_controller">Front\Controller\CartController::renderMiniCart</default>
<default key="_view">includes/mini-cart</default>
</route>
<!-- Register -->
<route id="customer.create.process" path="/register" methods="post">

View File

@@ -142,4 +142,10 @@ class CartController extends BaseFrontController
return $cartAdd;
}
public function renderMiniCart()
{
$response = $this->render('includes/mini-cart');
return $response;
}
}

View File

@@ -129,7 +129,7 @@ GNU General Public License : http://www.gnu.org/licenses/
</div>
</li>
{/elseloop}
{include file="includes/mini-cart.html" nocache}
<esi:include src="{url path="/mini-cart"}" alt="fail" ></esi:include>
</ul>
{/nocache}
<ul class="nav navbar-nav navbar-categories">

View File

@@ -11,7 +11,7 @@ require __DIR__ . '/../core/bootstrap.php';
$request = Request::createFromGlobals();
$thelia = new Thelia("prod", false);
//$thelia = new HttpCache($thelia);
$thelia = new HttpCache($thelia);
$response = $thelia->handle($request)->prepare($request)->send();
$thelia->terminate($request, $response);

View File

@@ -44,9 +44,8 @@ if ( false === in_array($request->getClientIp(), $trustedIp)) {
$response = Response::create('Forbidden', 403)->send();
$thelia->terminate($request, $response);
} else {
$thelia = new HttpCache($thelia);
$response = $thelia->handle($request)->send();
//$thelia->terminate($request, $response);
$thelia->terminate($request, $response);
}