PHP code example of visionbites / usage-reference
1. Go to this page and download the library: Download visionbites/usage-reference library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
visionbites / usage-reference example snippets
return [
'visionbites.usage-reference' => [
'expire' => 15 // in minutes
'cache' => true
],
];
public function events()
{
$refService = new ReferenceService();
// pass the uuid of the place and the template that you are looking for
$events = $refService->findReferencesForUuid($this->uuid()->toString(), 'event');
// depending on what you want to do with the events you can either return them here or
// resolve the pages and return a pages collection
$eventsPages = new Pages();
foreach ($events as $event) {
$eventPage = $this->kirby()->page($event['uuid']);
$eventsPages->append($eventPage);
}
return $eventsPages;
}