Uutiset:

Wondering if this will always be free?  See why free is better.

Main Menu
Advertisement:

Undefined error

Aloittaja GrahamP, helmikuu 17, 2006, 03:09:15 IP

« edellinen - seuraava »

GrahamP

Help! can someone help a newbie to php, I am trying to add a 'view unread' button between the help and search buttons. In index.template.php I copied the code for the help button and pasted it in then edited the code as follows

Lainaa// Add an unread posts button.
   echo '
                        <a href="', $scripturl, '?action=unread">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/unread.gif" alt="' . $txt[119] . '" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];

The button works ok in that it displays any unread posts but generates errors in the error log at an alarming rate. Is the problem something to do with the global variable $txt?

kegobeer

What version of SMF are you running?
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

GrahamP


kegobeer

What errors are being logged?
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

GrahamP

Thanks for the speedy reply, 2 of the error messages below

Doc   Today at 08:47:48 PM 
172.200.27.243     f727f018609e16c946741c3422e5f7f5 
http://reliant3wheelers.co.uk/forum/index.php?topic=2.0 [nofollow] 
8: Undefined offset: 135
File: /home/h0mer47/public_html/forum/Themes/classic/Display.template.php (eval?)
Line: 297

   Doc   Today at 08:47:46 PM 
172.200.27.243     f727f018609e16c946741c3422e5f7f5 
http://reliant3wheelers.co.uk/forum/index.php?board=6.0 [nofollow] 
8: Undefined offset: 135
File: /home/h0mer47/public_html/forum/Themes/classic/MessageIndex.template.php (eval?)
Line: 297


the line 297 points to the code I added as in my first post.

kegobeer

"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

GrahamP


sm2k

What's the line immediately above this echo statement?

beemer

Dont know if it matters but

$txt[119])  is the text string for help try  333
http://www.bmw7resource.co.uk
SMF 1.1 RC1
MKP 1.1 RC1
Helios Multi RC1
-------------------------------------------------------
http://www.thefishsheadnhorsesarse.co.uk
SMF 1.1 RC2
TinyPortal 0.8.6

GrahamP

Lainaus käyttäjältä: sm2k - helmikuu 17, 2006, 04:12:44 IP
What's the line immediately above this echo statement?

The text from the start of this section is:-

// Show the menu up top.  Something like [home] [help] [profile] [logout]...
function template_menu()
{
   global $context, $settings, $options, $scripturl, $txt;

   // Show the [home] and [help] buttons.
   echo '
            <a href="', $scripturl, '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/home.gif" alt="' . $txt[103] . '" border="0" />' : $txt[103]), '</a>', $context['menu_separator'], '
            <a href="', $scripturl, '?action=help">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/help.gif" alt="' . $txt[119] . '" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];

   // Add an unread posts button.
   echo '
                        <a href="', $scripturl, '?action=unread">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/unread.gif" alt="' . $txt[135] . '" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];


   // How about the [search] button?
   if ($context['allow_search'])
      echo '
            <a href="', $scripturl, '?action=search">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/search.gif" alt="' . $txt[182] . '" border="0" />' : $txt[182]), '</a>', $context['menu_separator'];


I have used green to indicate original code and red for the section I added.

GrahamP

Lainaus käyttäjältä: beemer - helmikuu 17, 2006, 04:16:00 IP
Dont know if it matters but

$txt[119])  is the text string for help try  333
Thanks Beemer did as you suggested and it seems to have done the trick, no more errors atm. Can you tell me where I can find the list of text strings?

beemer

The text strings are in files within the languages folder, just open em have a look and it should make sense  ;)
http://www.bmw7resource.co.uk
SMF 1.1 RC1
MKP 1.1 RC1
Helios Multi RC1
-------------------------------------------------------
http://www.thefishsheadnhorsesarse.co.uk
SMF 1.1 RC2
TinyPortal 0.8.6

GrahamP


Advertisement: