Raised This Month: $51 Target: $400
 12% 

PHP echo $lang in Array?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dasha
Senior Member
Join Date: Apr 2012
Location: \%STEAM -> $_SESSION
Old 08-14-2012 , 08:53   PHP echo $lang in Array?
Reply With Quote #1

Title..
for example:
$err[] = "Error. You have entered an invalid username or password.";
to:
$err[] = "echo $lang['LOGIN_ERROR'];";

This way works with simle text, but not in arrays..

< href="#"><?php echo $lang['LINK_TEXT']; ?></a>
dasha is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 08-14-2012 , 08:56   Re: PHP echo $lang in Array?
Reply With Quote #2

PHP Code:
$err $lang['LOGIN_ERROR']; 
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
dasha
Senior Member
Join Date: Apr 2012
Location: \%STEAM -> $_SESSION
Old 08-18-2012 , 11:32   Re: PHP echo $lang in Array?
Reply With Quote #3

Quote:
Originally Posted by YamiKaitou View Post
PHP Code:
$err $lang['LOGIN_ERROR']; 
Thanks that helped alot!
But I have an last question, how to combine it here?

PHP Code:
    if ($total 0)
    {
    echo 
"<font color='#DC143C'>$lang['NOT_AVAILABLE'];</font>";
    } else {
    echo 
"<font color='#00EE00'>$lang['AVAILABLE'];</font>";
    }

Because this way I get error

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files (x86)\VertrigoServ\www\website\db\inc\check.p hp on line 3

Tried with echo $lang too, not working..
dasha is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 08-18-2012 , 11:36   Re: PHP echo $lang in Array?
Reply With Quote #4

Put { } around it
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
dasha
Senior Member
Join Date: Apr 2012
Location: \%STEAM -> $_SESSION
Old 08-18-2012 , 12:13   Re: PHP echo $lang in Array?
Reply With Quote #5

Quote:
Originally Posted by YamiKaitou View Post
Put { } around it
Around where? Because I tried this:

echo "<font color='#DC143C'>{$lang['NOT_AVAILABLE']};</font>";
this
echo "<font color='#DC143C'>$lang{['NOT_AVAILABLE']};</font>";
this
echo "<font color='#DC143C'>$lang{'NOT_AVAILABLE'};</font>";

And isn't working well
dasha is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 08-18-2012 , 12:17   Re: PHP echo $lang in Array?
Reply With Quote #6

echo "<font color='#DC143C'>{$lang['NOT_AVAILABLE']}</font>";
or
echo "<font color='#DC143C'>" . $lang['NOT_AVAILABLE'] . "</font>";
__________________
xPaw is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 08-18-2012 , 12:20   Re: PHP echo $lang in Array?
Reply With Quote #7

PHP Code:
    if ($total 0)
    {
    echo 
"<font color='#DC143C'>{$lang['NOT_AVAILABLE']};</font>";
    } else {
    echo 
"<font color='#00EE00'>{$lang['AVAILABLE']};</font>";
    }

__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
dasha
Senior Member
Join Date: Apr 2012
Location: \%STEAM -> $_SESSION
Old 08-18-2012 , 12:34   Re: PHP echo $lang in Array?
Reply With Quote #8

Quote:
Originally Posted by YamiKaitou View Post
PHP Code:
    if ($total 0)
    {
    echo 
"<font color='#DC143C'>{$lang['NOT_AVAILABLE']};</font>";
    } else {
    echo 
"<font color='#00EE00'>{$lang['AVAILABLE']};</font>";
    }

Result when I click-> e;

xPaw, same..
dasha is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 08-18-2012 , 12:37   Re: PHP echo $lang in Array?
Reply With Quote #9

It works just fine, your problem lies else where
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
dasha
Senior Member
Join Date: Apr 2012
Location: \%STEAM -> $_SESSION
Old 08-18-2012 , 12:48   Re: PHP echo $lang in Array?
Reply With Quote #10

Quote:
Originally Posted by YamiKaitou View Post
It works just fine, your problem lies else where



that "e" should be "not available", I don't know why is just an e


lang file:
$lang['NOT_AVAILABLE'] = 'Not Available!';
$lang['AVAILABLE'] = 'Available';
Attached Thumbnails
Click image for larger version

Name:	e.JPG
Views:	456
Size:	12.2 KB
ID:	108035  
dasha is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:31.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode