php help
-----
| Author | Message | |
|---|---|---|
|
panther |
||
| Thu Nov 15, 2007 3:10 pm Post subject: php help | ||
|
hi,
while translating to french some lines in the contact list language file, i came across a little problem. i know that in php i need to put a \ in front of a ' and it works fine everywhere except in: $lang['Contact_Alert_PM'] as in the PM it sends to users, the \ remains in the message and it should not, right? thank you for your help! |
||
|
Thoul |
||
| Sat Nov 17, 2007 1:17 am Post subject: Re: php help | ||
|
Quote: i know that in php i need to put a \ in front of a '
You only need to put an \ in front of an ' when it is surrounded by other ' marks. This is easier to explain with an example. When you have this: Code: $lang['Whatever'] = 'Here's text where a slash is needed.';
That will cause a parse error unless you have a \ before the ' in Here's, like Here\'s. So the correct form of this line would be: Code: $lang['Whatever'] = 'Here\'s text where a slash is needed.';
But when you use " instead of ' around the whole string, you don't need the slash. Like this: Code: $lang['Whatever'] = "Here's text where a slash is NOT needed.";
If you add a \ into this line before the ', it will be displayed as normal text. But, if you needed to use " inside this, then you would use a \ before those ". Code: $lang['Whatever'] = "I told him, \"When quoting inside double quotes, be sure to use slashes.\"";
I hope that explains it well enough. |
||
|
panther |
||
| Sat Nov 17, 2007 12:50 pm Post subject: | ||
|
thank you very much for your help!
but i still have the problem... if i use your example: Code: $lang['Whatever'] = "Here's text where a slash is NOT needed.";
this is the text i get in the Contact_Alert_PM: Here\'s text where a slash is NOT needed. the backslash is still there in the alert PM! if i use this code: Code: $lang['Whatever'] = 'Here\'s text where a slash is needed.';
the problem is the same! in the PM that alerts of a new contact the text contains the \ whatever code you gave, the \ always apperas in the PM thank you. |
||
|
panther |
||
| Thu Nov 22, 2007 10:45 am Post subject: | ||
|
up
any help please? |
||
Page 1 of 1