聯(lián)系官方銷售客服
1835022288
028-61286886
如何讓$ci 能在任何頁面使用或者后臺models里使用
以下是 CHTML 插件里的,我發(fā)現(xiàn)這個$ci 需要在 模塊的 HTML.PHP 文件里傳遞
如果用在插件里,$ci->content_model->_Show 會報錯,就找不到這個方法
如果讓它在任意地方用起來呢?
$id = 41; $dirname = 'news'; ob_start(); // 修復前綴 $ci->content_model->_init($dirname,SITE_ID); // 生成靜態(tài)路由糾正 \Phpcmf\Service::L('router')->class = 'show'; \Phpcmf\Service::L('router')->method = 'index'; \Phpcmf\Service::V()->init('pc'); \Phpcmf\Service::V()->module($ci->module['share'] ? 'share' : $ci->module['dirname']); \Phpcmf\Service::V()->assign('my_php_url', SITE_URL.'index.php?not301=2&'.($ci->module['share'] ? '' : 's='.$ci->module['dirname'].'&').'c=show&id='.$id); $data = $ci->content_model->_Show($id); $html = ob_get_clean();
回復@GoWorkRoom 不行的,如果這么簡單,我已經(jīng)寫完了!這個我寫過了
回復@天天向上 所以我強調了,靜態(tài)生成插件!這個問題,估計要官方來解決
回復@天天向上 嗯是的。我自己改了之后復制的,復制錯了
原代碼應該是