Hello everyone, i started learning CouchCMS a couple of days ago and i think it's an amazing work!
I read all the documentation but still have doubts about accessing related_pages information from another template.
I created a dummy site with the aim to display race results trying to minimize the data entry.
I need to display the race results in different pages of the site.
I started creating the "entity" pilot, so that i could insert the data about the pilots only once: this template is clonable but not executable, since i'm not interested in displaying their profile in a dedicated page.
Then i created a page called rankings to display the general classification (pilots' name, their team and the points they earned). In this page i created a 'relation' so i could pick the pilot from a dropdown menu. This template is not clonable, since i want just one page for all rankings.
So far, so good
Now the question is: how can i display the rankings and the pilots information in the homepage of the site, getting all the info from the 'it_IT/ranking.php' non-clonable template?
Really cannot figure out how to do this
I tried to do something like this, but with no results
(the total points are displayed but the related_pages block is not being executed..)
Can you help me?
(sorry for my bad english, i tried to do my best so you could understand the issue..)
Thank you so much!
I read all the documentation but still have doubts about accessing related_pages information from another template.
I created a dummy site with the aim to display race results trying to minimize the data entry.
I need to display the race results in different pages of the site.
I started creating the "entity" pilot, so that i could insert the data about the pilots only once: this template is clonable but not executable, since i'm not interested in displaying their profile in a dedicated page.
- Code: Select all
<!-- pilots.php -->
<?php require_once('couch/cms.php'); ?>
<cms:template clonable='1' executable='0'>
<cms:editable name="nome" label="Nome pilota" type="text" />
<cms:editable name="team" label="Team pilota" type="text" />
<cms:editable name='foto' label='Foto pilota' desc='' type='image' />
</cms:template>
<?php COUCH::invoke(); ?>
Then i created a page called rankings to display the general classification (pilots' name, their team and the points they earned). In this page i created a 'relation' so i could pick the pilot from a dropdown menu. This template is not clonable, since i want just one page for all rankings.
- Code: Select all
<!-- it_IT/ranking.php -->
<?php require_once('couch/cms.php'); ?>
<cms:template clonable='0' executable='1'>
<!-- up to 5 positions -->
<?php for($i=1;$i<=5;$i++){
?>
<cms:editable name="posizione_<?php echo $i?>" label="Numero posizione" type="text"><?php echo $i?></cms:editable>
<cms:editable type='relation' name='ranking_pilots_<?php echo $i?>' masterpage='pilots.php' has='one' label='Pilota' />
<cms:editable name="punti_<?php echo $i?>" label="Punti" type="text" />
<cms:editable name="gare_<?php echo $i?>" label="Gare totali" type="text" />
<?php
}
?>
</cms:template>
<?php for($i=1;$i<=5;$i++){ ?>
Position: <cms:show posizione_<?php echo $i?> /><br>
Points: <cms:show punti_<?php echo $i?> /><br>
Total Races: <cms:show gare_<?php echo $i?> /><br>
<cms:related_pages 'ranking_pilots_<?php echo $i?>' >
<img src="<cms:show foto/>" /><br/>
<h4><cms:show nome /></h4>
<h5><cms:show team /></h5>
</cms:related_pages>
<?php } ?>
<?php COUCH::invoke(); ?>
So far, so good

Now the question is: how can i display the rankings and the pilots information in the homepage of the site, getting all the info from the 'it_IT/ranking.php' non-clonable template?
Really cannot figure out how to do this

I tried to do something like this, but with no results

- Code: Select all
<!-- index.php -->
<?php require_once('couch/cms.php'); ?>
...
<cms:pages masterpage='it_IT/ranking.php'>
<?php for($i=1;$i<=5;$i++){ ?>
Total points: <cms:show punti_<?php echo $i?>/><br/>
<cms:related_pages 'ranking_pilots_<?php echo $i?> 'masterpage="pilots.php">
Pilot's name: <cms:show nome_<?php echo $i?>/><br/>
Pilot's team: <cms:show team_<?php echo $i?>/>
</cms:related_pages>
<?php } ?>
</cms:pages>
...
<?php COUCH::invoke(); ?>
Can you help me?
(sorry for my bad english, i tried to do my best so you could understand the issue..)
Thank you so much!