本文整理匯總了PHP中Sections::post_default方法的典型用法代碼示例。如果您正苦於以下問題:PHP Sections::post_default方法的具體用法?PHP Sections::post_default怎麽用?PHP Sections::post_default使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sections
的用法示例。
在下文中一共展示了Sections::post_default方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: lookup
/**
* get the id of one section knowing its nick name
*
* At the moment following section nick names are used throughout yacs:
* - 'clicks' - to host external link that are embed into ordinary pages
* - 'covers' - pages to be displayed as introductory articles at the front page
* - 'forum' - the coffee machine, for those that are not drinking so much coffee
* - 'extra_boxes' - page to be displayed as small boxes at the front page
* - 'letters' - pages sent by e-mail to subscribers
* - 'menus' - page to be displayed on all pages as the main site menu
* - 'my_section' - sample section for demonstrattion purpose
* - 'navigation_boxes' - pages to be displayed as small boxes on all pages
* - 'partners' - pages dedicated to external partners
* - 'queries' - pages sent by surfers to submit their queries to the webmaster
*
* @param string the nick name looked for
* @return string either 'section:<id>', or NULL
*
* @see articles/populate.php
* @see articles/review.php
* @see index.php
* @see letters/index.php
* @see letters/new.php
* @see links/index.php
* @see links/links.php
*/
public static function lookup($nick_name)
{
global $context;
// the section already exists
if ($item = Sections::get($nick_name)) {
return 'section:' . $item['id'];
}
// attempt to create a default item
Sections::post_default($nick_name);
// do the check again
if ($item = Sections::get($nick_name)) {
return 'section:' . $item['id'];
}
// tough luck
return NULL;
}