|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Can anyone give me a hint, I'm stuck with an issue:
I'm using a MySql database to hold some information in different languages. In one table, I named the fields no_title for norwegian text, en_title for english and so on.. To read the beginning of the norwegian article, I have to use: if(strlen($news->no_title) > 150){ $trim_title = substr($news->no_title, 0, 150) . "..."; Since I use seperate languagefiles for the site, I'd like to put a variable inside the languagefile for each language, ie no_ for norwegian, en_ for english.. In the languagefile I wrote: $lang = "no_"; then on the mainpage the code read: if(strlen($news->$lang . title) > 150){ $trim_title = substr($news->$lang . title, 0, 150) . "..."; Wich caused an error. Any hints for how I can do this? -Roffee |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
> In the languagefile I wrote: > > $lang = "no_"; > > then on the mainpage the code read: > > if(strlen($news->$lang . title) > 150){ > $trim_title = substr($news->$lang . title, 0, 150) . "..."; > > Wich caused an error. > > Any hints for how I can do this? > if(strlen($news->{ $lang . 'title' }) > 150){ $trim_title = substr($news->{ $lang . 'title' }, 0, 150) . "..."; |
|
![]() |
| Outils de la discussion | |
|
|