Page 1 of 2
Sidebar links & images
Posted: Sat Mar 12, 2016 9:53 am
by loud
Hello,
Just wondering how its possible to add external links and images in the sidebar?
Thanks
Re: Sidebar links & images
Posted: Sat Mar 12, 2016 10:38 am
by Fred
Hi,
Yes edit the about plugin in backend, you can change the title and content
Re: Sidebar links & images
Posted: Sat Mar 12, 2016 10:49 am
by loud
Yeah, this is the first thing I tried, but href links didnt work, and neither did bludit blog formated links, Im sure Im missing something really obvious here!
Re: Sidebar links & images
Posted: Sat Mar 12, 2016 6:35 pm
by Edi
If you use the plugin "About" the characters for < and > have to be converted when they are used for an html tag.
You can modify the file plugin.php as follows:
Code: Select all
public function siteSidebar()
{
$about = $this->getDbField('text');
$about = htmlspecialchars_decode($about);
echo $about;
$html = '<div class="plugin plugin-about">';
$html .= '<h2>'.$this->getDbField('label').'</h2>';
$html .= '<div class="plugin-content">';
$html .= nl2br($about);
$html .= '</div>';
$html .= '</div>';
return $html;
}
Re: Sidebar links & images
Posted: Sat Mar 12, 2016 8:01 pm
by abdulhalim
Thank you Edi ,
This was my question too , today i was struggling with my question
but this solution has a problem , at least for me , it duplicates the content , image or text will show twice
Re: Sidebar links & images
Posted: Sat Mar 12, 2016 8:14 pm
by loud
I actually tried that mod but corrupted something, so will reinstall the blog and try again later, thanks for helping
Re: Sidebar links & images
Posted: Sat Mar 12, 2016 8:16 pm
by abdulhalim
I remove echo $about ; , now it's working perfectly ... Thank you Edi
Code: Select all
<?php
class pluginAbout extends Plugin {
public function init()
{
$this->dbFields = array(
'label'=>'About',
'text'=>''
);
}
public function form()
{
global $Language;
$html = '<div>';
$html .= '<label>'.$Language->get('Plugin label').'</label>';
$html .= '<input name="label" id="jslabel" type="text" value="'.$this->getDbField('label').'">';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$Language->get('About').'</label>';
$html .= '<textarea name="text" id="jstext">'.$this->getDbField('text').'</textarea>';
$html .= '</div>';
return $html;
}
public function siteSidebar()
{
$about = $this->getDbField('text');
$about = htmlspecialchars_decode($about);
$html = '<div class="plugin plugin-about">';
$html .= '<h2>'.$this->getDbField('label').'</h2>';
$html .= '<div class="plugin-content">';
$html .= nl2br($about);
$html .= '</div>';
$html .= '</div>';
return $html;
}
}
Re: Sidebar links & images
Posted: Sat Mar 12, 2016 8:50 pm
by Edi
Oops, sorry, I added the echo for test purposes and forgot to delete it!
P. S. No comment about the test image.
Re: Sidebar links & images
Posted: Sat Mar 12, 2016 9:34 pm
by abdulhalim
Re: Sidebar links & images
Posted: Sat Mar 12, 2016 9:54 pm
by Edi