本文整理汇总了PHP中JHotelUtil::truncate方法的典型用法代码示例。如果您正苦于以下问题:PHP JHotelUtil::truncate方法的具体用法?PHP JHotelUtil::truncate怎么用?PHP JHotelUtil::truncate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JHotelUtil
的用法示例。
在下文中一共展示了JHotelUtil::truncate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
$offer->offer_description = $offer->offer_short_description;
if (strlen($offer->offer_description) > 100) {
echo JHotelUtil::truncate($offer->offer_description, 100, '…', true);
?>
<?php
} else {
echo $offer->offer_description;
}
?>
</div>
<div>
<?php
if (strlen($offer->offer_content) > 300) {
echo JHotelUtil::truncate($offer->offer_content, 300, '…', true);
} else {
echo $offer->offer_content;
}
?>
</div>
<a href="<?php
echo JHotelUtil::getOfferLink($offer, $this->mediaReferer, $this->voucher);
?>
"> <?php
echo JText::_('LNG_READ_MORE', true);
?>
</a>
</div>
<div class="offer-date-interval splStayDate" style="display:none">
示例2: setMarkers
setMarkers(map, hotels);
}
/**
* Data for the markers consisting of a name, a LatLng and a zIndex for
* the order in which these markers should display on top of each
* other.
*/
var hotels = [
<?php
$db = JFactory::getDBO();
foreach ($hotels as $hotel) {
$description = str_replace("\r\n", "", $hotel->hotelDescription);
$description = str_replace("\\\\'", "", $description);
$description = addslashes($description);
$contentString = '<div id="map-content">' . '<h1 id="firstHeading" class="firstHeading">' . $db->escape($hotel->hotel_name) . '</h1>' . '<p>' . '<img src="' . JURI::root() . PATH_PICTURES . $hotel->hotel_picture_path . '" alt="' . $db->escape($hotel->hotel_name) . '">' . JHotelUtil::truncate(strip_tags($description), 180, ' … ', true) . '</p>' . '<p><a href="' . $db->escape(JHotelUtil::getHotelLink($hotel)) . '">' . JText::_('LNG_BOOK_HOTEL', true) . '</a></p>' . '</div>';
echo "['" . $hotel->hotel_name . "', '" . $hotel->hotel_latitude . "','" . $hotel->hotel_longitude . "', 4,'" . $contentString . "']," . "\n";
}
?>
];
function setMarkers(map, locations) {
// Add markers to the map
// Marker sizes are expressed as a Size of X,Y
// where the origin of the image (0,0) is located
// in the top left of the image.
// Origins, anchor positions and coordinates of the marker
// increase in the X direction to the right and in
示例3: round
<?php
echo JText::_("LNG_DISTANCE") . ": " . round($hotel->distance, 1);
?>
km
</div>
<?php
}
?>
<div class="clear"></div>
<div class="hotel-description">
<div>
<?php
$hotelDescription = $hotel->hotel_description;
if (strlen($hotelDescription) > MAX_LENGTH_HOTEL_DESCRIPTION) {
echo JHotelUtil::truncate($hotelDescription, MAX_LENGTH_HOTEL_DESCRIPTION, '…', true);
?>
<a href="<?php
echo JHotelUtil::getHotelLink($hotel);
?>
"> <?php
echo JText::_('LNG_READ_MORE', true);
?>
</a>
<?php
} else {
echo $hotelDescription;
}
?>
</div>
示例4: number_format
echo $item->currency_symbol;
?>
</span><span class="fucsia price"> <?php
echo number_format($price, 2);
?>
</span></div>
<a href="<?php
echo JHotelUtil::getHotelLink($item);
?>
"><?php
echo stripslashes($item->offer_name);
?>
</a>
<p>
<?php
echo JHotelUtil::truncate(strip_tags($item->offer_short_description), 250);
?>
</p>
</div>
</li>
<?php
}
?>
</ul>
</div>
<div class="view-all-offers clearfix">
<a href="<?php
echo JRoute::_('index.php?option=com_jhotelreservation&task=offers.searchOffers');
?>
"><?php