News Box change to include calendar events-query?

Started by EG, April 04, 2005, 06:12:04 PM

Previous topic - Next topic

EG

Ive figured out how to change the newsbox so taht it now displays calendar events instead of a random news item.... However there are 2 things I want to finalise about it, and now Im a bit stumped :-\

This is the code in the index.template.php (Ive included the normal code that appears top and bottom, so its easier to source)


// If we're on a certain board, limit it to this board ;).
if (!empty($context['current_board']))

echo '
<input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';

echo '
</form>

</td>
<td width="262" style="padding-left: 5px;" valign="top">';

// Show a calendar event
if (!empty($context['calendar_events']))
{
echo '
<div class="headertitles" style="width: 260px;"><img src="', $settings['images_url'], '/blank.gif" height="12" alt="" /></div>
<div class="headerbodies" style="width: 260px; position: relative; background-image: url(', $settings['images_url'], '/box_bg.gif); margin-bottom: 8px;">
<img src="', $settings['images_url'], '/', $context['user']['language'], '/newsbox.gif" style="position: absolute; left: -1px; top: -16px;" alt="" />
<div style="height: 30px; overflow: auto; padding: 5px;" class="smalltext"><span style="color: #', $modSettings['cal_eventcolor'], ';">', $context['calendar_only_today'] ? $txt['calendar4'] : $txt['calendar4b'], '</span></div>';
foreach ($context['calendar_events'] as $event)
echo '
', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" style="color: #FF0000;">*</a>' : '', '<a href="', $event['href'], '">', $event['is_today'] ? '<b>' . $event['title'] . '</b>' : $event['title'], '</a>', $event['is_last'] ? '<br />' : ', ';

}
// The "key stats" box.
echo '
<div class="headertitles" style="width: 260px;"><img src="', $settings['images_url'], '/blank.gif" height="12" alt="" /></div>
<div class="headerbodies" style="width: 260px; position: relative; background-image: url(', $settings['images_url'], '/box_bg.gif);">
<img src="', $settings['images_url'], '/', $context['user']['language'], '/keystats.gif" style="position: absolute; left: -1px; top: -16px;" alt="" />
<div style="height: 35px; padding: 5px;" class="smalltext">
<b>', $modSettings['totalMessages'], '</b> ', $txt[95], ' ', $txt['smf88'], ' <b>', $modSettings['totalTopics'], '</b> ', $txt[64], ' ', $txt[525], ' <b>', $modSettings['memberCount'], '</b> ', $txt[19], '<br />
', $txt[656], ': <b> <a href="', $scripturl, '?action=profile;u=', $modSettings['latestMember'], '">', $modSettings['latestRealName'], '</a></b>
</div>
</div>';

echo '
</td>
</tr>
</table>
<p align="center">
<a href="#" onclick="shrinkHeader(!current_header); return false;"><img id="upshrink" src="', $settings['images_url'], '/', empty($options['collapse_header']) ? 'upshrink.gif' : 'upshrink2.gif', '" alt="*" title="', $txt['upshrink_description'], '" style="margin: 2px 0;" border="0" /></a><img id="upshrinkTemp" src="', $settings['images_url'], '/blank.gif" alt="" style="margin-right: 2ex;" />';


I would like the Events to appear in here, even if they are switched off in the admin panel  (I thought it was the if (!empty($context['calendar_events']))  but even changing that for if ($context['show_calendar']) it makes no difference... However removing that line altogether causes the template to fall over.

So.... anyone any ideas ???

(I would like to do this, because it would mean I could effectively turn off the calendar events in the footer and just have them in this info box)

The Second problem is, that now, when entering the admin panel, this "info box" simply disappears whilst in the admin panel :-\  thats totally confused me!  But is it something to do with Load.php ???  Its not a big deal, but it is untidy :-\

EG

QuoteI would like the Events to appear in here, even if they are switched off in the admin panel  (I thought it was the if (!empty($context['calendar_events']))  but even changing that for if ($context['show_calendar']) it makes no difference... However removing that line altogether causes the template to fall over.

sorry to bump this..

but does anyone have any idea on this front in particular ???

jaijaymama

I'd like to do this, too.  Does anyone know how? :D

Advertisement: