本文整理汇总了PHP中Subject::print_name方法的典型用法代码示例。如果您正苦于以下问题:PHP Subject::print_name方法的具体用法?PHP Subject::print_name怎么用?PHP Subject::print_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subject
的用法示例。
在下文中一共展示了Subject::print_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_names
public function get_names()
{
$temp_subject = new Subject();
$temp_subject->load($this->subject_id_1);
$this->subject_1_name = $temp_subject->print_name();
$temp_subject->load($this->subject_id_2);
$this->subject_2_name = $temp_subject->print_name();
}
示例2: array
$query = $db->prepare("SELECT id, subject_name, date_updated FROM subjects WHERE subject_name LIKE ? ORDER BY subject_name");
$data = array('%' . $q . '%');
if ($query->execute($data)) {
while ($row = $query->fetch()) {
$output .= '<p><a href="index.php?p=subject_view&id=' . $row['id'] . '">' . $row['subject_name'] . '</a><br /><span class="small">Updated: ' . $row['date_updated'] . '</span></p>';
}
}
// Next, see if the query appears in any aspects, and return the Subject if that's the case.
$aspect_q = $db->prepare("SELECT * FROM aspects INNER JOIN aspect_types ON aspects.aspect_type=aspect_types.id INNER JOIN subjects_aspects ON aspects.id=subjects_aspects.aspect_id WHERE aspect_data LIKE ?");
if ($aspect_q->execute($data)) {
$output .= "<h3>Aspect Results:</h3>";
while ($row = $aspect_q->fetch()) {
$ts = new Subject();
$ts->load($row['subject_id']);
$output .= '<p>';
$output .= 'Found in an aspect of ' . $ts->print_name();
$output .= '</p>';
}
}
// finally, let's query the web.
$ddg = new DuckAgent();
$ddg->query($q);
if (!empty($ddg->result)) {
$output .= '<h3>From the web:</h3>';
$websearch = json_decode($ddg->result, true);
if (isset($websearch['AbstractText'])) {
$output .= '<p>Abstract: ' . $websearch['AbstractText'] . '<br /> <span class="small">Source: ' . $websearch['AbstractSource'] . '</span></p>';
}
if (!empty($websearch['Definition'])) {
$output .= '<p>Definition: ' . $websearch['Definition'] . '</p>';
}