<?php
$sections = array(
array( 'name' => 'home', 'uri' => '/', 'title' => 'home'),
array( 'name' => 'tech', 'uri' => '/tech', 'title' => 'ux/ui' ),
array( 'name' => 'monetization', 'uri' => '/monetization', 'title' => 'monetization' ),
array( 'name' => 'contact', 'uri' => '/contact', 'title' => 'contact', 'callToAction' => true, 'desktopTitle' => 'contact us' ),
array( 'name' => 'blog', 'uri' => 'https://blog.marfeel.com/blog', 'title' => 'blog', 'external' => true),
);
function callToActions($section)
{
return $section["callToAction"];
}
function defaultSections($section)
{
return !$section["callToAction"];
}
function buildSections ($sections) {
$index = count($sections);
while($index) {
$section = $sections[--$index];
echo '<li>
<a href="'. $section["uri"] . '">' . ($section["desktopTitle"]? ucfirst($section["desktopTitle"]): ucfirst($section["title"])) . '</a>
</li>';
}
}
buildSections(array_filter($sections, callToActions));
//print_r(array_filter($sections, defaultSections));
preferences:
46.88 ms | 402 KiB | 5 Q