>>  Site Map >>  Forums >>  PHP-Nuke Newbie

Forum module - topics in forum:



PHP-Nuke Newbie - Complete phpnuke newbie? want to ask a question before installing? or have installed and are now confused? this is the place.



Need help with Block/Module

Hi,

I'm trying to create a block to display a weights and balances calculator found here

http://www.dmjwilliams.co.uk/gbsep_weight_balance.htm

Can anyone tell me if this is possible and where to start.

I want to be able to use it in the same way as on that site.

Many Thanks

Schmitt






Best option would be to use the block or moule creator

http://phpnuke-uk.net/modules.php?name=PHP-Nuke_Tools






Thanks Dar63. Do I need to create 2 files to get this working?

1 with
Quote: :
<div style="background-image: url('http://www.yoursite.com/your_envelope_image.gif');
width: 640px; height: 315px;">

<img id="crossHairImage"
style="position: relative; left: 0px; top: 0px; margin: 0px; padding: 0px;"
src="http://www.yoursite.com/crosshair.gif"
width="32" height="32" alt="" title="" />
</div>


1 with
Quote: :
function WB_ValidateInput()
{
with (document.WBCalc)
{
return !(isNaN(Number(frontWeight.value)) ||
isNaN(Number(rearWeight.value)) ||
isNaN(Number(fuelWeight.value)) ||
isNaN(Number(baggageWeight.value)));
}
}

function WB_Plot(weight, moment)
{
// Left-margin on the graph is 65 pixels...
var x = Math.round(65 + ((moment - 40000) / 10000) * 80) - 15;
var y = 266 - Math.round(((weight - 1500) / 100) * 32) - 15;

with (document.images.crossHairImage.style)
{
left = x + 'px';
top = y + 'px';
visibility = "visible";
}
}

function WB_Calculate()
{
with (document.WBCalc)
{
totalWeight.value = WB_ValidateInput() ?
(Number(emptyWeight.value) +
Number(frontWeight.value) +
Number(rearWeight.value) +
Number(fuelWeight.value) +
Number(baggageWeight.value)).toString() : "???";

emptyMoment.value =
(Math.round(Number(emptyWeight.value) * Number(emptyLever.value))).toString();
frontMoment.value =
(Math.round(Number(frontWeight.value) * Number(frontLever.value))).toString();
rearMoment.value =
(Math.round(Number(rearWeight.value) * Number(rearLever.value))).toString();
fuelMoment.value =
(Math.round(Number(fuelWeight.value) * Number(fuelLever.value))).toString();
baggageMoment.value =
(Math.round(Number(baggageWeight.value) * Number(baggageLever.value))).toString();

totalMoment.value =
(Number(emptyMoment.value) +
Number(frontMoment.value) +
Number(rearMoment.value) +
Number(fuelMoment.value) +
Number(baggageMoment.value)).toString();

// Show the crosshair on the graph...
WB_Plot(Number(totalWeight.value), Number(totalMoment.value));
}
}

function WB_Reset()
{
with (document.WBCalc)
{
// Set the fields to their default values...
emptyWeight.value = "1419.5";
frontWeight.value = "";
rearWeight.value = "";
fuelWeight.value = "222"; // Full fuel by default
baggageWeight.value = "";

emptyLever.value = "37.63";
frontLever.value = "35.90";
rearLever.value = "70.00";
fuelLever.value = "47.75";
baggageLever.value = "95.80";
}

// Hide the crosshair on the graph...
// document.images.crossHairImage.style.visibility = "hidden";

// Calculate based on empty values...
WB_Calculate();
}




Am I right in saying that the main piece of script would be the module itself and be called index.php and that both of these files need to be changed to php script? What would I do with the top piece of script (where would it go)?

I am still trying to learn the structure around creating a working block or module and appreciate any advice or step by step guide people can offer.

Thanks for any help you can give.


Schmitt






To be honest I never took much notice on the page you linked and I can't actually get it to load at the moment but I'm assuming there is a d/load which includes the scripts for all this to run and possibly an install instruction?

If so I'd really need to see how it normally incorporates into a webpage before I can really answer. how you'd make it a nuke module.

So I'll keep trying page you linked until I can find out more.






That'd be great, thanks Dar63.

Schmitt






Sh-it, forgot about this I'll take a look tommorow. Embarassed






LOL Laughing

Cheers Dar.






Well I've tried getting that calculator to function both as a phpnuke module and a normal html file and I've had no success.

Either there's something missing (ie: files) or I'm a complete numpty. Confused

Sorreee. Sad






ok. ntw, thanks spending the time on it Smile

Congrats on the 10 million page views. You've got the best support site on the net.

Schmitt






grrr I've just sat here for 15 minutes trying to get it to work too...

It refuses to calculate!!


Make sure when you try it Schmitt that you chage the bit that says;


src="http://www.yoursite.com/crosshair.gif"
url('http://www.yoursite.com/your_envelope_image.gif');

And actually have the envelope.gif and crosshair.gif hosted on your site.

You will also need this file:


http://www.dmjwilliams.co.uk/script/weightbalance.js

Rolling Eyes you probably did all that anyway so I'll shurrup!






Holy crap I got it to work!!!

PM me your email and I'll send the file to you






Details sent through in PM.

Many Thanks to you both. I'll let you know how i get on with the install.
As I said before -- this site provides best the best nuke support on the net. Very Happy Very Happy

Schmitt






Hi Vision,

Did you receive my PM's ?

Waiting with anticipation

Schmitt






Ahhh shoot sorry... was a bit under the weather...

WIll have a look now.






ok sent it to you!!

I did it as an HTML page.... I take it you know how to make it a module?

If not ask back in here and we will try and help.




Attention! You are currently viewing sitemap page!
We strongly suggest to look at original content

Search from web

Select page

Valid HTML 4.01 Valid CSS