Hi all,
I made plugin, base on template switcher plugin, the code like this:
// TemplateSwitcher - plugin for MODx
// uses OnLoadWebDocument event
// stores template choice in cookie
// comment out lines 10, 11 and 27
// for single-page switch
if(!strstr($modx->documentContent, "donotswitch")) { // this page is not switchable
$id = $modx->getDocumentIdentifier('id');
$table = $modx->getFullTableName("client_site");
$result = $modx->db->select("id, template",$table,"DocumentId = ".$id);
if($modx->db->getRecordCount($result) == 1) {
$row = $modx->db->getRow($result);
$file = $row['template'];
//Start the buffer
ob_start();
//include
include $file;
//get contents from the buffer
$ob_contents = ob_get_contents();
//and kill/delete the buffer
ob_end_clean();
$modx->documentContent = $ob_contents;
}
} // end if page is switchable
My Table : modx_client_site
id | DocumentId | Template
1 | 2 | assets/templates/AllTemplates/bamboo/index.html
when i change value in column template with another template and i refresh browser, the page still display the old template before i change, but if i clear cache in the manager and i refresh browser, the browser display new template, that I need but without clear cache
is there any way to do that, change template without clear cache in the manager
regards,
yono