本文整理汇总了PHP中SiteHelper::getSlug方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteHelper::getSlug方法的具体用法?PHP SiteHelper::getSlug怎么用?PHP SiteHelper::getSlug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SiteHelper
的用法示例。
在下文中一共展示了SiteHelper::getSlug方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public function actionIndex()
{
$limit = 50;
$p = (int) Yii::app()->request->getParam("p", 1);
$catalog = Yii::app()->request->getParam("catalog", "");
Yii::app()->page->title = "Выставить слаг";
if (!empty($catalog)) {
$catalogS = SiteHelper::getCamelCase($catalog);
$items = $catalogS::fetchAll(DBQueryParamsClass::CreateParams()->setLimit($limit)->setCache(0)->setPage($p));
sizeof($items);
for ($i = 0; $i < sizeof($items); $i++) {
$items[$i]->slug = SiteHelper::getSlug($items[$i]);
}
if (sizeof($items) > 0) {
$this->redirect(SiteHelper::createUrl("/console/SetSlug", array("catalog" => $catalog, "p" => $p + 1)));
}
} else {
$items = array();
}
$this->render("index", array("items" => $items));
}
示例2: setTranslate
public static function setTranslate($model, $transModel, $lang = "en")
{
$lA = explode("-", $lang);
$lang = $lA[0];
$name = TranslateHelper::translate($model->name, $lang);
if (property_exists($model, "description")) {
if ($model->description) {
$text = TranslateHelper::translate($model->description, $lang);
} else {
$text = "";
}
}
$text = str_replace(array("< p", "< div"), array("<p", "<div"), $text);
$requiredFields = $model->getSafeAtributes();
for ($i = 0; $i < sizeof($requiredFields); $i++) {
$field = trim($requiredFields[$i]);
$transModel->{$field} = $model->{$field};
}
$transModel->id = $model->id;
$transModel->name = $name;
if (property_exists($transModel, "location")) {
if ($model->location) {
$transModel->location = TranslateHelper::translate($model->location, $lang);
}
}
if (property_exists($transModel, "address")) {
if ($model->address) {
$transModel->address = TranslateHelper::translate($model->address, $lang);
}
}
if (property_exists($model, "description")) {
$transModel->description = $text;
}
if (!$transModel->save()) {
print_r($transModel->getErrors());
} elseif (property_exists($transModel, "slug")) {
SiteHelper::getSlug($transModel);
}
}
示例3:
<?php
if (!$tour->slug) {
$tour->slug = SiteHelper::getSlug($tour);
}
$listImages = ImageHelper::getImages($tour, 1);
?>
<div class="IBItem IBTours">
<?php
if ($tour->price > 0) {
?>
<p><?php
echo Yii::t("page", "цена");
?>
:<b><?php
echo $tour->price;
?>
</b>у.е.</p><?php
}
?>
<?php
if ($tour->col > 0) {
?>
<div class="floatRight rightInfo"><?php
echo Yii::t("page", "просмотров");
?>
: <b><?php
echo $tour->col;
?>
</b></div><?php
示例4:
<?php
if (!$item->slug) {
$item->slug = SiteHelper::getSlug($item);
}
$images = ImageHelper::getImages($item, 1);
?>
<div class="IBItem">
<?php
if (sizeof($images) > 0) {
?>
<div class="IBIImage">
<a href="<?php
echo SiteHelper::createUrl("/" . $link . "/description") . "/" . $item->slug;
?>
.html" title="<?php
echo SiteHelper::getStringForTitle($item->name . "," . $item->firm_id->name);
?>
"><img src="<?php
echo ImageHelper::getImage($images[0]->image, 2);
?>
" alt="<?php
echo SiteHelper::getStringForTitle($item->name . "," . $item->firm_id->name);
?>
" /></a>
</div>
<?php
}
?>
<?php