NathanS Posted September 3, 2008 Share Posted September 3, 2008 Hi guys, I'm rectifing an old website, and everything works flawlessly bar the languages - its been coded for multiple languages, as such the index page looks like this: echo "<TABLE class=NewsTicker width=585><TBODY><TR><TD><a href=\"chatroom.php?rhx=2523457370726573736F426172\">EspressoBar</a> - <i>All ages welcome at the EspressoBar - Fun and friendly chat!</i></TD></TR></TBODY></TABLE>"; layout_text( "{$_index[0]}", "{$_index[1]} {$_index[2]}" ); layout_text( "{$_index[3]}", "{$_index[4]}<br>{$_index[5]} <a href=\"includes/NPPGWrap.exe\">{$_index[6]}</a> {$_index['7']}" ); layout_text( "{$_index[8]}", "{$_index[9]}" ); layout_footer( ); } With $_index[0] etc being the relative text which is defined in the language files, as below: $_index[0] = "Welcome to N2N Chat!"; $_index[1] = "A new network made especially for you! Why? Because we want to make your online experience as enjoyable as possible, N2N Chat is your best msn chat alternative!"; $_index[2] = "Chat now and get acquainted with the possibilities of N2N Chat today!"; But the error I'm getting is: Notice: Undefined variable: _index in d:\domains\korix.co.uk\wwwroot\n2nchat\index.php on line 9 Over and over again. Any ideas? Thanks! Link to comment https://forums.phpfreaks.com/topic/122527-undefined-index-with-language-fileshelp/ Share on other sites More sharing options...
Fadion Posted September 3, 2008 Share Posted September 3, 2008 What does the layout_text() function do and are you including the language file? Link to comment https://forums.phpfreaks.com/topic/122527-undefined-index-with-language-fileshelp/#findComment-632660 Share on other sites More sharing options...
NathanS Posted September 3, 2008 Author Share Posted September 3, 2008 function layout_text( $header, $text ) { echo "<TABLE cellSpacing=0 cellPadding=0 width=600 border=0>\r\n<TBODY>\r\n<TR>\r\n<TD vAlign=top colSpan=2>\r\n<TABLE class=TextBoxFull cellSpacing=0 width=585>\r\n<TBODY>\r\n<TR>\r\n</TR>\r\n<TR>\r\n</TR>\r\n<TR>\r\n<TD>\r\n<B>{$header}</B>\r\n</TD>\r\n</TR>\r\n<TR>\r\n<TD>{$text}<BR>\r\n</TD>\r\n</TR>\r\n</TBODY>\r\n</TABLE>\r\n</TD>\r\n</TR>\r\n</TBODY>\r\n</TABLE>"; } And yes, include the language file! Link to comment https://forums.phpfreaks.com/topic/122527-undefined-index-with-language-fileshelp/#findComment-632744 Share on other sites More sharing options...
BlueSkyIS Posted September 3, 2008 Share Posted September 3, 2008 But the error I'm getting is: Notice: Undefined variable: _index in d:\domains\korix.co.uk\wwwroot\n2nchat\index.php on line 9 this might go away if you define the variable before using it: $_index = array(); $_index[0] = "Welcome to N2N Chat!"; $_index[1] = "A new network made especially for you! Why? Because we want to make your online experience as enjoyable as possible, N2N Chat is your best msn chat alternative!"; $_index[2] = "Chat now and get acquainted with the possibilities of N2N Chat today!"; Link to comment https://forums.phpfreaks.com/topic/122527-undefined-index-with-language-fileshelp/#findComment-632745 Share on other sites More sharing options...
NathanS Posted September 3, 2008 Author Share Posted September 3, 2008 No joy Thanks for the suggestion though Link to comment https://forums.phpfreaks.com/topic/122527-undefined-index-with-language-fileshelp/#findComment-632750 Share on other sites More sharing options...
NathanS Posted September 3, 2008 Author Share Posted September 3, 2008 Incidently, if I copy/paste the variables into the index instead of including them, it works fine... Link to comment https://forums.phpfreaks.com/topic/122527-undefined-index-with-language-fileshelp/#findComment-632751 Share on other sites More sharing options...
BlueSkyIS Posted September 3, 2008 Share Posted September 3, 2008 are you including the file that defines $_index before any code that uses $_index? the error 'undefined variable' tells me that you are using the variable before it is defined. ah, just saw your last post. have you tried defining $_index before the include instead of inside the include? Link to comment https://forums.phpfreaks.com/topic/122527-undefined-index-with-language-fileshelp/#findComment-632754 Share on other sites More sharing options...
NathanS Posted September 3, 2008 Author Share Posted September 3, 2008 yeah, that doesn't work unfortunately! Link to comment https://forums.phpfreaks.com/topic/122527-undefined-index-with-language-fileshelp/#findComment-632759 Share on other sites More sharing options...
PFMaBiSmAd Posted September 3, 2008 Share Posted September 3, 2008 Either your language file does not have <?php ?> tags or it is not being included. Link to comment https://forums.phpfreaks.com/topic/122527-undefined-index-with-language-fileshelp/#findComment-632899 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.