note 80235 added to function.in-array

From: Date: Sat, 05 Jan 2008 08:01:58 +0000
Subject: note 80235 added to function.in-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-134827@lists.php.net to get a copy of this message
Breadcrumbs navigation for small sites with flat directory structure Page levels are defined in a multidimensional array. Example array given below <?php $array = array( "contact", "projects" , "projects" => array("architecture", "architecture" => array("flats","malls")), "hobbies" ); function recursive_path($needle,$haystack,$current=''){ if(!is_array($haystack)) return ''; $ret=''; $csad = "$current > <b>$needle</b>"; if(in_array($needle,$haystack))return $csad; else{ foreach($haystack as $key => $element){ $cposle = "$current > <a href=\"$key.html\">$key</a>";$ret .= recursive_path($needle,$element,$cposle); } } return $ret; } // if current filename is needle, and site structure haystack, than this prints navigation path echo recursive_path($filename,$array,'You are here: <a href="./">home</a>'); ?> I tried to do this without redundancies, but after many wasted hours, had to place 'duplicate' values for 'node' keys. Suggestion for editors: I was always impressed with this manual, and find it better than any other online programming resource. I wanted to find out more about the editing process behind it, and I discovered this: http://news.php.net/php.notes/start/150000 Spending some time there, I saw quite a few useful scripts, and am therefore confused by their deletions. I can only assume that your level of knowledge is so far beyond of us regular PHP users, and to you most of scripts are obvious, that to us took a while to write. Anyhow, here is suggestion: Since you already have almost dozen categories for managing notes, couldn't you send emails to authors informing them which decision was made. It would be informative and useful to do that. After all, if 'error' in the editing process is only 3%, it still results in almost 3000 very good notes deleted! Thanks ---- Server IP: 64.71.164.2 Probable Submitter: 24.148.46.38 ---- Manual Page -- http://www.php.net/manual/en/function.in-array.php Edit -- https://master.php.net/note/edit/80235 Del: integrated -- https://master.php.net/note/delete/80235/integrated Del: useless -- https://master.php.net/note/delete/80235/useless Del: bad code -- https://master.php.net/note/delete/80235/bad+code Del: spam -- https://master.php.net/note/delete/80235/spam Del: non-english -- https://master.php.net/note/delete/80235/non-english Del: in docs -- https://master.php.net/note/delete/80235/in+docs Del: other reasons-- https://master.php.net/note/delete/80235 Reject -- https://master.php.net/note/reject/80235 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#134827) next »