本文整理汇总了PHP中shopFunctionsF::limitStringByWord方法的典型用法代码示例。如果您正苦于以下问题:PHP shopFunctionsF::limitStringByWord方法的具体用法?PHP shopFunctionsF::limitStringByWord怎么用?PHP shopFunctionsF::limitStringByWord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shopFunctionsF
的用法示例。
在下文中一共展示了shopFunctionsF::limitStringByWord方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display($tpl = NULL)
{
$show_prices = VmConfig::get('show_prices', 1);
if ($show_prices == '1') {
if (!class_exists('calculationHelper')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
}
}
$doc = JFactory::getDocument();
if (!class_exists('VmImage')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php';
}
$productModel = VmModel::getModel('product');
$categoryId = JRequest::getInt('virtuemart_category_id', false);
$feed_show_prices = VmConfig::get('feed_cat_show_prices', 0);
$feed_show_images = VmConfig::get('feed_cat_show_images', 0);
$feed_show_description = VmConfig::get('feed_cat_show_description', 0);
$feed_description_type = VmConfig::get('feed_cat_description_type', 'product_s_desc');
$feed_max_text_length = VmConfig::get('feed_cat_max_text_length', 0);
// Load the products in the given category
$products = $productModel->getProductsInCategory($categoryId);
if ($feed_show_images == 1) {
$productModel->addImages($products, 1);
}
if ($products && $feed_show_prices == 1) {
$currency = CurrencyDisplay::getInstance();
}
foreach ($products as $product) {
$title = $this->escape($product->product_name);
$title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
$description = "";
if ($feed_show_images == 1) {
$effect = " ";
$return = true;
$withDescr = false;
$absUrl = true;
$description = $product->images[0]->displayMediaThumb('style="margin-right: 10px; margin-bottom: 10px; float: left;"', false, $effect, $return, $withDescr, $absUrl);
}
if ($feed_show_description == 1) {
if ($feed_description_type == 'product_s_desc') {
$description .= $product->product_s_desc;
} else {
if ($feed_max_text_length > 0) {
$description .= shopFunctionsF::limitStringByWord($product->product_desc, $feed_max_text_length);
} else {
$description .= $product->product_desc;
}
}
}
if ($feed_show_prices == 1 and $show_prices == 1) {
$description .= $currency->createPriceDiv('variantModification', 'COM_VIRTUEMART_PRODUCT_VARIANT_MOD', $product->prices);
if (round($product->prices['basePriceWithTax'], $currency->_priceConfig['salesPrice'][1]) != $product->prices['salesPrice']) {
$description .= '<span class="price-crossed" >' . $currency->createPriceDiv('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $product->prices) . "</span>";
}
if (round($product->prices['salesPriceWithDiscount'], $currency->_priceConfig['salesPrice'][1]) != $product->prices['salesPrice']) {
$description .= $currency->createPriceDiv('salesPriceWithDiscount', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT', $product->prices);
}
$description .= $currency->createPriceDiv('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices);
$description .= $currency->createPriceDiv('priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $product->prices);
$description .= $currency->createPriceDiv('discountAmount', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT', $product->prices);
$description .= $currency->createPriceDiv('taxAmount', 'COM_VIRTUEMART_PRODUCT_TAX_AMOUNT', $product->prices);
$unitPriceDescription = JText::sprintf('COM_VIRTUEMART_PRODUCT_UNITPRICE', $product->product_unit);
$description .= $currency->createPriceDiv('unitPrice', $unitPriceDescription, $product->prices);
}
if ($feed_description_type == 'product_s_desc' or $feed_max_text_length > 0) {
$description .= '<p class="feed-readmore"><a target="_blank" href ="' . rtrim(JURI::base(), "/") . str_replace(' ', '%20', $product->link) . '">' . JText::_('COM_VIRTUEMART_FEED_READMORE') . '</a></p>';
}
$item = new JFeedItem();
$item->title = $title;
$item->link = $product->link;
$item->date = $product->created_on;
$item->description = '<div class="feed-description">' . $description . '</div>';
$item->category = $categoryId;
$doc->addItem($item);
}
}
示例2: ucfirst
if (!empty($product->images[1])) {
echo $product->images[1]->displayMediaThumb('class="browseProductImage cat_under" border="0" title="' . $product->mf_name . ' ' . ucfirst($product->product_name) . '" ', false, 'class="modal"');
}
}
?>
</div><?php
// imageArea END
?>
<div class="articleDataInfo">
<h3 class="articleBrand"><?php
echo $product->mf_name;
?>
</h3>
<h2 class="articleName"><?php
//echo JHTML::link($product->link, $product->product_name);
echo shopFunctionsF::limitStringByWord(ucfirst($product->product_name), 36, '…');
?>
</h2>
<div class="article-price" id="productPrice<?php
echo $product->virtuemart_product_id;
?>
">
<?php
if ($show_price) {
if (!empty($product->prices['salesPrice'])) {
echo $currency->createPriceDiv('salesPrice', '', $product->prices, FALSE, FALSE, 1.0, TRUE);
if ($product->prices['basePriceWithTax'] != $product->prices['salesPrice'] && $product->prices['basePriceWithTax'] != 0) {
echo $currency->createPriceDiv('basePriceWithTax', '', $product->prices, FALSE, FALSE, 1.0, TRUE);
echo '<div class="discountAmount">-' . round(100 - $product->prices['salesPrice'] * 10000 / ($product->prices['basePriceWithTax'] * 100)) . '%</div>';
}
}
示例3: array
echo $rowsHeight[$row]['price'];
?>
"> <?php
echo shopFunctionsF::renderVmSubLayout('prices', array('product' => $product, 'currency' => $currency));
?>
<div class="clearfix"></div>
</div>
<?php
if (!empty($rowsHeight[$row]['product_s_desc'])) {
?>
<p class="product_s_desc">
<?php
// Product Short Description
if (!empty($product->product_s_desc)) {
echo shopFunctionsF::limitStringByWord($product->product_s_desc, 260, '');
?>
<?php
}
?>
</p>
<?php
}
?>
<div class="clearfix"></div>
</div>
<?php
//echo $rowsHeight[$row]['customs']
?>
<div class="vm-product-addcart vm3pr-<?php
echo $rowsHeight[$row]['customfields'];
示例4:
<span class="categoryLevel"><?php
echo $categoryLevel;
?>
</span>
<a href="<?php
echo $editlink;
?>
"><?php
echo $cat->category_name;
?>
</a>
</td>
<td align="left">
<?php
echo shopFunctionsF::limitStringByWord(JFilterOutput::cleanText($cat->category_description), 200);
?>
</td>
<td>
<?php
echo $this->catmodel->countProducts($cat->virtuemart_category_id);
//ShopFunctions::countProductsByCategory($row->virtuemart_category_id);
?>
<a href="<?php
echo $showProductsLink;
?>
">[ <?php
echo vmText::_('COM_VIRTUEMART_SHOW');
?>
]</a>
</td>
示例5:
</div>
<div>
<h5 class="product-name"><?php
echo JHTML::link($product->link, $product->product_name);
?>
</h5>
<?php
// Product Short Description
if (!empty($product->product_s_desc)) {
?>
<div class="description std">
<div class="inner">
<?php
echo shopFunctionsF::limitStringByWord($product->product_s_desc, 400, '...');
?>
</div>
</div>
<?php
}
?>
</div>
<div>
<div class="product-price cart-cell wish_prize" id="productPrice<?php
echo $product->virtuemart_product_id;
?>
">
示例6: display
public function display($tpl = NULL)
{
$doc = JFactory::getDocument();
$show_prices = VmConfig::get('show_prices', 1);
if ($show_prices == '1') {
if (!class_exists('calculationHelper')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
}
}
if (!class_exists('VmImage')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
}
$productModel = VmModel::getModel('product');
$feed_show_prices = VmConfig::get('feed_home_show_prices', 0);
$feed_show_images = VmConfig::get('feed_home_show_images', 0);
$feed_show_description = VmConfig::get('feed_home_show_description', 0);
$feed_description_type = VmConfig::get('feed_home_description_type', 'product_s_desc');
$feed_max_text_length = VmConfig::get('feed_home_max_text_length', 0);
$products = array();
$featured = array();
$latest = array();
$topten = array();
if (VmConfig::get('feed_featured_published', 1)) {
$featured_nb = VmConfig::get('feed_featured_nb', 3);
$featured = $productModel->getProductListing('featured', $featured_nb);
}
if (VmConfig::get('feed_latest_published', 1)) {
$latest_nb = VmConfig::get('feed_latest_nb', 3);
$latest = $productModel->getProductListing('latest', $latest_nb);
}
if (VmConfig::get('feed_topten_published', 1)) {
$topTen_nb = VmConfig::get('feed_topten_nb', 3);
$topten = $productModel->getProductListing('topten', $topTen_nb);
}
$products = array_merge($products, $featured, $latest, $topten);
if ($feed_show_images == 1) {
$productModel->addImages($products, 1);
}
if ($products && $feed_show_prices == 1) {
$currency = CurrencyDisplay::getInstance();
}
foreach ($products as $product) {
$title = $this->escape($product->product_name);
$description = "";
if ($feed_show_images == 1) {
$effect = " ";
$return = true;
$withDescr = false;
$absUrl = true;
$description = $product->images[0]->displayMediaThumb('style="margin-right: 10px; margin-bottom: 10px; float: left;"', false, $effect, $return, $withDescr, $absUrl);
}
if ($feed_show_description == 1) {
if ($feed_description_type == 'product_s_desc') {
$description .= $product->product_s_desc;
} else {
if ($feed_max_text_length > 0) {
$description .= shopFunctionsF::limitStringByWord($product->product_desc, $feed_max_text_length);
} else {
$description .= $product->product_desc;
}
}
}
if ($feed_show_prices == 1 and $show_prices == 1) {
$description .= $currency->createPriceDiv('variantModification', 'COM_VIRTUEMART_PRODUCT_VARIANT_MOD', $product->prices);
if (round($product->prices['basePriceWithTax'], $currency->_priceConfig['salesPrice'][1]) != $product->prices['salesPrice']) {
$description .= '<span class="price-crossed" >' . $currency->createPriceDiv('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $product->prices) . "</span>";
}
if (round($product->prices['salesPriceWithDiscount'], $currency->_priceConfig['salesPrice'][1]) != $product->prices['salesPrice']) {
$description .= $currency->createPriceDiv('salesPriceWithDiscount', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT', $product->prices);
}
$description .= $currency->createPriceDiv('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices);
$description .= $currency->createPriceDiv('priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $product->prices);
$description .= $currency->createPriceDiv('discountAmount', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT', $product->prices);
$description .= $currency->createPriceDiv('taxAmount', 'COM_VIRTUEMART_PRODUCT_TAX_AMOUNT', $product->prices);
$unitPriceDescription = vmText::sprintf('COM_VIRTUEMART_PRODUCT_UNITPRICE', $product->product_unit);
$description .= $currency->createPriceDiv('unitPrice', $unitPriceDescription, $product->prices);
}
if ($feed_description_type == 'product_s_desc' or $feed_max_text_length > 0) {
$description .= '<p class="feed-readmore"><a target="_blank" href ="' . JRoute::_($product->link) . '">' . vmText::_('COM_VIRTUEMART_FEED_READMORE') . '</a></p>';
}
$item = new JFeedItem();
$item->title = $title;
$item->link = JRoute::_($product->link);
$item->date = $product->created_on;
$item->description = '<div class="feed-description">' . $description . '</div>';
$item->category = $product->virtuemart_category_id;
$doc->addItem($item);
}
}