martrix / yii2-ethnicmedia-client
Ethnicmedia客户端
dev-master
2015-09-10 13:06 UTC
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-09-14 17:42:58 UTC
README
Ethnicmedia客户端
安装
安装此扩展的首选方法是通过 Composer。
运行以下命令之一:
php composer.phar require --prefer-dist martrix/yii2-ethnicmedia-client "*"
或者添加以下内容到您的 composer.json
文件的 require 部分:
"martrix/yii2-ethnicmedia-client": "*"
用法
-
将 'EM_apiKey' => API KEY 添加到 params.php
-
在 SiteController.php 中添加以下内容
public function actions(){ return array( 'emclient' => array( 'class' => '\martrix\ethnicmediaClient\EmclientAction', 'debug' => true, 'lang' => 'en', 'adsLimit' => 20, ), ); } public function actionClassifield(){ $categoryId=Yii::$app->request->get('categoryId'); $page=Yii::$app->request->get('page'); return $this->render('ad',['categoryId'=>$categoryId,'page'=>$page]); }
模板(ad.php)中使用的示例
<?php echo \martrix\ethnicmediaClient\Emformwidget::widget(['adId'=>5]); ?>
<?php echo \martrix\ethnicmediaClient\Emadsdisplaywidget::widget(['categoryId'=>$categoryId,'page'=>$page]); ?>