-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added CSS only Dropdown Menu #8
base: gsoc2013
Are you sure you want to change the base?
Conversation
|
||
$_submenu_items = array(); | ||
$i = 0; | ||
while ($_top_level_pages[$i]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
never use while loops in your code. Only do FOR loops or FOR EACH. While loops are old school programming which are very brittle. This looping techinque can cause you infinite loops
|
||
$_submenu_items = array(); | ||
foreach ($_top_level_pages as $key => $top_level_page) { | ||
$_submenu_items[$key] = get_sub_navigation(str_replace($host_dir, '', $top_level_page['url'])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
personally do not remember already but double check what php version is supported by ATutor and maybe apply array_map() instead if ATutor works with php >= 4.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for some reason, this is not working.
$_submenu_items = array_map(
function($top_level_page) {
return get_sub_navigation(str_replace($host_dir, '', $top_level_page['url']));
},
$_top_level_pages);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well this is not JavaScript to do array_map(function(blah)... ) but on my second thought do not worry about array_map here.
if ($sub_level_pages['url'] == $this->current_sub_level_page): | ||
echo htmlentities_utf8($sub_level_pages['title']); | ||
else: ?> | ||
<a href="<?php echo $sub_level_pages['url']; ?>"><?php echo htmlentities_utf8($sub_level_pages['title']); ?></a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like a lot what you've done ^. I think this is another place where you want to move away from HTML/PHP welding to a simple PHP and its echo.
No description provided.