hello,
we have some sidebar plugins like history (posts before 6 months) and so, which do not appear as an empty plugin (title plus space) when there are no output-items, but they do not appear in the sidebar at all.
Can the mycalendar plugin work the same way? Or can somebody make the plugin to do so?
mycalendar: no output at all when no
-
stm999999999
- Regular
- Posts: 1531
- Joined: Tue Mar 07, 2006 11:25 pm
- Location: Berlin, Germany
- Contact:
mycalendar: no output at all when no
Ciao, Stephan
-
stm999999999
- Regular
- Posts: 1531
- Joined: Tue Mar 07, 2006 11:25 pm
- Location: Berlin, Germany
- Contact:
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
A plugin will not return anything if the "generate_content()" returns "false" instead of echoing output, AFAIR...
HTH,
Garvin
A plugin will not return anything if the "generate_content()" returns "false" instead of echoing output, AFAIR...
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/
# 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/
-
stm999999999
- Regular
- Posts: 1531
- Joined: Tue Mar 07, 2006 11:25 pm
- Location: Berlin, Germany
- Contact:
OK, I found it.
I make a change to the plugin:
for the lang-files:
I think, this can be a good idea for every sidebar-plugin: to give the user the choice whether he wants empty plugins or not. comments?
I make a change to the plugin:
Code: Select all
$propbag->add('configuration', array('title', 'items', 'datefm', 'datefm2', 'showtime', 'autoprune', 'countdown', 'skipfirst', 'showempty'));
...
case 'showempty':
$propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_MYCALENDAR_SIDE_SHOWEMPTY);
$propbag->add('description', '');
$propbag->add('default', true);
break;
...
function generate_content(&$title) {
global $serendipity;
$showempty = serendipity_db_bool($this->get_config('showempty', true));
...
$items = serendipity_db_query("SELECT * from {$serendipity['dbPrefix']}mycalendar " . $filter . " ORDER BY eventdate LIMIT " . $this->get_config('items', 5));
if (!is_array($items)) {
if ($showempty) {
return true;
} else {
return false;
}
}
Code: Select all
@define('PLUGIN_MYCALENDAR_SIDE_SHOWEMPTY', 'Show plugin when no events?');
@define('PLUGIN_MYCALENDAR_SIDE_SHOWEMPTY', 'Anzeigen auch wenn kein Termin vorhanden?'); Ciao, Stephan
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Seems like a very good suggesiton! Maybe you want to get yourself accustomed with the "patch / diff" utils so I can submit your patch easily?
Best regards,
Garvin
Seems like a very good suggesiton! Maybe you want to get yourself accustomed with the "patch / diff" utils so I can submit your patch easily?
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/
# 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/
-
stm999999999
- Regular
- Posts: 1531
- Joined: Tue Mar 07, 2006 11:25 pm
- Location: Berlin, Germany
- Contact:
yes, I think so.The only problem I see at the moment is that each plugin has to be modified separately.
I don't know if it would be a good idea to make it a global thing: Perhaps someone wants to show some sidebar item even if it is empty and another not.But adding a global configuration item just seems too difficult.
Ciao, Stephan