本文整理汇总了PHP中Topic::objects方法的典型用法代码示例。如果您正苦于以下问题:PHP Topic::objects方法的具体用法?PHP Topic::objects怎么用?PHP Topic::objects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Topic
的用法示例。
在下文中一共展示了Topic::objects方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __
<input type="hidden" name="a" value="search"/>
<input type="text" name="q" class="search" placeholder="<?php
echo __('Search our knowledge base');
?>
"/>
<input type="submit" style="display:none" value="search"/>
</form>
</div>
<div class="content">
<section>
<div class="header"><?php
echo __('Help Topics');
?>
</div>
<?php
foreach (Topic::objects()->annotate(array('faqs_count' => SqlAggregate::count('faqs')))->filter(array('faqs_count__gt' => 0)) as $t) {
?>
<div><a href="?topicId=<?php
echo urlencode($t->getId());
?>
"
><?php
echo $t->getFullName();
?>
</a></div>
<?php
}
?>
</section>
<section>
<div class="header"><?php
示例2: foreach
?>
</div>
</div>
</div>
<div class="span4">
<div class="sidebar">
<div class="content">
<section>
<div class="header"><?php
//echo __('Help Topics');
?>
</div>
<?php
foreach (Topic::objects()->filter(array('faqs__faq__category__category_id' => $category->getId())) as $t) {
?>
<a href="?topicId=<?php
echo urlencode($t->getId());
?>
"
><?php
echo $t->getFullName();
?>
</a>
<?php
}
?>
</section>
</div>
</div>
示例3: __
<?php
} else {
echo __('NO FAQs found');
}
?>
</div>
<div class="span4">
<div class="sidebar">
<div class="searchbar">
<form method="get" action="faq.php">
<input type="hidden" name="a" value="search"/>
<select name="topicId" style="width:100%;max-width:100%"
onchange="javascript:this.form.submit();">
<option value="">— Browse by Topic —</option>
<?php
$topics = Topic::objects()->annotate(array('has_faqs' => SqlAggregate::COUNT('faqs')))->filter(array('has_faqs__gt' => 0));
foreach ($topics as $T) {
?>
<option value="<?php
echo $T->getId();
?>
"><?php
echo $T->getFullName();
?>
</option>
<?php
}
?>
</select>
</form>
</div>