本文整理匯總了PHP中TextHelper::h方法的典型用法代碼示例。如果您正苦於以下問題:PHP TextHelper::h方法的具體用法?PHP TextHelper::h怎麽用?PHP TextHelper::h使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TextHelper
的用法示例。
在下文中一共展示了TextHelper::h方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: auto_complete_result
/**
* Use this method in your view to generate a return for the AJAX autocomplete requests.
*
* Example action:
*
* function auto_complete_for_item_title()
* {
* $this->items = $Item->find('all', array('conditions' => array('strtolower($description).' LIKE ?', '%' . strtolower($this->_controller->Request->getRawPostData(). '%' ))))
* return $this->_controller->render(array('inline'=> '<?= $javascript_macros->auto_complete_result(@$items, 'description') ?>'));
* }
*
* The auto_complete_result can of course also be called from a view belonging to the
* auto_complete action if you need to decorate it further.
*
* @deprecated
*/
function auto_complete_result($entries, $field, $phrase = null)
{
if (empty($entries)) {
return '';
}
foreach ($entries as $entry) {
$items[] = TagHelper::content_tag('li',!empty($phrase) ? TextHelper::highlight(TextHelper::h($entry[$field]), $phrase) : TextHelper::h(@$entry[$field]));
}
return TagHelper::content_tag('ul', join('', array_unique($items)));
}