i think...you will need to check first for slug, typed in categories_i18ns
and then, if exists this slug in some language, then get his foreign_key (id
for post) and with this id get post from posts table (your posts table)

i hope u understand what i mean
--
Tilen Majerle
http://majerle.eu



2010/11/20 Salines <nikola.parad...@gmail.com>

> Hello bakers,
>
> I developing a web page that uses three languages, one primary
> (croatian) and two secondary(english & german). In my db tables
> (categories) I have a field 'slug' with the corresponding data . Slug
> be also translated from croatian to english & german (deutch) and
> stored in i18ns table.
>
> example i18ns url in
> - Croatian:  .../categories/moj-naziv
> - English:   .../categories/my-name
> - German:  .../categories/mein-name
>
> Now i have problem when i want access to data.
>
> here its code:
> _____
>
> Router::connect('/:controller/:action/:slug', array('controller' =>
> 'categories', 'action' => 'view'),array('pass'=>array('slug')));
> ____
>
> <?php echo $this->Html->link(__('View', true), array('action' =>
> 'view','slug'=> $category['Category']['slug'])); ?>
>
> ---------
>
> function view($slug = null) {
>        if (!$slug) {
>            $this->Session->setFlash(__('Invalid category', true));
>            $this->redirect(array('action' => 'index'));
>        }
>        // example locale
>        $this->Category->locale = 'Eng';
>        $this->set('category', $this->Category->findBySlug($slug));
>    }
> ________
>
>
> findBySlug($slug)  locking for data in categories table, but
> translated slug is stored in category_i18ns table...
>
> How can I solve this? My mind is glowing:)
>
> Thanks.
>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.com>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to