I have searched here, googled, read about List(), Each() but I'm still stomped.
Here I assign values to a list of links:
$cfg['siteLink']['index']['to the front page'] = 'index.php';
$cfg['siteLink']['music']['to the music database'] = 'music.php';
Trying to extract back out from array:
function siteLinks() {
global $cfg;
while (list($linkDescr, $linkName, $linkFile) = each($cfg['siteLink'])) {
echo ' | <a href="' . $linkFile . '" title="' . $linkDescr . '">' . $linkName . '</a>';
}
}
I have struggled with this for hours now but I can't get the A HREF part to work like I want it to.
print_r ($cfg['siteLink']);
Prints: Array ( [index] => Array ( [front page] => index.php ) [music] => Array ( [music database] => music.php ) )
It looks like populating(is it populating? 🙂 the array works ok?
Do I need another WHILE() because it is 3 values? One of my PHP-books say something about 4 values?
Any suggestions? Maybe this is a stupid way to build list of links?
It worked ok before I decided to add a third value to the array ($linkDescr - hover text on links) except my link divider (the "|") was after the last link too, guess thats my next goal 🙂
I have been lurking here a long time and I must say you people are the best, keep up the good work!
Uluen.