Skip to content

dart-creations.com

Advertisement
Home arrow Forums
DART Creations Forums
Welcome, Guest
Please Login or Register.    Lost Password?
Go to bottom
TOPIC: Current Link Problem
#167
Current Link Problem 3 Years, 4 Months ago  
Hi all,

thanks for your really nice modul. But I have currently a problem.
I use your modul as submenu. So when I've pushed on a submenu link I would like a "Current-effect", so that the link change is color and has still this color until I
 
Logged Logged
  The topic has been locked.
#168
Re:Current Link Problem 3 Years, 4 Months ago  
Can you post the code you are using? You probably need to base you CSS style based on the ItemId. Not a very clean solution.
 
Logged Logged
  The topic has been locked.
#169
Re:Current Link Problem 3 Years, 4 Months ago  
I think you'll get crazy to see this code but I had'nt any other idea.....

Code:


<?php
function curPageURL() {
 $pageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}
?>

<?php
  echo curPageURL();
?>

<?php
function currentPageURL() {
 $pageURLcur = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURLcur .= "s";}
 $pageURLcur .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURLcur .= $_SERVER["SERVER_NAME"];
 } else {
  $pageURLcur .= $_SERVER["SERVER_NAME"];
 }
 return $pageURLcur;
}
?>

<?php
  echo currentPageURL();
?>


<?php // no direct access
defined('_JEXEC') or die('Go away'); ?>

<ul class="featuredarticles<?php echo $params->get('moduleclass_sfx'); ?>">
<?php foreach ($items as $item) :  ?>
 <li class="<?php echo $params->get('moduleclass_sfx'); ?>">
  <?php if ($params->get('articlelink') == "1") { ?>
  <a href="<?php echo $item->link; ?>" <?php echo $params->get('moduleclass_sfx');?>"
  id=<?php 
  $firstUrl = currentPageURL() + $item->link;
  if (firstUrl == curPageURL()){echo "id='active_menu'"}
  else{
  echo "class=";
  echo'"'
  echo $params->get('moduleclass_sfx');
  echo'"'
  } ?> 
  ">
   <?php 
    }
   if ($params->get('title') == "1") { 
     echo $item->title; 
   } 
   if ($params->get('intro') == "2") { 
   echo $item->introtext; 
   } 
   if ($params->get('body') == "2") { 
   echo $item->fulltext; 
   } 
   ?>
   <?php if ($params->get('articlelink') == "1") { ?>
   </a>
  <?php } ?>
 </li>
<?php endforeach; ?>
</ul>
<?php
if ($params->get('link') == 1)
{
?>   

<?php
}
?>

 


 
Logged Logged
 
Last Edit: 2008/10/14 10:56 By .
  The topic has been locked.
#170
Re:Current Link Problem 3 Years, 4 Months ago  
Why don't you just base the active menu on the ItemId? You will have a different ItemId for each menu item, so you should be ok ... I guess.
 
Logged Logged
  The topic has been locked.
#171
Re:Current Link Problem 3 Years, 4 Months ago  
Maybe, could you show me how it works? I give up....
 
Logged Logged
  The topic has been locked.
#172
Re:Current Link Problem 3 Years, 4 Months ago  
That's the last code I made. More I'm not able to do....PLEASE would anyone help me!


Code:



<?php 
function curPageURL() { 
 $pageURL = 'http'; 
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} 
 $pageURL .= "://"; 
 if ($_SERVER["SERVER_PORT"] != "80") { 
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; 
 } else { 
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; 
 } 
 return $pageURL; 

?> 
 

<?php 
function currentPageURL() { 
 $pageURLcur = 'http'; 
 if ($_SERVER["HTTPS"] == "on") {$pageURLcur .= "s";} 
 $pageURLcur .= "://"; 
 if ($_SERVER["SERVER_PORT"] != "80") { 
  $pageURLcur .= $_SERVER["SERVER_NAME"]; 
 } else { 
  $pageURLcur .= $_SERVER["SERVER_NAME"]; 
 } 
 return $pageURLcur; 

?> 
 
<?php 
  echo curPageURL(); 

 ?> 

<?php // no direct access
defined('_JEXEC') or die('Go away'); ?>

<ul class="<?php echo $params->get('moduleclass_sfx'); ?>">
<?php foreach ($items as $item) :  ?>
<li class="<?php echo $params->get('moduleclass_sfx'); ?>">
<?php if ($params->get('articlelink') == "1") { ?>
<a href="<?php echo $item->link; ?>" class="<?php echo $params->get('moduleclass_sfx'); ?>" 
<?php
 $currentPageURL = currentPageURL();
         $togCurPagUrl = $currentPageURL.$item->link;
         if ($curPageURL == $togCurPagUrl)  {echo "id='active_menu'";}
?> >

<?php 
  }
if ($params->get('title') == "1") { 
   echo $item->title; 

if ($params->get('intro') == "2") { 
echo $item->introtext; 

if ($params->get('body') == "2") { 
echo $item->fulltext; 

?>
<?php if ($params->get('articlelink') == "1") { ?>
</a>
<?php } ?>
</li>
<?php endforeach; ?>
</ul>
<?php
if ($params->get('link') == 1)
{
?>   

<?php
}
?>


 
Logged Logged
  The topic has been locked.
Go to top

Buy us a beer!

If we've helped you, consider buying a beer €3. It will inspire us to keep on giving! Cheers!

Sponsors

Login Form






Lost Password?
No account yet? Register

Pagerank
Generated in 0.51211 Seconds