PHP is supported by my host and by my version of IIS too (I installed the PHP support package onto my IIS system for testing my site).
The problem is that my layout is generated by a website builder which generates everything in HTML. Is there some way I could get the PHP to parse correctly within an HTML page or is that a no-hoper?
PHP is supported by my host and by my version of IIS too (I installed the PHP support package onto my IIS system for testing my site).
The problem is that my layout is generated by a website builder which generates everything in HTML. Is there some way I could get the PHP to parse correctly within an HTML page or is that a no-hoper?
You can get php to parse html files (this can cause some performance issues if you have lots of html files that do not contain php codes). A better solution is to rename the files so they have a .php extension.
As in index.html to index.php, servers.html to servers.php etc? Wouldn't that cause issues with html code being loaded in browsers or would all the html load OK?
Do I just rename the files or do I need to add anything into them for this to work?
As in index.html to index.php, servers.html to servers.php etc? Wouldn't that cause issues with html code being loaded in browsers or would all the html load OK?
Do I just rename the files or do I need to add anything into them for this to work?
Just renaming the files will do just fine. The browser doesn't make a distinction between any extensions (or no extensions). It handles the results based on the mime type (in most cases it is text/html).
and I could put the $plan=$_GET['plan'] somewhere nearer the top of the code to get it working?
Or would I need to edit the lines of code to get it working?
Or could I safely combine the two lines into the iframe src to get it working?
If the answer is yes to any of the above, which would be best? Sorry if I seem repetative but my PHP knowledge is non-existant at present (I am looking into learning it but my brain is finding it hard to understand, lol).
too but this didn't seem to work either. Where am I going wrong?
That is only a generic example of the syntax. It's not intended to be the precise wording you need, because I do not know the wording you need. What you need to do is to take a call to a specific form that actually works, and substitute <?php echo $plan; ?> for the literal plan number e.g. 44944. That should make it work for any plan number, so long as $plan is set to the required plan number.
You should be checking to make sure the value is numeric and what you are expecting.
PHP Code:
<?php
if(!isset($_GET['plan']) || !is_numeric($_GET['plan'])){ //checks that a plan was sent and is a number
die("Invalid plan number"); //stops processing the script and spits out a message
} else {
?>
<iframe src="http://external.url/order.php?plan=<?php echo $_GET['plan'];
?>"></iframe>
<?php
} // closes the else statement, anything you want to show after the iframe even if the plan number isn't correct should go after this bracket
?>
Or could I safely combine the two lines into the iframe src to get it working?
If the answer is yes to any of the above, which would be best? Sorry if I seem repetative but my PHP knowledge is non-existant at present (I am looking into learning it but my brain is finding it hard to understand, lol).
It would be better to keep them separate, because that would facilitate adding error handling, if required, at a future date.
Would this work or would I need more in the coding of the file to get this to work?
This should work, but is unnecessary. If you are not going to put $plan=$_GET{'plan'] separate (to allow error checking to be added later) you may as well put:
Oh, and a small point. You might consider adding an error message for the minority of devices that do not support Iframes. This is simple to do. Just put something like:
Code:
<iframe src="http://external.url/order.php?plan=<?php echo $plan;?>">Sorry, your browser does not support this facility. Please contact <whoever>... </iframe>
Bookmarks