Page 1 of 1

echoing somtin out

Posted: Mon May 30, 2005 8:16 pm
by shiznatix
im completly confused as to why this does not work

Code: Select all

</center>
</td>
</tr>
</table>
</form>
<?
$lang->DoL('NEW_USER_CLICK');
?> 
<a href="new_user/new_user.php">
<?
$lang->DoL('HERE');
?>
that does not work. but when i put the $lang->DoL('NEW_USER_CLICK'); after the $lang->DoL('HERE'); then it shows. I know i spelled everything correct and It was working the other day then it all of a sudden stopped working. If there is somthing obvious im missing please tell me but otherwise i have no idea

Posted: Mon May 30, 2005 8:52 pm
by John Cartwright
Maybe show us the contents of the $lang class

Posted: Mon May 30, 2005 9:09 pm
by shiznatix

Code: Select all

'VIEW_CV_IN' => array
            (
                'est' => '*Choose Which Language To View Your CV In*',
                'eng' => 'Choose Which Language To View Your CV In',
            ),
            'COMMENTS' => array
            (
                'est' => '*Comments*',
                'eng' => 'Comments',
            ),
            'ADD_MESSAGE' => array
            (
                'est' => '*Add Message*',
                'eng' => 'Add Message',
            ),
            'ADD_COMMENT' => array
            (
                'est' => '*Add Comment*',
                'eng' => 'Add Comment',
            ),
            'COMMENT_ADDED' => array
            (
                'est' => '*Comment Added*',
                'eng' => 'Comment Added',
            ),
            'PRINT_IN_LANG' => array
            (
                'est' => '*Choose a language to print the cv\'s in*',
                'eng' => 'Choose a language to print the cv\'s in',
            ),
        );

    function SetLang($lang)
	{
	    if ($lang !== 'eng' && $lang !== 'est')
		{
		    trigger_error('Invalid Language', E_USER_ERROR);
		}
		else
		{
		    $_SESSION['lang'] = $lang;
		}
	}
	
	function DoL($change)
	{
	   if (isset($_SESSION['lang']))
	   {
	       if(isset($this->text[$change][$_SESSION['lang']]))
		   {
		       echo $this->text[$change][$_SESSION['lang']];
		   }
	   }
	   else
	   {
	       trigger_error('No Language Set', E_USER_ERROR);
	   }
	}

    function DoLcV($change)
	{
	   if (isset($_GET['lang_id']))
	   {
           $lang = ($_GET['lang_id'] == '1' ? 'est' : 'eng');

	       if(isset($this->text[$change][$lang]))
		   {
		       echo $this->text[$change][$lang];
		   }
	   }
	   else
	   {
	       trigger_error('No Language Set', E_USER_ERROR);
	   }
	}
}
the array is only part of the array, its a huge array (over 1000 lines) but you get the idea. there is no reason that i can think of for it not to work. whats even stranger is that when i view source it shows correctly but on the page in the browser it dosnt show. i really have no idea. here is a link
http://www.koduleht.net/~andrew/cv/

Posted: Mon May 30, 2005 10:01 pm
by JAM
It's early, so excuse me if I'm way off, but...
Might not solve any issues, but it just doesn't look right.

Code: Select all

array
            (
                'est' => '*Add Message*',
                'eng' => 'Add Message'  // <-- the , removed as it's the last 
            )
Another example.

Code: Select all

'PRINT_IN_LANG' => array
            (
                'est' => '*Choose a language to print the cv\'s in*',
                'eng' => 'Choose a language to print the cv\'s in', // here...
            ), // ...and here...

Posted: Mon May 30, 2005 11:23 pm
by wyred
JAM wrote:It's early, so excuse me if I'm way off, but...
Might not solve any issues, but it just doesn't look right.

Code: Select all

array
            (
                'est' => '*Add Message*',
                'eng' => 'Add Message'  // <-- the , removed as it's the last 
            )
Another example.

Code: Select all

'PRINT_IN_LANG' => array
            (
                'est' => '*Choose a language to print the cv\'s in*',
                'eng' => 'Choose a language to print the cv\'s in', // here...
            ), // ...and here...
Extra commas at the end won't affect the array in any way as far as I know. It works fine.

To the threadstarter, you might want to try echoing your arrays using:

Code: Select all

echo '<pre>';
print_r($this->text); // or any other array
echo '</pre>';
to make sure your arrays are properly set up.

Posted: Tue May 31, 2005 11:55 am
by shiznatix
after some testing and its only happening in firefox. my table kinda breaks up too, but only in firefox. this is the only place in the script where this happens and i use that array for every single text output on the site.