Skip to content
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

Open
wants to merge 13 commits into
base: gsoc2013
Choose a base branch
from
Open

Added CSS only Dropdown Menu #8

wants to merge 13 commits into from

Conversation

sdaityari
Copy link
Owner

No description provided.


$_submenu_items = array();
$i = 0;
while ($_top_level_pages[$i]) {
Copy link

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']));
Copy link

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

Copy link
Owner Author

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);

Copy link

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>
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants