Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: Nakitomimaru - tammikuu 05, 2006, 12:41:45 AP

Otsikko: [RC 2 Bug?] Calendar Generating Error With Default RC2 Theme
Kirjoitti: Nakitomimaru - tammikuu 05, 2006, 12:41:45 AP
8: Undefined index: calendar_shortedit
File: /*rootobscured*/forum/Themes/default/Display.template.php (eval?)
Line: 158


I've just installed RC2 for a WoW guild that I play System Admin for, and I've noticed this error for what looks like every single time somebody views a Calendar linked topic.  Theme is the default RC2 - very nice looking, BTW, congrats Bloc and company.  I've included a screencap of one of the topic pages.
Lainaa

It looks to me as though there is supposed to be something between the [] there.
Otsikko: Re: [RC 2 Bug?] Calendar Generating Error With Default RC2 Theme
Kirjoitti: Grudge - tammikuu 05, 2006, 01:52:42 IP
Oh dear...

In Display.template.php, find:

<b>', $event['title'] , '</b> ' , ($event['can_edit'] ? '<a href="' . $event['modify_href'] . '" >[' . $txt['calendar_shortedit'] . ']</a> ' : '') , ': ', $event['start_date'], ($event['start_date'] != $event['end_date'] ? ' - ' . $event['end_date'] : ''), '


Replace:

', ($event['can_edit'] ? '<a href="' . $event['modify_href'] . '" style="color: red;">*</a> ' : ''), '<b>', $event['title'], '</b>: ', $event['start_date'], ($event['start_date'] != $event['end_date'] ? ' - ' . $event['end_date'] : '');
Otsikko: Re: [RC 2 Bug?] Calendar Generating Error With Default RC2 Theme
Kirjoitti: Kindred - tammikuu 05, 2006, 02:15:18 IP
Grudge,

Don't we need a new openning quote at the end of that line?

changing this:

foreach ($context['calendar_events'] as $event)
echo '
<li>
<b>', $event['title'] , '</b> ' , ($event['can_edit'] ? '<a href="' . $event['modify_href'] . '" >[' . $txt['calendar_shortedit'] . ']</a> ' : '') , ': ', $event['start_date'], ($event['start_date'] != $event['end_date'] ? ' - ' . $event['end_date'] : ''), '
</li>';



to this:


foreach ($context['calendar_events'] as $event)
echo '
<li>
', ($event['can_edit'] ? '<a href="' . $event['modify_href'] . '" style="color: red;">*</a> ' : ''), '<b>', $event['title'], '</b>: ', $event['start_date'], ($event['start_date'] != $event['end_date'] ? ' - ' . $event['end_date'] : '');
</li>';


looks like it will give a parse error...
Otsikko: Re: [RC 2 Bug?] Calendar Generating Error With Default RC2 Theme
Kirjoitti: zombiemanx - tammikuu 05, 2006, 03:55:49 IP
Remove the ; and replace it with ,  ' and it will be fine.
Otsikko: Re: [RC 2 Bug?] Calendar Generating Error With Default RC2 Theme
Kirjoitti: Grudge - tammikuu 05, 2006, 04:09:07 IP
Yea, my bad. Strangely enough I commited the fixed version into CVS, must have copied and pasted the wrong line :/
Otsikko: Re: [RC 2 Bug?] Calendar Generating Error With Default RC2 Theme
Kirjoitti: alchemy - tammikuu 05, 2006, 07:10:24 IP
Template Parse Error!

Is what I get after replacing the code. Has something else changed between RC2 and the CVS in relation to that line of code ?

Otsikko: Re: [RC 2 Bug?] Calendar Generating Error With Default RC2 Theme
Kirjoitti: Kindred - tammikuu 05, 2006, 07:22:17 IP
yes, alchemy...   as I noted, what Grudge originally wrote will parse wrong...

', ($event['can_edit'] ? '<a href="' . $event['modify_href'] . '" style="color: red;">*</a> ' : ''), '<b>', $event['title'], '</b>: ', $event['start_date'], ($event['start_date'] != $event['end_date'] ? ' - ' . $event['end_date'] : ''), '


will parse correctly...
Otsikko: Re: [RC 2 Bug?] Calendar Generating Error With Default RC2 Theme
Kirjoitti: alchemy - tammikuu 05, 2006, 09:52:03 IP
Thanks for the update I was confused which code to use  ;D
Otsikko: Re: [RC 2 Bug?] Calendar Generating Error With Default RC2 Theme
Kirjoitti: Nakitomimaru - tammikuu 07, 2006, 04:51:41 AP
Thanks!  That did the trick.  ^^  Incidentally, while I'm thinking about it - is it intentional that you can't edit the default theme via the theme editor?  It makes sense if so, but considering that it shows up in other places it seemed a little odd when I noticed.
Otsikko: Re: [RC 2 Bug?] Calendar Generating Error With Default RC2 Theme
Kirjoitti: Grudge - tammikuu 07, 2006, 07:39:27 AP
That is indeed intentional. Editing the default theme makes upgrading hard.