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

Add module url helper for sidemenu #132

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'] : site_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