Pulling sidebar plugins out of sidebar

Creating and modifying plugins.
DarKRaveR
Regular
Posts: 20
Joined: Wed Mar 29, 2006 7:35 am
Location: FFM, Germany

Pulling sidebar plugins out of sidebar

Post by DarKRaveR »

IS there a way to 'pull' a sidebar plugin otu of the sidebar ?

Mainly I want the search/syndication links outside of the sidebars. As an alternative, could I add another bar?

I found all of the plugins, except for those two. I assume they are some sort of internal plugins/stock plugins?

Where can I dig the code for those two and where would I have to start modifying, if I want additional bars to the sidebars (like a toolbar) ....

I am slowly diggin into the code, but since the code is not too small and spread over everal locations it's kinda hard to really get into it ...

(Some sort of code level documentation would be a really great thing - but a lot of work - I know) ...

thnx for any help ...
SHRIKEE
Regular
Posts: 128
Joined: Tue Feb 21, 2006 2:49 am
Location: Netherlands
Contact:

Post by SHRIKEE »

you can have 2 sidebars, one on the left and on the right.

each plugin comes with options to show or hide them.

from the main admin panel click 'configure plugins' then a list of plugins should be shown.

if you want to change the sidebar or hide them click the dropdown menu under placement and select the option you desire.

the syndicate plugin is called 'syndicate this blog'
and the other one is called 'quicksearch' i believe.
My kingdom For i am king of my heap of trash

Developing code on:
Workstation: Windows 2000 sp4, TSW webcoder 2005
Server: fedora core 4 amd64, apache 2.0.54, php 5.0.4, mysql 4.1.11.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

You can also place sidebar plugins anywhere you like via Smarty code calls; the best idea is to set your sidebar plugin to "hidden" so that it does not appear in the usual sidebar.

Then you use these functions: http://www.s9y.org/78.html - {serendipity_showPlugin}.

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
DarKRaveR
Regular
Posts: 20
Joined: Wed Mar 29, 2006 7:35 am
Location: FFM, Germany

Post by DarKRaveR »

garvinhicking wrote:You can also place sidebar plugins anywhere you like via Smarty code calls; the best idea is to set your sidebar plugin to "hidden" so that it does not appear in the usual sidebar.

Then you use these functions: http://www.s9y.org/78.html - {serendipity_showPlugin}.

HTH,
Garvin
Okay, this would be a possibility for now, the other thing is, in case I'd like to convert the plugin to non sidebar versions, where is the code located, all other plugins are in the plugins directory, but it seems I'm not capable of locating those two. (Maybe I should clean my glasses :D )

