Forum
Access another page's title
Hi,
I am listing some sub pages in a custom 'category' parent page. So far I have managed to get the subdirectories into a string then use that in a foreach to get regions using perch_content_custom:
<?php $dirs = array_filter(glob('*'), 'is_dir');
foreach ($dirs as $course){
?>
<section class="main-content">
<h2><a href="/courses/<?php echo $course; ?>"><?php
// Title needs to go here
echo $course; ?></a></h2>
</section>
<section class="courses" style="<?php perch_content_custom('Course Navigation Background Image', array('page' => '/courses/' . $course . '/index.php', 'template' => 'course-image.html') ); ?>">
<?php
perch_pages_navigation(array(
'from-path'=>'/courses/' . $course . '/index.php',
'from-level'=>2,
'template' => 'course-grid.html'
)); ?>
</section>
<?php }
?>
But now I want to query the page to get it's title. How can I do this, if I cannot use perch_pages_title to get the information from another page?
Solved it by adding a Region to the page with a heading in it:
Ok, great.