Welcome Guest, Not a member yet? Register   Sign In
DataMapper: Multilang site
#1

[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>&lt;?php echo $article->id ?&gt;</td>
     <td>&lt;?php echo $article->title ?&gt;</td>
     <td>&lt;?php echo $article->articlelang_lang ?&gt;/*<--- HERE IS MY PROBLEM*/</td>
&lt;?php endforeach ?&gt;

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.


Messages In This Thread
DataMapper: Multilang site - by El Forum - 03-07-2012, 10:17 AM
DataMapper: Multilang site - by El Forum - 03-07-2012, 11:00 AM
DataMapper: Multilang site - by El Forum - 03-08-2012, 06:55 AM
DataMapper: Multilang site - by El Forum - 03-08-2012, 07:22 AM
DataMapper: Multilang site - by El Forum - 03-10-2012, 06:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB