![]() |
Problem with calling a file.
Hi all
I am using a calculator script which I downloaded for free. It works when I call the file directly from the url mysite.com/filename but when I call it using an "include" it doesn't work. This has 2 files being a .php and .tpl. If I use just the filename with my include everything below that page (footer) doesn't work. If I use (../filename) the footer works but the script doesn't show up on the page. The read me on this script stats that we just need to correct the url in the .php file which I have done. In the .tpl file there is nowhere which I can see that the url is displayed nor does it have the .php file being called within it. Can anyone help please. Cheers |
We would need to see the php and tpl files. A link to where you got it might help too. This probably belongs in the php forum. Don't cross post though.
|
1 Attachment(s)
Hi
I wasn't sure which forum to place this in so please feel free to move me if need be. As for the file it can be download here http://www.pc-calculators.com/loan-calculator.php as it is a free calculator but also proabably the best one I have seen yet. I want it for a car sales website. I will attach the files here as well. Cheers |
You would see why it doesn't work if you had warnings turned on. On line 38 of the php script it loads the tpl file. Modify that to reflect the path to your file.
|
Hi
Sorry to sound amiturish here but I am no php coder but do understand html. What is warnings as the path file reads PHP Code:
If the warnings thing is done somewhere esle then please tell me. |
Quote:
And this is suppose to mean what exactly please! |
don't worry about that post it is just a spammer. At the top of the page you are including the php on add the following.
PHP Code:
|
Quote:
Firstly Yes it was in the root dir but I have now changed it to the same directory as where the file I am placing the include in is which you will see below. This is a copy of the error shown; Quote:
PHP Code:
If allowed as I am not sure I can either place a link to me site page in question here or MP it to you which ever is fine by me if you feel that might help some. Cheers |
Are filename and loan-calculator.php the same files or are they different files? The reason it isn't working is exactly because of that error. In filename.php you have a function called strip however in loan-calculator.php there is also a function called strip. Easiest thing to do would probably to rename the function in the loan-calculator.php file and do a find and replace in that file to fix the function calls. I have done this for you in the following code. Replace your code in loan-calculator.php with the following.
PHP Code:
|
1 Attachment(s)
Hello
OK this is now working WOW thank you very much. BUT it now leaves another unexpected issue. As you will see in the screenshot I have take when I call the file directly using [www. sitename.com/ loan-calculator. php ] the calculator works exactly as it should. Now on my website the first box now shows up (thanks to you) but when I click on "calculate" it doesn't work. Any thoughts as to why please. Cheers |
Give us a link to the actual website so we can see it.
|
Hi There
http://www.ozyautos.com.au/sale/1/1/...46-in-new.html This website is still under constrution and the link is to the page in question. Cheers |
This is how you define your form tag: <form>
So when submit is clicked, the form calls itself (the page it's on) and refreshes the screen. You are never processing it, because it never executes "loan-calculator.php" Even if you executed it by doing this .... <form action="loan-calculator.php" method="post"> I think it would display the loan calculator but not the other page. You're going to need in the least, some javascripting. In fact, the whole loan calculator should be javascripting. Better yet, JQuery. If PHP is required to dynamically put numbers into the load "widget", you'll end-up using AJAX, which is a combination of PHP and JQuery. Scrap what you're using now and look at some of these: http://www.google.com/search?q=php+a...or&btnG=Search . |
Quote:
Please don't misunderstand me here I do appreciate your suggestion as all ideas are some merit which may suit or may not. But please check this out first. I am no expert in php but if you look at this link http://www.ozyautos.com.au/loan-calculator.php which is a as you would already know a direct link to the loan calculator and try it there it will work exactly as it should. So if it's working on my server out of the same root dir but not when it's been called with my script wouldn't you say that the most likely reason it's not working would be because the 2 scripts are conflicting somewhere and it's just a matter of finding out where as Aerospace was able to do above. I have looked at calculator scripts for over 2 weeks now and this is by far the best one I have seen and it actually works where many others don't even on heir own demo sites. Cheers |
OK ...
Let me ask this question first ... When the user wants to use your loan "widget", it is OK if the whole page refreshes each time they click 'calculate'? The answer to that will determine the method you need to use. |
| All times are GMT +1. The time now is 12:59 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.