[Solved] Different plugins in different sidebars/areas?
- Torsten_Kelsch
- Legend Bludit
- Posts: 263
- Joined: Thu Aug 27, 2015 10:24 pm
- Location: Germany
- Has thanked: 4 times
- Been thanked: 2 times
- Contact:
I’d like to include different plugins, but not all in the same sidebar; instead, the About plugin in a sidebar or below the main content, and Edi’s new Navigation plugin in a header section. I read the post about sorting plugins: viewtopic.php?f=6&t=1068, but I still don’t know how to show only one of the activated plugins in one area. Is that possible anyway? Any ideas? Thanks in advance.
On Error GoTo Bed
Hi,
take a look to this doc, https://docs.bludit.com/en/developers/plugins
You can check different plugins if are activated and then print the sidebar on part of the theme where you like.
take a look to this doc, https://docs.bludit.com/en/developers/plugins
You can check different plugins if are activated and then print the sidebar on part of the theme where you like.
- Torsten_Kelsch
- Legend Bludit
- Posts: 263
- Joined: Thu Aug 27, 2015 10:24 pm
- Location: Germany
- Has thanked: 4 times
- Been thanked: 2 times
- Contact:
I don’t understand it. I have a PHP file about.php, and another, navi.php. If I put the following code into about.php, for example, it gives me an error like below:
Notice: Undefined index: pluginAbout in /var/www/ud21_353/html/bl-kernel/helpers/theme.class.php on line 151
Warning: Invalid argument supplied for foreach() in /var/www/ud21_353/html/bl-kernel/helpers/theme.class.php on line 151
And if my code is as follows, all activated plugins appear on the web page:
(The difference is in the last line.)
But what I want is: the Navigation plugin on top of the page, and the About plugin on the bottom. What’s my mistake?
Code: Select all
<?php
// Class name of the plugin
$className = 'pluginAbout';
// Get the Plugin-Object
$plugin = getPlugin($className);
Theme::plugins('pluginAbout')
?>
Warning: Invalid argument supplied for foreach() in /var/www/ud21_353/html/bl-kernel/helpers/theme.class.php on line 151
And if my code is as follows, all activated plugins appear on the web page:
Code: Select all
<?php
// Class name of the plugin
$className = 'pluginAbout';
// Get the Plugin-Object
$plugin = getPlugin($className);
Theme::plugins('siteSidebar')
?>
But what I want is: the Navigation plugin on top of the page, and the About plugin on the bottom. What’s my mistake?
On Error GoTo Bed
I don't know where you get this code.
but the idea is this
Code: Select all
<?php
// Class name of the plugin
$className = 'pluginAbout';
// Get the Plugin-Object
$plugin = getPlugin($className);
Theme::plugins('pluginAbout')
?>
Code: Select all
<?php
// Class name of the plugin
$className = 'pluginAbout';
// Get the Plugin-Object
$plugin = getPlugin($className);
echo $plugin->siteSidebar();
?>
- Edi
- Site Admin
- Posts: 3121
- Joined: Sun Aug 09, 2015 5:01 pm
- Location: Zurich
- Has thanked: 54 times
- Been thanked: 78 times
- Contact:
There must be a Helper in the Theme for the Hook of the plugin:Torsten_Kelsch wrote: ↑Mon Feb 19, 2018 9:58 pm(The difference is in the last line.)Code: Select all
<?php // Class name of the plugin $className = 'pluginAbout'; // Get the Plugin-Object $plugin = getPlugin($className); Theme::plugins('siteSidebar') ?>
But what I want is: the Navigation plugin on top of the page, and the About plugin on the bottom. What’s my mistake?
https://docs.bludit.com/en/themes/helper-for-themes
https://docs.bludit.com/en/plugins/hooks-list
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
- Torsten_Kelsch
- Legend Bludit
- Posts: 263
- Joined: Thu Aug 27, 2015 10:24 pm
- Location: Germany
- Has thanked: 4 times
- Been thanked: 2 times
- Contact:
Code: Select all
<aside>
<?php
Theme::plugins('siteSidebar');
?>
</aside>
Or you could also imagine a website with two sidebars, one on the left, one on the right beside the main content.
On Error GoTo Bed
- Torsten_Kelsch
- Legend Bludit
- Posts: 263
- Joined: Thu Aug 27, 2015 10:24 pm
- Location: Germany
- Has thanked: 4 times
- Been thanked: 2 times
- Contact:
Finally I could solve my problem!
And another file called php/navi.php with the code:
And in my index.php I include both of them in different areas:
It’s so easy if you know how to do it. And as soon as you do it right, it works …
Thank you so much, Edi, this works fine for me . Now I have a file php/about.php with the following code:
Code: Select all
<?php
if( $plugins['all']['pluginAbout']->installed() ){
echo '<h3 class="plugin-label">'.$plugins['all']['pluginAbout']->getValue('label').'</h3>';
echo html_entity_decode(nl2br($plugins['all']['pluginAbout']->getValue('text')));
}
?>
Code: Select all
<?php
if( $plugins['all']['pluginNavigation']->installed() ) {
echo '<h3>'.$plugins['all']['pluginNavigation']->getValue('label').'</h3>';
echo'<ul class="menu">';
// Foreach parent-page
foreach ( $pagesByParent[PARENT] as $Parent ) {
echo '<li'.( ($Parent->key()==$Url->slug())?' class="active"':'').'><a href="'.$Parent->permalink().'">'.$Parent->title().'</a></li>';
}
echo '</ul>';
}
?>
Code: Select all
<nav>
<div class="navi">
<?php include(THEME_DIR_PHP.'navi.php'); ?>
</div>
</nav>
Code: Select all
<div class="content">
<aside>
<?php
include(THEME_DIR_PHP.'about.php');
?>
</aside>
</div>
On Error GoTo Bed
- Torsten_Kelsch
- Legend Bludit
- Posts: 263
- Joined: Thu Aug 27, 2015 10:24 pm
- Location: Germany
- Has thanked: 4 times
- Been thanked: 2 times
- Contact:
How can I mark this thread as solved? Or does a moderator have to do this?
On Error GoTo Bed
- Edi
- Site Admin
- Posts: 3121
- Joined: Sun Aug 09, 2015 5:01 pm
- Location: Zurich
- Has thanked: 54 times
- Been thanked: 78 times
- Contact:
Editing the subject of the first post.Torsten_Kelsch wrote: ↑Tue Feb 20, 2018 10:40 pm How can I mark this thread as solved? Or does a moderator have to do this?
I have done it.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets