本文整理汇总了PHP中Pages::getInstancesByType方法的典型用法代码示例。如果您正苦于以下问题:PHP Pages::getInstancesByType方法的具体用法?PHP Pages::getInstancesByType怎么用?PHP Pages::getInstancesByType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pages
的用法示例。
在下文中一共展示了Pages::getInstancesByType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
/**
* wizard for creating online store
*
* PHP version 5.2
*
* @category None
* @package None
* @author Conor Mac Aoidh <conormacaoidh@gmail.com>
* @author Kae Verens <kae@kvsites.ie>
* @license GPL 2.0
* @link http://kvsites.ie/
*/
$p = Pages::getInstancesByType('online-store');
if (@count($p->pages)) {
echo '<em>' . __('You already have an online-store checkout page created') . '</em>';
echo '<p>' . __('Maybe you want to') . ' <a href="./plugin.php?_plugin=products&_page=' . 'products-edit">' . __('add a new product') . '</a> ' . __('instead?') . '</p>';
}
WW_addScript('online-store/admin/wizard.js');
echo '<h1>' . __('Online Store Wizard') . '</h1>
<div id="preview-dialog"></div>
<ul class="sub-nav" id="register-progress" style="list-style-type:none">
<li>' . __('Store') . '</li>
<li>' . __('Payment Details') . '</li>
<li>' . __('Company Details') . '</li>
<li>' . __('Products') . '</li>
<li>' . __('Finish') . '</li>
</ul>
</div>
<p id="error"></p>
示例2: urlencode
$url = '/';
} else {
$url = $p->getRelativeUrl();
}
if (isset($_REQUEST['login_referer'])) {
$url .= '?login_referer=' . urlencode($_REQUEST['login_referer']);
}
$url .= '#Login';
break;
// }
// }
default:
// {
$get = array();
foreach ($_GET as $k => $v) {
if ($k != 'type') {
$get[] = urlencode($k) . '=' . urlencode($v);
}
}
$p = Pages::getInstancesByType($type);
if (!count($p) || !count($p->pages)) {
$url = '/';
} else {
$url = $p->pages[0]->getRelativeUrl();
}
if (count($get)) {
$url .= '?' . join('&', $get);
}
// }
}
redirect($url);