Forum

Thread tagged as: Question

Custom admin only page

Is it possible to create a page in admin which shows a specific search result? I am currently planning a website for a car leasing company which will list hundreds of cars and in the car detail template there will be a checkbox called 'homepage' and if checked a snippet of content for that car will appear in the site's home page. In Admin I'd like to be able to show the client, at a glance, which cars currently appear on the home page so they can easily edit those cars e.g. to unselect the checkbox to remove those cars from the homepage.

Is this possible/supported?

Neil Duddridge

Neil Duddridge 1 points

  • 5 years ago

In the past, I've accomplished this sort of thing by creating a page that is only accessible to users who are logged in to Perch:

<?php 
include($_SERVER['DOCUMENT_ROOT'].'/perch/runtime.php');
$Users       = new PerchUsers;
$CurrentUser = $Users->get_current_user();
if (is_object($CurrentUser) && $CurrentUser->logged_in()) { ?>
<!DOCTYPE html>
<html lang="en">
<head>

    ...

</head>
<body>

    ...

</body>
</html>
<?php } else { header('HTTP/1.0 403 Forbidden'); } ?>

I then add instructions and a link to the page with <perch:help>. I think Drew has mentioned that the logged_in() function is unsupported, though, so UAYOR.

Thanks Shane, I was hoping for a supported option within Perch.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You'd need to build an app to do that, but it would be possible.

Thanks Drew, not sure my app skills are up to it but will give it go

If you have a list/detail set-up, you can change the Item list column IDs in admin under region options. If your checkbox is listed there, wouldn't that tell the client which car is on the home page in the list view in admin?

Of course, with 100s of cars, that might not be easily viewable unless the columns are sortable. Is that the main problem?