Jump to content

nitro29

New Members
  • Posts

    3
  • Joined

  • Last visited

nitro29's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Uhm. Ok. I can see that it is a very silly question if the answer is that easy. I will try this again. Thanks EDIT: This was the worst question ever. Sorry.
  2. Hi, Who can make this work (return $rate), and make me very happy!? define('FINANCIAL_MAX_ITERATIONS', 128); define('FINANCIAL_PRECISION', 1.0e-08); function RATE($nper, $pmt, $pv, $fv = 0.0, $type = 0, $guess = 0.1) { $rate = $guess; if (abs($rate) < FINANCIAL_PRECISION) { $y = $pv * (1 + $nper * $rate) + $pmt * (1 + $rate * $type) * $nper + $fv; } else { $f = exp($nper * log(1 + $rate)); $y = $pv * $f + $pmt * (1 / $rate + $type) * ($f - 1) + $fv; } $y0 = $pv + $pmt * $nper + $fv; $y1 = $pv * $f + $pmt * (1 / $rate + $type) * ($f - 1) + $fv; // find root by secant method $i = $x0 = 0.0; $x1 = $rate; while ((abs($y0 - $y1) > FINANCIAL_PRECISION) && ($i < FINANCIAL_MAX_ITERATIONS)) { $rate = ($y1 * $x0 - $y0 * $x1) / ($y1 - $y0); $x0 = $x1; $x1 = $rate; if (abs($rate) < FINANCIAL_PRECISION) { $y = $pv * (1 + $nper * $rate) + $pmt * (1 + $rate * $type) * $nper + $fv; } else { $f = exp($nper * log(1 + $rate)); $y = $pv * $f + $pmt * (1 / $rate + $type) * ($f - 1) + $fv; } $y0 = $y1; $y1 = $y; ++$i; } return $rate; } // function RATE() Could be with following values: $nper=120 $pmt=1009.06 $pv=100,000 This is originally from StackOverflow . Thanks a million.
  3. Hi, I am very new to php, so would appreciate any advice with this probably very noob question. I need to moderate - make an alternate - joomla module menu php file which adds a <span> tag to the output. I have added the <span> but it is not in the right position. I can only get it either before or after the anchor tag, not in between as needed. The HTML output for the menu and one menu item is: <ul id="mainNav" class="nav menu "> <li class="item-435"> <span></span> <a href="/testserver/joomla/dev">Development</a> </li> </ul> I need the <span> tag inside the anchor tag in order for my background hover and link function to work correctly, like this: <ul id="mainNav" class="nav menu "> <li class="item-435"> <a href="/testserver/joomla/dev">Development<span></span></a> </li> </ul> Can anyone help me?? This is the current php code for the module (which gives the wrong <span> placement): <?php /** * @package Joomla.Site * @subpackage mod_menu * * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; // Note. It is important to remove spaces between elements. ?> <?php // The menu class is deprecated. Use nav instead. ?> <ul class="nav menu <?php echo $class_sfx;?>"<?php $tag = ''; if ($params->get('tag_id') != null) { $tag = $params->get('tag_id').''; echo ' id="'.$tag.'"'; } ?>> <?php foreach ($list as $i => &$item) : $class = 'item-'.$item->id; if ($item->id == $active_id) { $class .= ' current'; } if (in_array($item->id, $path)) { $class .= ' active'; } elseif ($item->type == 'alias') { $aliasToId = $item->params->get('aliasoptions'); if (count($path) > 0 && $aliasToId == $path[count($path) - 1]) { $class .= ' active'; } elseif (in_array($aliasToId, $path)) { $class .= ' alias-parent-active'; } } if ($item->type == 'separator') { $class .= ' divider'; } if ($item->deeper) { $class .= ' deeper'; } if ($item->parent) { $class .= ' parent'; } if (!empty($class)) { $class = ' class="'.trim($class) .'"'; } echo '<li'.$class.'><span></span>'; // Render the menu item. switch ($item->type) : case 'separator': case 'url': case 'component': case 'heading': require JModuleHelper::getLayoutPath('mod_menu', 'default_'.$item->type); break; default: require JModuleHelper::getLayoutPath('mod_menu', 'default_url'); break; endswitch; // The next item is deeper. if ($item->deeper) { echo '<ul class="nav-child unstyled small">'; } // The next item is shallower. elseif ($item->shallower) { echo '</li>'; echo str_repeat('</ul></li>', $item->level_diff); } // The next item is on the same level. else { echo '</li>'; } endforeach; ?></ul> I have tried messing around with the <span> tags but just can't make it work.. I would really appreciate any help. Thanks in advance!!! /Soren
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.