私はこのタグを私のhtmlファイルに持っています:
{{block:my_test_block}}
{{news:my_test_block2}}
このタグを解析して、私のアプローチであるdbのコンテンツに置き換える必要があります。
ob_start();
require_once('file.php');
$template = ob_get_contents();
ob_end_clean();
$line = preg_replace_callback('/{(\w+)}/' , "parseTag" , $template);
function parseTag($matches){
//here switch for block, news,
}
それは正しい方法ですか?ありがとう。