Anyhow, let's say I want to have another toolbar, let's call it topbar for now. I was thinking of adding this to the system (if that's possible), adopt the plugins, so they can be put there and that they use 'span' elements instead of 'div', so you can place them horizontally next to each other ...

Of course this wouldn't make sense for all of them, but quite some could be placed like this ...

Maybe it would be even neater to have the possibility to add such toolbars several times for a stacking, so one could basicly create an extensible set of bars (horizontally and vertically), put plugins in (have the plugins have a way to find out the type of bar) and then arrange those bars in whatever way one likes ....

The actual arrangements can be done with a tpl file of course ....

BTW: What happens if I remove the syndication plugin? are the feeds still available (though the plugin would not put links on the frontend)? It seems some of the functions are in the normal include directory ...
SHRIKEE
Regular
Posts: 128
Joined: Tue Feb 21, 2006 2:49 am
Location: Netherlands
Contact:

Post by SHRIKEE »

i think what you want is a new type of plugin which support a horizontal bar.

like you said most plugins will not support it right now.

but afaik there is no option other than using smarty tags or rebuilding a theme and placing the sidebar horizontally at the top.
My kingdom For i am king of my heap of trash

Developing code on:
Workstation: Windows 2000 sp4, TSW webcoder 2005
Server: fedora core 4 amd64, apache 2.0.54, php 5.0.4, mysql 4.1.11.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

I would go with the smarty option. Adding a new type like "left" and "right" is much code work. You would need to modify most if include/plugins* and include/admin/*plugins* files for that.

If you don'T need an interface, you can just set the "position" type in the serendipity_plugins table to "top" and then adjust your smarty showPlugin calls to use that site, maybe it works.

If you go for the hard way, a patch for our serendipity version would of course be appreciated, if you find a way to generically make it happen :)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
SHRIKEE
Regular
Posts: 128
Joined: Tue Feb 21, 2006 2:49 am
Location: Netherlands
Contact:

Post by SHRIKEE »

me personally do not encourage a patch of the core files to support a top bar.

In my idea this, if it works, will result in much more problems regarding templates.

to name some:
- none of the current templates support it

- alot of people use smaller screen resolutions (think of 800x600 and below) this would seriously limit the amount of plugins in the topbar or deform the website severely. deformed websites look unprofessional and i do not wish to look at such sites im sure others think the same about that. plus if the serendipity label is on it it would be a sort of anti-promo for serendipity

- like garvin said alot of the core files would be updated

allthough these are all things that can be worked around it will never be as 'good' as vertical bars i think.

Depending on what plugins you want to show in a topbar i would stick to building a custom template of use smarty tags as suggested earlier.
My kingdom For i am king of my heap of trash

Developing code on:
Workstation: Windows 2000 sp4, TSW webcoder 2005
Server: fedora core 4 amd64, apache 2.0.54, php 5.0.4, mysql 4.1.11.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Shrikee has a valid point there - if the core is supporting "free" plugin locations, most templates will have a problem including those freely defined templates.

So you'll always need to have a custom template that supports that kind of things; in that case putting the wanted plugin names into the template file itself is much easier than patching up the files to abstract a functionality that might lead to template confusion?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
SHRIKEE
Regular
Posts: 128
Joined: Tue Feb 21, 2006 2:49 am
Location: Netherlands
Contact:

Post by SHRIKEE »

well it if this is going to be made, a new category of templates should spawn with it.

also this option then should be very clearly explained and documented otherwise people would go nuts and this forum ends up all about explaining to people how it works and telling them why their template isnt working as expected.

you how it goes...

about the deforming website thing i mentioned. problems regarding this could be limited by very strict rules in the size (pixelwise) of the plugin. but this also limits the functionality and/or flexibility of the plugins in the sidebar.
a smart calculating system would be handy for it. one that knows when the total width is 800px and the current plugin(s) take 750px and a new one takes 100px it should not squeeze it in between but rather make the existing ones wider and put the new one on a bar under the existing ones.
My kingdom For i am king of my heap of trash

Developing code on:
Workstation: Windows 2000 sp4, TSW webcoder 2005
Server: fedora core 4 amd64, apache 2.0.54, php 5.0.4, mysql 4.1.11.
DarKRaveR
Regular
Posts: 20
Joined: Wed Mar 29, 2006 7:35 am
Location: FFM, Germany

Post by DarKRaveR »

Okay, I can definately see your point, too much options etc. will not improve the usability for the normal average user.

Maybe I was a little bit fast ... blinded by some euphoric state with my new 'playground' ....

Anyhow:

Assume some person uses quite some plugins for extended Functionality. IT always it a little cumbersome to scroll 1 page or maybe two down, to get to all interisting interface elements etc. - so you could have two sidebars, which reducres of course the width extremely. And still some things you want to be accessible right away is out of sight. I am aware of the fact that this problem cannot be solved.

But as an example: underneath the head there is usually sidebar(s) and the content. Now, the list of the syndication (global) feeds takes quite a lot of space if arranged vertically (a usual) ... one could easily aswell put things horizontally next to each other, in one div (a topbar), which is only as high as the lettersize (well kinda).

Then imagine you want the kategories placed in a similar manner, like this:

Browse: Cat1| Cat2|Cat3 etc. (esp. if one uses subkategories one could have a corresponding Category-Browser in somewhat way, which is really compact)

I am aware of the fact that this might be way beyond typical usage.

Anyhow, concerning those two bar styles (horizontally vs. vertically) and the placement, think of it as a docking kinda scheme in an IDE.

Of course one could supply a really similiar set of templates, that has a layout for like a stack of topbars (horizontally), sidebars, bottombars in a generic manner, and those who really wish to make extensive use of the feature can as well create their own adopted theme - I think.

But let's keep that for future issues ....

As described with the kategories, I could hide the plugin from the sidebars and then put the plugin output in my template.

Let's see an example:

Code: Select all

<div class="serendipitySideBarItem container_serendipity_quicksearch_plugin">
<h3 class="serendipitySideBarTitle serendipity_quicksearch_plugin">Suche</h3>
<div class="serendipitySideBarContent"><form id="searchform" action="/index.php" method="get">
    <div>
       <input type="hidden"  name="serendipity[action]" value="search" />
       <input alt="Suche" type="text"   id="serendipityQuickSearchTermField" name="serendipity[searchTerm]" size="13" />
    </div>
    <div id="LSResult" style="display: none;">
          <div id="LSShadow"></div>
    </div>
</div>
Since the quicksearch uses div containers, which are, in a wc3-standard sense, block containers, it is really cumbersome, to place them inline. I know this is possible with css, but I think you know as well, how cumbersome this is, especially if you want to have an identical look in different browsers (assuming they all respect those css manipulators) ...

That's why I was thinking about an option for vertical/horizontal layout (choosing the type of containers - div vs. span)

These are just some thoughts on the topic.

btw: in case I modify any of the plugins, will those changes be lost during an update (I assume most certainly) ...
[/code]
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Yes, any plugin changes will be lost during an update to the plugin. Updating the core code doesn't change your plugin code, except for the included plugins.

Carl was once working on a theme that put a sidebar in a menu bar. The CSS property to make a div inline (display:inline;) was well supported last time I looked; it's the float property that gives browsers the willies. I believe Carl was using a Son of Suckerfish drop-down menu scheme to put the sidebar item titles in the menu, so when you hovered on them it would draw the sidebar item content beneath.

Stealing the CSS from that template shouldn't be too difficult. I betcha Carl would even be happy to write us a tutorial, if he ever gets some free time.

I think your idea could be implemented similarly with collapsible sidebars. Leave the title displayed, and give the content display:none; until you hover over the title. Then make it display:block; to show it. That'd give you the compact sidebar you want, with the content within easy reach.
Judebert
---
Website | Wishlist | PayPal
DarKRaveR
Regular
Posts: 20
Joined: Wed Mar 29, 2006 7:35 am
Location: FFM, Germany

Post by DarKRaveR »

judebert wrote:Yes, any plugin changes will be lost during an update to the plugin. Updating the core code doesn't change your plugin code, except for the included plugins.
Okay, so I'd better branch out modified plugins into own plugins, to avoid this ... thnx
Carl was once working on a theme that put a sidebar in a menu bar. The CSS property to make a div inline (display:inline;) was well supported last time I looked; it's the float property that gives browsers the willies. I believe Carl was using a Son of Suckerfish drop-down menu scheme to put the sidebar item titles in the menu, so when you hovered on them it would draw the sidebar item content beneath.
Well, for somehwat reason inlining didn't get me to the point where the output looked the way I wanted. Anyways, I had to use floating (don't ask me why) to achieve what I wanted and get the same layout in IE and Mozilla (I tend to use Mozilla myself). Yet I am not quite satisfied with the result.

After digging further into the code etc. it came to my attention, that I basicly could convert one sidebar into such a menubar/toolbar the way I want it, but I actually wanted to keep both sidebars.
Stealing the CSS from that template shouldn't be too difficult. I betcha Carl would even be happy to write us a tutorial, if he ever gets some free time.

I think your idea could be implemented similarly with collapsible sidebars. Leave the title displayed, and give the content display:none; until you hover over the title. Then make it display:block; to show it. That'd give you the compact sidebar you want, with the content within easy reach.
Yeah, that might be an option, maybe, to use aswell/additionally.

I started on replacing one plugin, the only problem I have is, that the actual content is still automatically wrapped by a div and the title is added. I couldn't find a way yet, to suppres this, without modifying the core api.

I thought about two solutions here: Modify {serendipity_showPlugin...} in a way, which would mean to change core files and maybe add another state for sidebar plugins, that offers a different output scheme (and thus introducing basicly additional sidebar like containers (I called this topbar before).

The other possibility I was wondering about: Can I register a new hook from the plugin with the core api? then I could convert the plugin to an event plugin and as soon as I call the hook from the template, I could offer a modified output and thus avoid the sidebar typical wrapping scheme.

EDIT:

The layout is far from being finished, I copied a template and started modifiying things, but there is still way to go, but maybe this can give you a wage idea, of what I am talking:
Block-Blog

Sine IE does not support some stuff the bottombar is only displayed as expedcted in Mozilla (for now) ...

I want to be the searchbo to be eve more compact, but will fiddle around with that later. Adittionally I am thinking about putting a drop down menu bar underneath the syndication links with a modified category plugin, so I can pull it out of the two sidebars aswell.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

I am a bit short on time, and just wanted to refer to:
The other possibility I was wondering about: Can I register a new hook from the plugin with the core api? then I could convert the plugin to an event plugin and as soon as I call the hook from the template, I could offer a modified output and thus avoid the sidebar typical wrapping scheme.
Yes, you can do that! You can use any custom event hooks. You just need to make sure that when calling them from the template via {serendipity_hookPlugin} to append the "hookAll=true" parameter; only with that, any event hook can be executed. Omitting that parameter would only execute plugins with specific template hooks like frontend_display!

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
DarKRaveR
Regular
Posts: 20
Joined: Wed Mar 29, 2006 7:35 am
Location: FFM, Germany

Post by DarKRaveR »

No biggy,

so, can I just put an additional event in the plugins eventhook list and it will be autoregistered? Or do I need to call a special function from within the plugin.

Thanx in advance ...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Right, you first add that event to the list in the introspect() method, then you add a 'case...' within the event_hook method of the plugin.

And then you can call anywhere from the s9y framework your new plugin hook! (In PHP with the serendipity_plugin_api::hook_event('your_hook', $eventData) and in smarty with the {serendipity_hookPlugin...} command)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply