Forum for discussing general topics related to Couch.
6 posts Page 1 of 1
Hi there
I bet you can answer this very easily:
I have a bi-lingual Couch site, each page has 'toggle' link so a visitor can switch languages instantly.
This is fine everywhere except on a blog post. To switch to the equivalent blog post in the other language, I need to dynamically link the page.
Is there a variable I can append to the page name (or perhaps build a page variable)?
So that if someone is looking at "blog-cy.php?p=38" I can dynamically link them to the English version, in this example "blog.php?p=38"
Perhaps I just need a way of specify the "p=38" as a variable?
Many thanks
Chris
Cloned pages can be referred to by page id or by page name and both are unique. page id is unique across all templates and page name is unique within the same template. It means that the only solution would be to relate blog post to the other post via relations in backend.
Hi there
Thanks for your reply.
I was hoping instead to simply build a page link dynamically using a variable, assuming that the cloned page id, for example "?p=38", would be available as a couch cms variable somewhere.
Thus, if the blog post was 'blog-cy.php?p=38' (Welsh language in this case) the english language equivalent page would be "blog.php?p=38". And vice versa.
Just need the id as a variable really.
Since you can't use ID which CMS auto-assigns to each cloned page, what is your idea? Some common number which is manually assigned by admin to a post with translated post?

Maybe it is simpler to have 1 template for blog posts, i.e. blog.php and have language as parameter, as in
blog.php?p=38&lang=cy

This is a much easier way to manage things, though maybe doesn't fit your requirements.
Hi Chris,

As @trendoman pointed out, page ids are unique. So suppose the page you are on is blog-cy.php?p=38, that '38' will unequivocally point to one single page - the current one you are visiting. If you try to use that id with another template e.g as blog.php?p=38, it will result in a '404 page not found error' as the page with id '38' will not be found under the new template.

That said, I can see what you are trying to achieve. Again as @trendoman mentioned, the solution is to use a 'relation' region in one of the two templates. This way while creating a page in one language, you can explicitly link it with its other language counterpart by choosing that page from a drop-down list.

Please see the solution given in the following thread -
viewtopic.php?f=2&p=18935

The above mentioned solution is for three languages but can easily adapt it to the two you need.

Hope it helps.
Thanks everyone. I think I finally get the idea now.
I'll check the link, and try your suggestions - thanks again for your help.
Best regards
Chris
6 posts Page 1 of 1
cron