Get url for PageID on the fly for a block
Permalink
I have created a block that will (eventually) use a switch case to feed certain categories of content via ID to anywhere its used and based on the category the page has been assigned.
I have the content feeding through, but still stuck as to how you feed the unique page url into the switch case.
Any ideas?
Here is the code and to me this seems a noob problem, and yes, for the sake of argument, I am pretty new to this level of development with C5. Any help would be greatly appreciated.
I have the content feeding through, but still stuck as to how you feed the unique page url into the switch case.
Any ideas?
<?php switch($c->getAttribute('category_type')->getCategoryTypeID()){ case 1: ?> <?php $list->filterByCategoryType(2); ?> <?php $pages = $list->getResults(); ?> <?php foreach($pages as $page) { ?> <h2><?php echo $page->getCollectionName(); ?></h2> <p><?php echo $page->getCollectionDescription();?></p> <p><a href="<?php echo $url ?>" target="<?php echo $target ?>">View more</a><p/>//this is the line I can't seem to figure out. <?php } break; case 2: echo 'display Category 2'; break; case 3: echo 'display Category 1';
Viewing 15 lines of 19 lines. View entire code block.
Here is the code and to me this seems a noob problem, and yes, for the sake of argument, I am pretty new to this level of development with C5. Any help would be greatly appreciated.
this did it, for anyone needing help:
<p><a href="<?php echo \URL::to($page); ?>">View more</a><p/>