62 lines
1.6 KiB
PHP
62 lines
1.6 KiB
PHP
<?php namespace ProcessWire;
|
|
|
|
function getConfig($paxina)
|
|
{
|
|
$configuracion = array();
|
|
|
|
foreach($paxina->configuracion as $config)
|
|
{
|
|
switch ($config->parametro_tipo->value)
|
|
{
|
|
case 'texto':
|
|
$configuracion[$config->parametro_nome] = $config->parametro_valor;
|
|
break;
|
|
case 'imaxe':
|
|
$configuracion[$config->parametro_nome] = array(
|
|
'url' => $config->parametro_imaxe->first()->url,
|
|
'descripcion' => $config->parametro_imaxe->first()->description,
|
|
'miniatura' => $config->parametro_imaxe->getTag("mini")->url
|
|
);
|
|
break;
|
|
case 'cor':
|
|
list($r, $g, $b) = sscanf($config->parametro_cor, "%02x%02x%02x");
|
|
$configuracion[$config->parametro_nome] = $r . ', ' . $g . ', ' . $b;
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
return $configuracion;
|
|
}
|
|
|
|
function renderMigas($paxina)
|
|
{
|
|
$saida = '';
|
|
|
|
$saida .= '<h1>';
|
|
if($paxina->parents->count())
|
|
{
|
|
$saida .= $paxina->parents->implode(" > ", "<a href='{url}'>{title}</a>",
|
|
array(
|
|
'append' => '>'
|
|
)
|
|
);
|
|
}
|
|
$saida .= $paxina->title . '</h1>';
|
|
|
|
return $saida;
|
|
}
|
|
|
|
function renderMenu($menu, $paxinas)
|
|
{
|
|
$saida = '';
|
|
|
|
$saida .= $paxinas->implode("\n", "<li><a href=\"{url}\">{title}</a></li>",
|
|
array(
|
|
'prepend' => '<nav id="' . $menu . '">' . "\n" . '<ul>' . "\n",
|
|
'append' => "\n" . '</ul>' . "\n" . '</nav>' . "\n"
|
|
)
|
|
);
|
|
|
|
return $saida;
|
|
}
|