mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
Added example to _blank plugin for {---BREADCRUMB---} integration.
This commit is contained in:
parent
ee59e5cc85
commit
ff9666c5f6
@ -3383,7 +3383,7 @@ class e107
|
||||
* @param bool $options['legacy'] When true legacy urls will be generated regardless of mod-rewrite status.
|
||||
* @return string
|
||||
*/
|
||||
public static function url($plugin='',$key, $row=array(), $options = array())
|
||||
public static function url($plugin='', $key=null, $row=array(), $options = array())
|
||||
{
|
||||
|
||||
/* backward compat - core keys. ie. news/xxx/xxx user/xxx/xxx etc, */
|
||||
|
@ -32,18 +32,19 @@ class _blank_front
|
||||
public function run()
|
||||
{
|
||||
|
||||
$sql = e107::getDB(); // mysql class object
|
||||
$sql = e107::getDb(); // mysql class object
|
||||
$tp = e107::getParser(); // parser for converting to HTML and parsing templates etc.
|
||||
$frm = e107::getForm(); // Form element class.
|
||||
$ns = e107::getRender(); // render in theme box.
|
||||
|
||||
|
||||
$this->setBreadcrumb(); // custom method (see below) - define breadcrumb.
|
||||
|
||||
$text = '';
|
||||
|
||||
|
||||
// $sc = e107::getScBatch('_blank',true, '_blank');
|
||||
// $template = e107::getTemplate('_blank','_blank','default');
|
||||
|
||||
// $text = $tp->parseTemplate($template['start'],true, $sc);
|
||||
|
||||
if($rows = $sql->retrieve('blank','*',false,'',true)) // combined select and fetch function - returns an array.
|
||||
@ -69,6 +70,30 @@ class _blank_front
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Custom function to calculate breadcrumb for the current page.
|
||||
* @return null
|
||||
*/
|
||||
private function setBreadcrumb()
|
||||
{
|
||||
$breadcrumb = array();
|
||||
|
||||
$breadcrumb[] = array('text' => 'Blank Plugin', 'url' => e107::url('_blank', 'index')); // @see e_url.php
|
||||
|
||||
if(!empty($_GET['other'])) // @see e_url 'other' redirect.
|
||||
{
|
||||
$breadcrumb[] = array('text' => 'Other', 'url' => null); // Use null to omit link for current page.
|
||||
}
|
||||
|
||||
e107::breadcrumb($breadcrumb); // assign values to the Magic Shortcode: {---BREADCRUMB---}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private function renderComments()
|
||||
{
|
||||
|
||||
|
@ -27,9 +27,9 @@ class _blank_url // plugin-folder + '_url'
|
||||
|
||||
$config['other'] = array(
|
||||
'alias' => '_blank', // default alias '_blank'. {alias} is substituted with this value below. Allows for customization within the admin area.
|
||||
'regex' => '^{alias}/?$', // matched against url, and if true, redirected to 'redirect' below.
|
||||
'sef' => '{alias}', // used by e107::url(); to create a url from the db table.
|
||||
'redirect' => '{e_PLUGIN}_blank/_blank.php', // file-path of what to load when the regex returns true.
|
||||
'regex' => '^{alias}/other/?$', // matched against url, and if true, redirected to 'redirect' below.
|
||||
'sef' => '{alias}/other/', // used by e107::url(); to create a url from the db table.
|
||||
'redirect' => '{e_PLUGIN}_blank/_blank.php?other=1', // file-path of what to load when the regex returns true.
|
||||
|
||||
);
|
||||
|
||||
@ -45,5 +45,4 @@ class _blank_url // plugin-folder + '_url'
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user