diff --git a/app/index/controller/Article.php b/app/index/controller/Article.php index c60f279018ce7909ce96a334107ddfe9e1a1ef11..60728cf60615aa6086e3dffc3f72fb09f941101a 100755 --- a/app/index/controller/Article.php +++ b/app/index/controller/Article.php @@ -89,8 +89,9 @@ class Article extends Common { MyViewAssign('home_seo_site_description', $ret['data'][0]['seo_desc']); } - - MyViewAssign('article', $ret['data'][0]); + $article = $ret['data'][0]; + $this->PluginsHook($id, $article); + MyViewAssign('article', $article); return MyView(); } @@ -98,5 +99,33 @@ class Article extends Common MyViewAssign('msg', '文章不存在或已删除'); return MyView('public/tips_error'); } + + /** + * 钩子处理 + * @author whats + * @blog + * @version 1.0.0 + * @date 2019-04-22 + * @desc description + * @param [int] $article_id [文章id] + * @param [array] $params [输入参数] + */ + private function PluginsHook($article_id, &$article) + { + $hook_arr = [ + //文章内容内部钩子 + 'plugins_view_article_detail_content_within', + ]; + foreach($hook_arr as $hook_name) + { + MyViewAssign($hook_name.'_data', MyEventTrigger($hook_name, + [ + 'hook_name' => $hook_name, + 'is_backend' => false, + 'article_id' => $article_id, + 'article' => &$article, + ])); + } + } } ?> \ No newline at end of file diff --git a/app/index/view/default/article/index.html b/app/index/view/default/article/index.html index 42cb32310041ae77bbae556b3e35f7d5933f51cb..6cd012c78fd67ae22b4ff0959bce57415ad7fb33 100755 --- a/app/index/view/default/article/index.html +++ b/app/index/view/default/article/index.html @@ -25,6 +25,19 @@
{{$article.content|raw}}
+ + {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}} +
+ plugins_view_article_detail_content_within +
+ {{/if}} + {{if !empty($plugins_view_article_detail_content_within_data) and is_array($plugins_view_article_detail_content_within_data)}} + {{foreach $plugins_view_article_detail_content_within_data as $hook}} + {{if is_string($hook) or is_int($hook)}} + {{$hook|raw}} + {{/if}} + {{/foreach}} + {{/if}}