Hi! Again with a brilliant idea, saving tons of time.
This is great for ready-made templates. Source idea: http://docs.couchcms.com/tutorials/portfolio-site/about-us.html
I enriched it with <cms:hide> tag http://docs.couchcms.com/tags-reference/hide.html
So, let's get started!!
First, we take the source unmodified html:
Then, we enclose the editable part with as many nested editable tags, as we have languages:
If we save now and refresh - the template in admin panel would naturally have 2 editables, which will be modified (text translated) and stored in database each under its unique name. So, as we have them in memory - let's show them according to the language choice . I will use the technique with lang_getter, described here many times (you can send me pm, if any trouble).
Now, we refresh and see the content outputted twice: normal code inside the editables and another instance of content output by cms:get. Let's hide the source! We have to do just one small addition to the whole code, in order to hide it. So the full code can look like this:
The trick is to embrace the editables with <cms:hide></cms:hide>. This tag does not ignore what's inside, unlike <cms:ignore></cms:ignore>. So, what's inside the hide tag is taken into account, but is not showed to the visitor. We, instead, show only what it is supposed to.
Pls, comment.
This is great for ready-made templates. Source idea: http://docs.couchcms.com/tutorials/portfolio-site/about-us.html
I enriched it with <cms:hide> tag http://docs.couchcms.com/tags-reference/hide.html
So, let's get started!!
First, we take the source unmodified html:
- Code: Select all
<p>This is our great product:<p>
Then, we enclose the editable part with as many nested editable tags, as we have languages:
- Code: Select all
<cms:editable name='content_en' type='richtext' >
<cms:editable name='content_ru' type='richtext' >
<p>This is our great product:<p>
<cms:editable />
<cms:editable />
If we save now and refresh - the template in admin panel would naturally have 2 editables, which will be modified (text translated) and stored in database each under its unique name. So, as we have them in memory - let's show them according to the language choice . I will use the technique with lang_getter, described here many times (you can send me pm, if any trouble).
- Code: Select all
<cms:get "content_<cms:show my_lang "/>
Now, we refresh and see the content outputted twice: normal code inside the editables and another instance of content output by cms:get. Let's hide the source! We have to do just one small addition to the whole code, in order to hide it. So the full code can look like this:
- Code: Select all
<!DOCTYPE html><cms:embed 'lang_getter.html' /><html lang="<cms:show my_lang />">
<body>
<cms:hide>
<cms:editable name='content_en' type='richtext' >
<cms:editable name='content_ru' type='richtext' >
<p>This is our great product:<p>
<cms:editable />
<cms:editable />
</cms:hide>
<cms:get "content_<cms:show my_lang "/>
</body>
</html>
The trick is to embrace the editables with <cms:hide></cms:hide>. This tag does not ignore what's inside, unlike <cms:ignore></cms:ignore>. So, what's inside the hide tag is taken into account, but is not showed to the visitor. We, instead, show only what it is supposed to.
Pls, comment.