本文整理汇总了PHP中K2HelperRoute::getSearchRoute方法的典型用法代码示例。如果您正苦于以下问题:PHP K2HelperRoute::getSearchRoute方法的具体用法?PHP K2HelperRoute::getSearchRoute怎么用?PHP K2HelperRoute::getSearchRoute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类K2HelperRoute
的用法示例。
在下文中一共展示了K2HelperRoute::getSearchRoute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSearch
public static function getSearch($params)
{
$application = JFactory::getApplication();
$search = new stdClass();
$search->action = JRoute::_(K2HelperRoute::getSearchRoute());
$search->text = $params->get('text', JText::_('K2_SEARCH'));
$search->width = intval($params->get('width', 20));
$search->maxLength = $search->width > 20 ? $search->width : 20;
$search->button = $params->get('button');
$search->buttonText = htmlspecialchars($params->get('button_text', JText::_('K2_SEARCH')));
$search->imageButton = $params->get('imagebutton');
$search->buttonPosition = $params->get('button_pos', 'left');
$search->sef = $application->getCfg('sef');
$search->filter = '';
$filter = $params->get('category_id');
if ($filter && isset($filter->enabled) && $filter->enabled) {
$model = K2Model::getInstance('Categories');
$categories = K2ModelCategories::getCategoryFilter($filter->categories, $filter->recursive, true);
$search->filter = implode(',', $categories);
}
if ($params->get('liveSearch')) {
$document = JFactory::getDocument();
if ($document->getType() == 'html') {
$document->addScript(JURI::root(true) . '/media/k2app/vendor/underscore/underscore-min.js?v=3.0.0');
$document->addScriptDeclaration('var K2Site = "' . JURI::root(true) . '";');
}
}
return $search;
}
示例2: defined
*/
// no direct access
defined('_JEXEC') or die;
?>
<?php
$labels = explode(',', $field->get('value'));
?>
<?php
if (is_array($labels)) {
?>
<?php
foreach ($labels as $label) {
?>
<?php
if ($label = trim($label)) {
?>
<a href="<?php
echo JRoute::_(K2HelperRoute::getSearchRoute() . '&searchword=' . urlencode($label)) . '">' . $label;
?>
</a>
<?php
}
?>
<?php
}
}
?>
示例3:
require JModuleHelper::getLayoutPath('mod_k2_tools', 'calendar');
break;
case '3':
$breadcrumbs = modK2ToolsHelper::breadcrumbs($params);
$path = $breadcrumbs[0];
$title = $breadcrumbs[1];
require JModuleHelper::getLayoutPath('mod_k2_tools', 'breadcrumbs');
break;
case '4':
$output = modK2ToolsHelper::treerecurse($params, 0, 0, true);
require JModuleHelper::getLayoutPath('mod_k2_tools', 'categories');
break;
case '5':
echo modK2ToolsHelper::treeselectbox($params);
break;
case '6':
$categoryFilter = modK2ToolsHelper::getSearchCategoryFilter($params);
$action = JRoute::_(K2HelperRoute::getSearchRoute());
require JModuleHelper::getLayoutPath('mod_k2_tools', 'search');
break;
case '7':
$tags = modK2ToolsHelper::tagCloud($params);
if (count($tags)) {
require JModuleHelper::getLayoutPath('mod_k2_tools', 'tags');
}
break;
case '8':
$customcode = modK2ToolsHelper::renderCustomCode($params);
require JModuleHelper::getLayoutPath('mod_k2_tools', 'customcode');
break;
}
示例4: getSearchItems
protected function getSearchItems($count = false)
{
// Get application
$application = JFactory::getApplication();
// Get input
$search = trim($application->input->get('searchword', '', 'string'));
// Determine offset and limit based on document type
if ($this->type == 'html' || $this->type == 'raw') {
$this->limit = $application->input->get('limit', 10, 'int');
} else {
$this->limit = $this->params->get('feedLimit', 10, 'int');
}
// Get items
if ($search) {
$model = K2Model::getInstance('Items');
$model->setState('site', true);
$model->setState('search', $search);
$model->setState('limit', $this->limit);
$model->setState('limitstart', $this->offset);
$this->items = $model->getRows();
// Count items
if ($count) {
$this->total = $model->countRows();
}
} else {
$this->items = array();
$this->total = 0;
}
// Form action
$this->action = JRoute::_(K2HelperRoute::getSearchRoute());
// Search word
$this->searchword = $search;
}