<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) PHPFusion Inc
| https://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: /Nebula/Mainframe.php
| Author: Hien (Frederick MC Chan)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
namespace ThemePack\Nebula;
use PHPFusion\SiteLinks;
use ThemeFactory\Core;
class MainFrame extends Core {
private function NebulaHeader() {
echo renderNotices(getNotices(array('all', FUSION_SELF)));
$defaultBg = ($this->getParam('headerBg') === TRUE ? " class=\"headerBg\"" : "");
$headerBg = ($this->getParam('headerBg_class') ? " class=\"".$this->getParam('headerBg_class')."\"" : $defaultBg);
echo "<header ".$headerBg.">\n";
echo "<div class='headerInner'>\n";
$menu_config = [
'container' => TRUE,
'navbar_class' => 'navbar-default',
'language_switcher' => TRUE,
'searchbar' => TRUE,
'caret_icon' => 'fa fa-angle-down',
'show_banner' => TRUE,
'grouping' => fusion_get_settings('links_grouping'),
'links_per_page' => fusion_get_settings('links_per_page'),
'show_header' => TRUE
];
echo SiteLinks::setSubLinks($menu_config)->showSubLinks();
add_to_jquery("
$('#".SiteLinks::MenuDefaultID."').affix({
offset: {
top: 100,
bottom: function () {
return (this.bottom = $('.footer').outerHeight(true))
}
}
})
");
}
}
<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) PHPFusion Inc
| https://www.php-fusion.co.uk/
+--------------------------------------------------------*/
$menu_config = [
'container' => TRUE,
'navbar_class' => 'navbar-default',
'language_switcher' => TRUE,
'searchbar' => TRUE,
'caret_icon' => 'fa fa-angle-down',
'show_banner' => TRUE,
'grouping' => fusion_get_settings('links_grouping'),
'links_per_page' => fusion_get_settings('links_per_page'),
'show_header' => TRUE
];
echo SiteLinks::setSubLinks($menu_config)->showSubLinks();
add_to_jquery("
$('#".SiteLinks::MenuDefaultID."').affix({
offset: {
top: 100,
bottom: function () {
return (this.bottom = $('.footer').outerHeight(true))
}
}
})
");
Quote
Response: You have a namespace error. The thing is, you need to always use the full namespace if you're unsure. Since your panel is not defined any class, and did not assign any namespace, our autoloader won't be able to find Sitelinks class. Please review my answer below this.
<?php
$menu_config = [
'container' => TRUE,
'navbar_class' => 'navbar-default',
'language_switcher' => TRUE,
'searchbar' => TRUE,
'caret_icon' => 'fa fa-angle-down',
'show_banner' => TRUE,
'grouping' => fusion_get_settings('links_grouping'),
'links_per_page' => fusion_get_settings('links_per_page'),
'show_header' => TRUE
];
echo \PHPFusion\SiteLinks::setSubLinks($menu_config)->showSubLinks();
add_to_jquery("
$('#".\PHPFusion\SiteLinks::MenuDefaultID."').affix({
offset: {
top: 100,
bottom: function () {
return (this.bottom = $('.footer').outerHeight(true))
}
}
})
");
$menu_config = [
'container' => TRUE,
'navbar_class' => 'navbar-default',
'language_switcher' => TRUE,
'searchbar' => TRUE,
'caret_icon' => 'fa fa-angle-down',
'show_banner' => TRUE,
'grouping' => fusion_get_settings('links_grouping'),
'links_per_page' => fusion_get_settings('links_per_page'),
'show_header' => TRUE
];
echo \PHPFusion\SiteLinks::setSubLinks($menu_config)->showSubLinks();
add_to_jquery("
$('#".\PHPFusion\SiteLinks::MenuDefaultID."').affix({
offset: {
top: 100,
bottom: function () {
return (this.bottom = $('.footer').outerHeight(true))
}
}
})
");
\PHPFusion\Panels::addPanel('my_menu_bind', \PHPFusion\SiteLinks::setSubLinks($menu_config)->showSubLinks(), \PHPFusion\Panels::PANEL_U_CENTER, iGUEST, 1);
\ThemeFactory\Core::setParam('header_content', \PHPFusion\SiteLinks::setSubLinks($menu_config)->showSubLinks());
\PHPFusion\Panels::PANEL_U_CENTER;
\PHPFusion\Panels::PANEL_L_CENTER;
\PHPFusion\Panels::PANEL_RIGHT;
\PHPFusion\Panels::PANEL_LEFT;
\PHPFusion\Panels::PANEL_AU_CENTER;
\PHPFusion\Panels::PANEL_BL_CENTER;
\PHPFusion\Panels::PANEL_USER1;
\PHPFusion\Panels::PANEL_USER2;
\PHPFusion\Panels::PANEL_USER3;
\PHPFusion\Panels::PANEL_USER4;
\PHPFusion\OutputHandler::
function somefunction() {
...
}
\PHPFusion\OutputHandler::addHandler(somefunction);
/**
* Replace something in the output using regexp
*
* @param string $target Regexp pattern without delimiters
* @param string $replace The new content
* @param string $modifiers Regexp modifiers
*/
public static function replaceInOutput($target, $replace, $modifiers = "") {
self::$outputHandlers[] = function ($output) use ($target, $replace, $modifiers) {
return preg_replace('^'.preg_quote($target, "^").'^'.$modifiers, $replace, $output);
};
}
Quote
Code Download source<?php
$menu_config = [
'container' => TRUE,
'navbar_class' => 'navbar-default',
'language_switcher' => TRUE,
'searchbar' => TRUE,
'caret_icon' => 'fa fa-angle-down',
'show_banner' => TRUE,
'grouping' => fusion_get_settings('links_grouping'),
'links_per_page' => fusion_get_settings('links_per_page'),
'show_header' => TRUE
];
echo \PHPFusion\SiteLinks::setSubLinks($menu_config)->showSubLinks();
add_to_jquery("
$('#".\PHPFusion\SiteLinks::MenuDefaultID."').affix({
offset: {
top: 100,
bottom: function () {
return (this.bottom = $('.footer').outerHeight(true))
}
}
})
");
I have tested myself. If don't work for you, make sure you have the latest custom page git.
You do understand this method only work for 1 single page, and it's going to be troublesome to add every page?
- by Chan
\ThemeFactory\Core::setParam('LEFT', FALSE);
Panels::getInstance()->hide_panel('LEFT');
Category Forum
Modifications and Requests - 9Labels
None yet
Statistics
2 participants
Notifications
You are not receiving notifications from this thread.
Related Questions