Displaying link to site page

Permalink 1 user found helpful
In my controller.php I have

$page = Page::getByID($pageref);

I need to retrieve the page name and full URL to the page on my site

Ie

Name Page to display
URL local host/cc5/index.php/team/about

Appreciate for any help on what code to place in controller.php and/or view.php for my block.

 
linuxoid replied on at Permalink Reply
linuxoid
hardsoft replied on at Permalink Reply
Many thank for the reply but I am still not getting what I need.

In my block I have the following

form.php

<div class="form-group">
<label class="control-label" for="pagecatalog1"><?=t('Catalog 1')?></label>
<?php
$pageSelector = Loader::helper('form/page_selector');
echo $pageSelector->selectPage('pagecatalog1', $pagecatalog1, 'ccm_selectSitemapNode');
?>
</div>

controller.php

public function view()
{

$nh = Loader::helper('navigation');
$page = Page::getByID($pagecatalog1);
$url = $nh->getLinkToCollection($page);
$this->set('pagecatalog1', LinkAbstractor::translateFrom($url));
}

view.php

<div>
<div><?php echo $pagecatalog1 ?></div>
</div>

result is

http://localhost/cc5_dev/index.php?cID=...

Note I have check the database and I have a value in the table for pagecatalog1 which is 213 and this corresponds to the page I need to be displayed if I enterhttp://localhost/cc5_dev/index.php?cID=213... displays pagehttp://localhost/cc5_dev/index.php/team/about...

I need to get this result

http://localhost/cc5_dev/index.php/team/about...

Any help to point out my error would be appreciated.
enlil replied on at Permalink Reply
enlil
$page->getCollectionName() & $page->getCollectionLink() should do the trick. Both are listed at the link @linuxoid shared!!

Edit: Quick glance at your code looks like second line of controller view may need to be:

$page = Page::getByID($this->pagecatalog1);
hardsoft replied on at Permalink Reply
Thanks for your support in this issue I was having.

As a reference for others
controller.php
        $nh = Loader::helper('navigation');
        $page = Page::getByID($this->pagecatalog1);
        if ( $this->pagecatalog1 == '0')
        {
                $this->set('pagecatalog1', '');
        } else {
                // Output:http://localhost/cc5_dev/index.php/team/about...
                $this->set('pagecatalog1', $page->getCollectionLink());
                // Output: About
                // $this->set('pagecatalog1', $page->getCollectionName());
        }
view.php
<?php
if ( $pagecatalog1 != "" ) {