Help Inserting php calculator in block

Permalink
Hello,

I want to insert a calculator into a page. I have calculator working outside of C5 but I cant get it working if I try to put it in a block. The calculator uses php & javascript and displays dropdown choices and results in html.

I am an absolute beginner when it comes to more advanced c5 hacks and 'hello world' is as far as my php knowledge goes. Could someone kindly show the steps i need to do to make this work in c5. here is the main php :

<?php
    require_once ("../class/uconvert.class.php");
    $c = new uconvert;
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" href="style.css" />
        <title>Unit converter</title>
        <script type="text/javascript">
            window.onload = function()
            {
                elements = document.getElementsByTagName("select");
                for (i = 0; i < elements.length; i++)

 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi darkmatter,

What version of concrete5 are you using?

Do you have a link to the full calculator code?

If the steps required to use the calculator exceed your experience level, are you open to paying someone to do it for you? If so, I can refer you to some quality, reliable developers.
darkmatter replied on at Permalink Reply 1 Attachment
I'm using v5.6. I have attached the files. I intend to remove some of the conversions which I dont need and add others. I'm sure there would be a more efficient way of making the calculator but it works outside of c5 and if i can get it to work inside, I can edit to my needs. If It can't be made to work relatively easily I will leave it out as it is not essential to my site..more just a useful tool for visitor to use if needed.
mnakalay replied on at Permalink Reply
mnakalay
@darkmatter I don't know if @MrKDilkington will agree with me on this one, but the code you are suing seems antiquated to me. What's more, using some ajax and php code for a calculator sounds overkill but I don't really know your intentions so I might be wrong on that one.
darkmatter replied on at Permalink Reply
Thanks for your comments. I don't really have the knowledge of different types of coding. I have generally got by with php stuff by modifying/tweaking code... its how i learn. I didn't write the converter script, I downloaded it from a code site (with license) and knew I could tweak it. Like I say its just getting it to work inside c5 that is my problem.
mnakalay replied on at Permalink Reply
mnakalay
I looked at the code and it wouldn't be an overly complex task to make it into a Concrete5 block. It would however be complex to explain to you how to do it if you feel you don't have the technical skill.

If you are not in a hurry I could build it for you if you want say in a week or two. Free of charge.
darkmatter replied on at Permalink Reply
Thanks for your kind offer. Another member has just made it into a block for me. I now have the original code and block, perhaps I might now be able to understand how blocks work by examining the files & reading the c5 docs. Many Thanks
mnakalay replied on at Permalink Reply
mnakalay
Isn't this community awesome? Seriously! :)