本文整理汇总了PHP中TPage::getByTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP TPage::getByTitle方法的具体用法?PHP TPage::getByTitle怎么用?PHP TPage::getByTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPage
的用法示例。
在下文中一共展示了TPage::getByTitle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
echo isset($search_type) && $search_type == 'sub' ? " selected" : '';
?>
>substring search</option>
</select>
<input type="submit" value="view page">
</form>
<?php
if (isset($page_title)) {
if (isset($search_type) && $search_type == 'sub') {
$page_title = "%{$page_title}%";
}
$limit_request = 100;
Piwidict::setLimitRequest($limit_request);
$tpage = new TPage();
$total_num = $tpage->countPageByTitle($page_title);
$pageObj_arr = $tpage->getByTitle($page_title);
if ($pageObj_arr == NULL) {
print "<p>The word has not founded.</p>\n";
} else {
if ($total_num > 1) {
print "<p>There are founded {$total_num} words.</p>\n";
if ($limit_request > 0 && $limit_request < $total_num) {
print "Restriction on the search for a maximum of {$limit_request} records";
}
//ограничение на поиск не более 100 записей
}
if (is_array($pageObj_arr)) {
foreach ($pageObj_arr as $pageObj) {
print "<h2 title=\"TPage->page_title\" style=\"color: #006a4e\">" . $pageObj->getPageTitle() . "</h2>\n" . "<p>Source page at " . TPage::getURLWithLinkText($pageObj->getPageTitle()) . "</p>";
$lang_pos_arr = $pageObj->getLangPOS();
if (is_array($lang_pos_arr)) {
示例2: getPageRelations
/** Gets list of semantically related words.
* If page title is not exist, then return empty array.
* @return array, where keys are related words, values are arrays of their relation type names
*/
public static function getPageRelations($page_title)
{
$relations = array();
// return array, if exact search then returns only one word
list($page_obj) = TPage::getByTitle($page_title);
$lang_pos_arr = $page_obj->getLangPOS();
if (is_array($lang_pos_arr)) {
foreach ($lang_pos_arr as $lang_pos_obj) {
$meaning_arr = $lang_pos_obj->getMeaning();
if (is_array($meaning_arr)) {
foreach ($meaning_arr as $meaning_obj) {
$relation_arr = $meaning_obj->getRelation();
if (is_array($relation_arr)) {
foreach ($relation_arr as $relation_obj) {
$relations[$relation_obj->getWikiText()->getText()][] = $relation_obj->getRelationType()->getName();
}
}
}
}
}
}
ksort($relations);
return $relations;
}
示例3: list
// SimpleXMLElement Object
$dword = $elem->DestWord;
// SimpleXMLElement Object
$srel = $elem->SemanticRelation;
// String
$sword_title = $sword->word;
// String
$dword_title = $dword->word;
// String
$sword_mean = $sword->meaning;
// String
$dword_mean = $dword->meaning;
// String
list($sword_tpage) = TPage::getByTitle($sword_title);
// TPage object
$dword_tpage = TPage::getByTitle($dword_title);
// TPage object
//print_r($sword_tpage);
print "{$sword_title}({$sword_id}) = {$sword_mean}\n\n";
// checking if those meanings exist in DB
$sword_lang_pos_arr = $sword_tpage->getLangPOS();
if (is_array($sword_lang_pos_arr)) {
foreach ($sword_lang_pos_arr as $langPOSObj) {
$meaning_arr = $langPOSObj->getMeaning();
if (is_array($meaning_arr)) {
foreach ($meaning_arr as $meaningObj) {
$meaning_id = $meaningObj->getID();
$meaning_wiki_text = $meaningObj->getWikiText()->getWikifiedText();
print "<li>{$meaning_wiki_text}";
}
}