Jump to content

ACP Menu


newbie LAC

Recommended Posts

Posted

Hello,

1. Any reason why you use duplicate code in appmenu template?

applications/core/dev/html/admin/global/appmenu.phtml

					{{if count( $item ) > 1}}
						<li data-menuKey='{$appAndModule}'>
							<h3>{lang="menu__{$appAndModule}"}</h3>
							<ul class='ipsList_reset'>
								{{foreach $item as $key => $url}}
									<li>
										{{$badgeNumber = NULL; try { $badgeNumber = \IPS\Application::load( mb_substr( $appAndModule, 0, mb_strpos( $appAndModule, '_' ) ) )->acpMenuNumber( $url ); } catch( \Exception $ex ){ } }}
										{{if $badgeNumber}}
											<a href='{url="$url"}'>
												{lang="menu__{$appAndModule}_{$key}"}
												<span class='ipsNotificationCount'>{$badgeNumber}</span>
											</a>
										{{else}}
											<a href='{url="$url"}'>{lang="menu__{$appAndModule}_{$key}"}</a>
										{{endif}}
									</li>
								{{endforeach}}
							</ul>
						</li>
					{{else}}
						<li data-menuKey='{$appAndModule}'>
							<h3>{lang="menu__{$appAndModule}"}</h3>
							<ul class='ipsList_reset'>
								{{foreach $item as $key => $url}}
									<li>
										{{$badgeNumber = NULL; try { $badgeNumber = \IPS\Application::load( mb_substr( $appAndModule, 0, mb_strpos( $appAndModule, '_' ) ) )->acpMenuNumber( $url ); } catch( \Exception $ex ){ } }}
										{{if $badgeNumber}}
											<a href='{url="$url"}'>
												{lang="menu__{$appAndModule}_{$key}"}
												<span class='ipsNotificationCount'>{$badgeNumber}</span>
											</a>
										{{else}}
											<a href='{url="$url"}'>{lang="menu__{$appAndModule}_{$key}"}</a>
										{{endif}}
									</li>
								{{endforeach}}
							</ul>
						</li>
					{{endif}}

2. Also pay attention to 

				{{$totalBadge = 0;}}
				{{foreach $items as $appAndModule => $item}}
					{{foreach $item as $key => $url}}
						{{$badgeNumber = NULL; try { $badgeNumber = \IPS\Application::load( mb_substr( $appAndModule, 0, mb_strpos( $appAndModule, '_' ) ) )->acpMenuNumber( $url ); } catch( \Exception $ex ){ } }}
						{{if $badgeNumber}}
							{{$totalBadge += $badgeNumber;}}
						{{endif}}
					{{endforeach}}
				{{endforeach}}

If we move <ul> block (<ul class='ipsList_reset ipsScrollbar ipsScrollbar_light'>) above <a> (<a href='{url="$menu['defaults'][$tab]"}'>) we can count the $totalBadge in <ul>

3. Also it will be useful to highlight a menu item where we located

Something like

highlight.thumb.jpg.eb182a1ce74027786946b1e5e471769e.jpg

Posted

That code in your first codebox must be some leftover. I guess they were handling single items in a special manner at some point, but at some point fixed it to be the same. But yeah, that piece of code is a completely useless duplicate :)

I also like your idea #3.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...