[eluser]scherman[/eluser]
Hello people, i am developing a multilang site with Codeigniter and WanWizard's Datamapper and i can't figure out how to do something.
First of all, i am developing the Article's CRUD. This are my tables:
- Articles[id, title, created, updated]
- ArticlesLang[id, article_id, lang, title, text, created, updated]
So, i want to do the general article's list, like:
Quote:- id:1
- title: 'Example1'
- languages: 'English|Spanish|French'
- id:2
- title: 'Example2'
- languages: 'Spanish'
Do you understand? I hope so.
Let's see, i get the articles at this line:
Code:
$articles->include_related('articlelang')->group_by('id')->get();
And on the view, i do this:
Code:
<?php foreach($articles->all as $article): ?>
<td><?php echo $article->id ?></td>
<td><?php echo $article->title ?></td>
<td><?php echo $article->articlelang_lang ?>/*<--- HERE IS MY PROBLEM*/</td>
<?php endforeach ?>
For example, the article with the id=1 is available in three languages, so it should have 3 objects in $article->articlelang. How can i do to get this objects?
Because when i do $article->articlelang_lang it only returns me the first lang.
Do you understand where is my problem?
Please, i hope you can help me. This is the first time i'm doing multilang's stuffs, so, i don't know if i am doing it right, on the best way, so, if you know a better way to do that, i'll be very grateful if you explain me how.
Thanks to everybody, and sorry for my english.