Fragment Caching and Isset?

Hi,

I have json base generated a page. I try fragment caching this page. I have a problem. Cache is running but my php base json loader function is running. I want to control json loader

example;

//// Sitecontroller

<?php

if(iscache) { // is exist same function

$json = file_get_content("blabla.json");

$infoCentent= CJSON::decode($json, true);

}

else infoCentent = "";

$this->render(‘info’,array(‘infoCentent’ => $infoCentent));

?>

////Theme

<?php if($this->beginCache(“content”, array(‘duration’=>300))) { ?>

<div>

<?php echo $info; ?>

</div>

<?php $this->endCache(); } ?>

your question is not clear what exactly you trying to do

ok,

If the content is cached, file_get_content function should not work. How can I do check cache?

you see this line right here


if($this->beginCache(id))

This method will display cached content if it is availabe. If not, it will start caching and would expect a endCache() call to end the cache and save the content into cache.

but why would you wanna check it in the controller


if($this->beginCache(id))

does exactly the same checks if data is in cache, why would you break MVC by doing this?