get Page Title of non-current page

Permalink
I'm not great at php, so struggling with this. Wondering if there's a way to grab the page title of a non-current page?

I have hacked the Power Slider block to display text associated with an image, but the text itself links to a particular page. So in my view.php I have this:
[code] <?php foreach($images as $imgInfo) {

$f = File::getByID($imgInfo['fID']);

$fp = new Permissions($f);

$page = Page::getByID($imgInfo['pageID']);

$theLink = $nav->getLinkToCollection($page);

?>



<div class="powerSlide">

<img src="<?php echo $f->getRelativePath()?>">

<?php if ($imgInfo['powerSlidePhraseTitle'] !== "" ){ ?>

<span class="largeText"><?php echo $imgInfo['powerSlidePhraseTitle']?></span>

<?php }

if ($imgInfo['powerSlidePhraseDesc'] !== "" ){?>

<span class="smallText"><?php echo $imgInfo['powerSlidePhraseDesc']?></span>

<?php } ?>

<div class="linkText">
<div class="border">
<a class="portfolioLink" href="<?php echo $theLink ?>">view "xxxx" portfolio ></a>
</div>
</div>

</div>[\code]
Where it says view "xxxx" portfolio, I want it to show the page title of the page that $theLink is linking to.
I know I need to declare a variable to grab the page title, and then echo that variable instead of the "xxxx", but unsure at this point as to how to get the page title itself.

stretchrt
 
jordanlev replied on at Permalink Best Answer Reply
jordanlev
Kind of hard to tell what's going on because the code you pasted didn't get formatted properly (maybe you need to hit return after the "[ c o d e ]" tag?)

If you have a page variable (which looks like $page in your code I think), you can get the page title as follows:
<?php echo $page->getCollectionName(); ?>
stretchrt replied on at Permalink Reply
stretchrt
hmm, looks like I put a backslash instead of forward slash for the closing [c o d e].
I didn't write the full code, it's part of the Power Slider block, but it looks like you might be right, I'll give it a go when I get to work tomorrow and see how it turns out. Thanks!
stretchrt replied on at Permalink Reply
stretchrt
Yes that did it, thanks heaps. :)