- error_log: documentation ( source)
<?php
/**
Ejemplo pàra post: https://trasweb.net/blog/optimizacion-web/optimizacion-de-funciones-php
*/
$vista = new stdclass;
function get_menu() {
static $cache = null;
if(isset($cache) ) return $cache;
error_log('Se inicia la creación de menú');
$menu[] = ['title' => 'Inicio', 'href' => '/'];
$menu[] = ['title' => 'Servicios', 'href' => '/servicios'];
$menu[] = ['title' => 'Quiénes somos', 'href' => '/quienes-somos'];
$menu[] = ['title' => 'Blog', 'href' => '/blog'];
$menu[] = ['title' => 'Contacto', 'href' => '/contacto'];
error_log('Se finaliza la creación de menú');
return $cache = $menu;
}
if(!empty(get_menu()) ) {
$vista->menu = get_menu();
$vista->menu_inferior = get_menu();
$vista->template = 'vista_con_menu';
}else {
$vista->template = 'vista_sin_menu';
}