Hi everyone!
I have done some templates for linguistic theory for different languages on my website. All is managed by CouchCMS.
Now I have to do a "study plan": every "day" in a study plan is a cloned page, and every "day" you have some theory to learn.
The administrator is supposed to enter couchCMS-managed URLs into array of textareas, represented as <cms:repeatable>.
Now when the user visits a page, corresponding to a "day" in the study plan, he or she has to see chunks of text from those links (at least page titles).
I've tried using <cms:php> tag, but it doesn't work as expected:
When I try not using sprintf and place page_name manually instead of %s, it does work.
My suspicion is that I cannot use <cms:pages> with dynamic parameters inside of <cms:php> tag. Is this true? If so, how would you overcome this limitation?
Many thanks for any help.
Best regards,
Helga.
I have done some templates for linguistic theory for different languages on my website. All is managed by CouchCMS.
Now I have to do a "study plan": every "day" in a study plan is a cloned page, and every "day" you have some theory to learn.
The administrator is supposed to enter couchCMS-managed URLs into array of textareas, represented as <cms:repeatable>.
- Code: Select all
<cms:template clonable='1' nested_pages='1' order='1' title="<?= $template_title ?>">
<cms:repeatable
name='links'
order='1'>
<cms:editable
name='url'
type='textarea'
label='URL'
width='590'
height='50'
col_width='500'
no_xss_check='1' />
</cms:repeatable>
</cms:template>
Now when the user visits a page, corresponding to a "day" in the study plan, he or she has to see chunks of text from those links (at least page titles).
I've tried using <cms:php> tag, but it doesn't work as expected:
- Code: Select all
<cms:show_repeatable 'links'>
<cms:php>
$url = '<cms:show url />';
if (strpos($url, 'http://')===0) {
if(strpos($url, 'theory')!==FALSE) {
$split_url = explode('/', $url);
$page_name = $split_url[count($split_url)-1];
echo sprintf('<cms:pages masterpage="/theory/german.php" page_name="%s">test<cms:show k_page_title /></cms:pages>', $page_name);
}
}
</cms:php>
</cms:repeatable>
When I try not using sprintf and place page_name manually instead of %s, it does work.
My suspicion is that I cannot use <cms:pages> with dynamic parameters inside of <cms:php> tag. Is this true? If so, how would you overcome this limitation?
Many thanks for any help.
Best regards,
Helga.