You can use this example to get all the names of the viewers installed in your web application.
Theory
Note that a viewer is a module designed to read specific database records located at the URLs associated with that viewer.
The first segment in such URLs is always equal to the viewer name. For example, the locator
https://your.site/news/some-url-path
is associated with theNews
viewer.
All viewer modules are located at a common folder named tiny.news.feed/Viewers
. Each viewer is a named subfolder (for example, tiny.news.feed/Viewers/Search
) and a nested PHP file of the same name (for example, tiny.news.feed/Viewers/Search/Search.php
) with a certain class and methods declared there.
Source Code
Please paste this code snippet into your template to see how it works.
Let's experiment with a template like
tiny.news.feed/Themes/default/404.tpl
by pasting code into it and then opening some non-existent page associated with that template.
<?php $TEST = $cms->getViewers(); foreach ( $TEST as $name ) { echo $name . ' <br>'; } ?>
Note that the
$cms
variable is a system pointer to your web application. AndgetViewers
is a public method for reading the viewer names. If you are interested in the algorithm of this method, look at the filetiny.news.feed/Application.php
.
And here you can read the answer to another question regarding reading a list of viewers that support only specific functionality.
* This page is a demo post designed to display page content for testers. You need delete this page when you run the website in production mode.