私の投稿には本文テキストがあり、このテキストに [gallery=2] のような短いコードを入れました。これで、テキストに 2 つの引数 (ギャラリーと 2) を見つけることができます。ビューで関数 (ギャラリー) を動的に呼び出したいのですが、それは次のように要素(ギャラリーID = 2)を呼び出します:
アプリ/ビュー/投稿/index.ctp
findshortcode($posts[Post][Body]); // this function find short code and call his name like gallery(2)
//my problem is :
function gallery($id = null){
$this->element('gallery', array('galleryid' => $id), array('plugin' => 'gallerys'));
}