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?
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.
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?
The text strings are in files within the languages folder, just open em have a look and it should make sense ;)