Has custom sidebars changed?

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Has custom sidebars changed?

Post by Don Chambers »

In the past, I have defined custom sidebars like this:

Code: Select all

    array(
         'var'          => 'sidebars',
         'name'         => 'Sidebars',
         'type'         => 'hidden',
         'value'        => 'custom,left,right,hide',
    ),
This resulted in a visual sidebar container in the backend, and allowed a conditional test and sidebar output such as this:

Code: Select all

    {if $CustomSidebarElements >0}
        <div id="serendipityCustomSideBar">
            {serendipity_printSidebar side="custom"}
        </div>
    {/if}
This works great in the Kinetic template... including with the latest 2.1 snapshot.

However, in my latest theme (not yet released), I cannot get a smarty value for $CustomSidebarElements... I looked quickly for newer themes with custom sidebars, and found "bartleby". That theme's config for sidebars looks like this:

Code: Select all

$template_config['sidebars'] = array('hide,bottom');
$serendipity['sidebars'] = array('hide', 'bottom');
And is used in index.tpl like this:

Code: Select all

    <footer id="sidebar_bottom" class="clearfix">
        {serendipity_printSidebar side="bottom"}
    </footer>
This theme also does not create a $bottomSidebarElements value. The theme's template files do not rely on any conditional test for the smarty variable, but using {debug} I do not see a smarty variable named $bottomSidebarElements.... although, $leftSidebarElements, and $rightSidebarElements *DO* exist, even though neither are defined by the theme's config.

What am I missing here? :?
=Don=
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Has custom sidebars changed?

Post by onli »

I ran into bugs when building this (or was it another?) theme, I think in general when I was testing sidebar generation for 2.0. I distinctly remember that because of those fixes the code to generate sidebars did change.

You should cross-check with the photo theme.

It is possible that $xSidebarElements got lost. But that does nto explain why it works in kinect. You can't just copy the method kinect uses?

Could it be that kinect sets another engine?

$xSidebarElements should not be set by the theme config, I remember it being set in the core, but am not sure where.
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Has custom sidebars changed?

Post by Don Chambers »

I am using the exact same method I used in Kinetic, and its not working! Kinetic does not use another theme engine. I don't have anywhere I could install Kinetic where it isn't already installed... but even if I did install a fresh copy, and it didn't work, that's not telling me any more than the fact that it does work where already installed.

Is it possible that Kinetic works because something is stored in the database?

This is quite frustrating... I obviously do not want the theme to process an entire sidebar (its actually a footer/bottom sidebar) if no plugins are configured there.
=Don=
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Has custom sidebars changed?

Post by onli »

I obviously do not want the theme to process an entire sidebar (its actually a footer/bottom sidebar) if no plugins are configured there.
I hope this is no performance optimization thing? Because generating a sidebar with zero elements would be very very fast. But I understand if the problem is that it looks strange to have the outline of a sidebar which is empty.

So, I looked into the code. I did not find what changed, if something changed, but I found where those variables are generated. leftSidebarElements and rightSidebarElements are filled in the beginning of genpage.inc.php. I found no other code filling equivalent variables in the core. But I found how another template is doing this, in https://github.com/s9y/additional_theme ... nc.php#L81:

Code: Select all

$botSidebarElements = serendipity_plugin_api::count_plugins('bot');
$serendipity['smarty']->assign_by_ref('botSidebarElements', $botSidebarElements);
You should add this to the config.inc.php.
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Has custom sidebars changed?

Post by Don Chambers »

Well shit!!! That's in Kinetic too - way at the bottom of the config file! DOH!! :oops:
=Don=
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Has custom sidebars changed?

Post by onli »

:)

I think we should look into automating that. The sidebar names should be known at that point, no need to let the theme fill the variables.
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Has custom sidebars changed?

Post by Don Chambers »

Agreed - I really thought this was all handled internally simply by defining the sidebars.
=Don=
Post Reply