HEX
Server: Apache
System: Linux v38079.2is.nl 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: democfellows (10015)
PHP: 8.1.34
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/creativefellows.nl/test.creativefellows.nl/oudlondon.nl/includes/nav.inc.php
<?php

	echo '<nav id="navigation">';		
		echo '<ul class="hide-on-mobile" id="main-navigation">';						

		$navs 	= $cassette->run("SELECT * FROM `secties` WHERE `zichtbaar` = '1' AND `active` = '1' ORDER BY `position` ASC");					
		$count  = 0;
		foreach($navs as $i => $n)
		{
			$link 			= vl($n["naam"]);
			$active 		= (vl(strtolower($section)) == vl(strtolower($n["naam"])) || strtolower($section) == "home" && $i == 0) ? ' current' : '';
			$section_name	= $n["naam"];
			$section_link	= $cassette->link_base.$link;


			/*
			 * Get section translation
			 */
			if($cassette->lang_id != 0)
			{
				$translation 	= $cassette->getTranslation("element_id",$n["sectie_id"],"section");
				if(!$translation) continue;
				$section_name  	= $translation != false ? $translation["value"] : $n["naam"];		
				$section_link	= $cassette->link_base.vl2( $translation["value"] );
			}
			
			
			/*
			 * Items in section dropdown
			 */
			$subs = $cassette->getNavigation(1,$section_name,false,true,true);
			$dropdown_item_count = 0;
			$dropdown_items = "";
			
			if(count($subs[0]) > 0 || count($subs[1]) > 0)
			{
		
				if( count($subs[0]) && vl($section) == vl($n["naam"]) && $category == null) $has_categories = $subs[0];
		
				$dropdown_items .= '<ul class="">';
				for ($i = 0; $i < count($subs); ++$i) {
					
					foreach($subs[$i] as $s)
					{
						/*
						 * Link is category
						 */
						if(isset($s["category_id"]))
						{
							$link_to_item 	= $section_link ."/". vl($s["naam"]);
							$link_label		= $s["naam"];
													
							// category translation
							if($cassette->lang_id != 0)
							{
								$translation = $cassette->getTranslation("element_id",$s["category_id"],"category");
								if($translation != false)
								{
									$link_label  	= $translation["value"];		
									$link_to_item		= $section_link ."/".  vl( vn( $translation["value"] ) );																
								}
								else continue;
							}
					
						}
						
						/*
						 * Link is entry
						 */
						else
						{
						
							$data 	= $cassette->entries(null,null,$s["uid"]);
							if(!$data) continue;

						//	$link 	= vl2($n["naam"]).'/'.vl($s["naam"]);
							$fn		= $data[0]->first_field;
					
							$link_to_item 	= $data[0]->entry_link;
							$link_label		= $data[0]->$fn;
						
						}
						
						$dropdown_items .= '<li>';
						$dropdown_items .= '<a href="'.$link_to_item.'">'. $link_label .'</a>';
						$dropdown_items .= '</li>';
						
						$dropdown_item_count++;
					}
			
				}	
				$dropdown_items .= '</ul>';
				
			}
		
			/*
			 * Output link
			 */	
			echo '<li class="'. ($dropdown_item_count > 0 ? "has-dropdown" : "") .'">';
				echo '<a href="'. ($n["redirect"] ? $n["redirect"] : $section_link) .'" class="toplevel '. $active .'"'. ( $n["redirect"] && preg_match("/http/",$n["redirect"]) ? 'target="_blank"' : "" ) .'>'. $section_name .'</a>';	
				if($dropdown_item_count > 0) echo $dropdown_items;										
			echo '</li>';
			$count++;
		}

		echo '</ul>';

	echo '</nav>';

?>