Skip to content

Commit

Permalink
Add module url helper for sidemenu
Browse files Browse the repository at this point in the history
  • Loading branch information
gozonjoedaimar committed Dec 5, 2018
1 parent 8ce330c commit 81a9131
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions application/helpers/MY_url_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,11 @@ function referrer()
function redirect_referrer()
{
redirect(referrer());
}

// url for current module
function module_url($path = "")
{
$CI =& get_instance();
return site_url($CI->router->fetch_module() . "/" . $path);
}
6 changes: 3 additions & 3 deletions application/modules/admin/views/_partials/sidemenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<?php $active = ($current_uri==$parent_params['url'] || $ctrler==$parent); ?>
<li class='<?php if ($active) echo 'active'; ?>'>
<a href='<?php echo $parent_params['url']; ?>'>
<a href='<?php echo module_url($parent_params['url']); ?>'>
<i class='<?php echo $parent_params['icon']; ?>'></i> <?php echo $parent_params['name']; ?>
</a>
</li>
Expand All @@ -26,7 +26,7 @@
<?php if ( empty($page_auth[$url]) || $this->ion_auth->in_group($page_auth[$url]) ): ?>
<?php $child_active = ($current_uri==$url); ?>
<li <?php if ($child_active) echo 'class="active"'; ?>>
<a href='<?php echo $url; ?>'><i class='fa fa-circle-o'></i> <?php echo $name; ?></a>
<a href='<?php echo module_url($url); ?>'><i class='fa fa-circle-o'></i> <?php echo $name; ?></a>
</li>
<?php endif; ?>
<?php endforeach; ?>
Expand All @@ -43,7 +43,7 @@
<?php foreach ($useful_links as $link): ?>
<?php if ($this->ion_auth->in_group($link['auth']) ): ?>
<li>
<a href="<?php echo starts_with($link['url'], 'http') ? $link['url'] : base_url($link['url']); ?>" target='<?php echo $link['target']; ?>'>
<a href="<?php echo starts_with($link['url'], 'http') ? $link['url'] : module_url($link['url']); ?>" target='<?php echo $link['target']; ?>'>
<i class="fa fa-circle-o <?php echo $link['color']; ?>"></i> <?php echo $link['name']; ?>
</a>
</li>
Expand Down

0 comments on commit 81a9131

Please sign in to comment.