Using an if statement on a global page

Permalink
Hi, I have the page view list view.php page, which I need to display the page date on one page and not on another page. Obviously as it's using the same view.php template, I have tried to add this to the header to identify which page will display the date.

In the <head>
<?php $thisPage="Page1"; ?>

Then wrap this around the date display HTML

In the <body>
<?php if ($thisPage=="Page1") echo "<div class=\"date\">$datePublic</div>"; ?>

Am I using the right execution for this as it's not working. Any help would be appreciated.

Thanks,

zapbrannigan1972
 
Remo replied on at Permalink Reply
Remo
Try to put this code in your theme

$page = Page::getCurrentPage();
echo $page->getCollectionPath();


this will return the path of the current page on which you can run your check
zapbrannigan1972 replied on at Permalink Reply
zapbrannigan1972
Hi Remo,

Thank you I'll give that a go later and see how I get on.

Thanks again,
Andy