eesyphp/example/includes/url-helpers.php
Benjamin Renard 4f47dc056d Tpl: Add stuff to handle static files
* Move example application in example sub-directory
* Widely use App::get() instead of Config::get()
2023-02-12 00:30:36 +01:00

23 lines
460 B
PHP

<?php
use EesyPHP\Check;
use EesyPHP\Log;
use EesyPHP\Tpl;
function get_item_from_url($id, $fatal=false) {
if (!Check :: id($id))
Log :: fatal(_('Invalid element identifier.'));
$item = get_item($id);
if(!is_array($item)) {
$error = sprintf(_("Item #% s not found."), $id);
if ($fatal)
Log :: fatal($error);
Tpl :: add_error($error);
return false;
}
return $item;
}
# vim: tabstop=2 shiftwidth=2 softtabstop=2 expandtab