template_directory:after-directory{-name}
Action executed after each directory in a directory page.
You need to have a working knowledge of Hooks before you get started.
The {-name} tag allows the hook to run on the specified directory name without having to write conditions. You can find the directory name in the JReviews Directories Manager. The following variations are allowed:
template_directory:after-directory- runs for all directoriestemplate_directory:after-directory-city-guide- runs on the city-guide directory
Parameters
| Name | Type | Description |
|---|---|---|
$directory |
parameter |
(array) |
$instance |
parameter |
(MyView) instance of current view class |
Boilerplate Code
Use the boilerplate code to start using the action, and add your own logic or echo output.
Clickfwd\Hook\Action::add('template_directory-after-directory-name', function($directory, $instance)
{
// Execute action or echo output
});
Examples
Most recent listings below directory page using shortcodes
Clickfwd\Hook\Action::add('template_directory:after-directory', function($directory)
{
$dirId = $directory['Directory']['dir_id'];
$title = $directory['Directory']['title'];
?>
<h2>Most recent in <?php echo $title; ?></h2>
[jreviews type="listings"
dir="<?php echo $dirId; ?>"
listing_order="rdate"
themelayout="postcard"
orientation="native-scroll"
limit="10"
]
<?php
}, 10);
Source Files
/views/themes/default/directories/directory.thtml