Jump to content
Larry Ullman's Book Forums

Ritobroto

Members
  • Posts

    1
  • Joined

  • Last visited

Ritobroto's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi Larry, I want to cache my index.php page. I've configured the main.php with declaration in cache component as CFileCache. I want to cache my search engine in the index page. In the Site Controller I've added: $property = false; if($cache = Yii::app()->cache!== null) { if(isset($_POST['location'] && isset($_GET['prop_search'])) // (location is the search engine name and prop_search is search button's id which is a submit button.) { $val = explode(',',$_POST['location']); $value = 'SELECT * FROM cache_search where keyword like "%".$val."%"'; $command = YII::app()->db->createCommand($value); $result = $command->queryAll(); Yii::app()->cache->get($result); }} else{ $key = md5(rand(10,10000)); Yii::app()->cache->set($key,$result,0); } if(!$property) { $sql = 'SELECT property_id,property_name,keyword FROM cache_search'; $command = YII::app()->db->createCommand($sql); $property = $command->queryAll(); if(isset($key)) $cache->get($key, $property, 0); } I'm getting the value of the data stored in the cache_search table in the database but not the new searched keywords in the table. nor even in the view. I've not added anything to view. I'm confused cause this page is not having any models. it's having index.php as view and siteController only. Please help me getting it. I'm stuck with it for a week long but yet not been able to fix it.
×
×
  • Create New...