add cache blocks
This commit is contained in:
26
src/createblock.php
Normal file
26
src/createblock.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
|
||||
function create_block($block){
|
||||
|
||||
|
||||
$blockfile = BASE_VIJ.'blocks/'.$blockpath.$block.'.php';
|
||||
|
||||
|
||||
if (!file_exists($blockfile))
|
||||
return false;
|
||||
|
||||
$cachefile = VIJ_CACHE.$block.'.html';
|
||||
|
||||
|
||||
ob_start();
|
||||
include $blockfile;
|
||||
$html = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
|
||||
return file_put_contents($cachefile, $html);
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user