GamingDeluxe
12-24-2010, 02:41 AM
Was having a right nightmare today trying to include a php file that done alot of processing to display some simple text.
Alas I've just found an Article on vb.org HERE (https://vborg.vbsupport.ru/showthread.php?t=242454) however I think my way in some ways is easier. If a little nasty
Basically the idea is to create a PHP page/script that parses to a javascript document.write function. which will print what ever the hell you like on the page.
The structure is as follows.
hobbies.php
<?php
$name = "sam";
$hobby = "run";
?>
document.write('<?php "$name loves to $hobby";?>')
This would simply output onto a blank page
sam loves to run
now that its in js you can include it on any page any place by just adding
<script src="hobbies.php"></script>
it should print what you need correctly. Not sure how in-depth this will work but the basic idea is there if you find the alternative methods a little to hard to get to grips with!
I assume the way it works is that as long as ur server's mime type is setup to parse .php files with the php processor then even if the page your calling it from doesnt allow php directly it thinks its js so lets it go?
Enjoy!
Alas I've just found an Article on vb.org HERE (https://vborg.vbsupport.ru/showthread.php?t=242454) however I think my way in some ways is easier. If a little nasty
Basically the idea is to create a PHP page/script that parses to a javascript document.write function. which will print what ever the hell you like on the page.
The structure is as follows.
hobbies.php
<?php
$name = "sam";
$hobby = "run";
?>
document.write('<?php "$name loves to $hobby";?>')
This would simply output onto a blank page
sam loves to run
now that its in js you can include it on any page any place by just adding
<script src="hobbies.php"></script>
it should print what you need correctly. Not sure how in-depth this will work but the basic idea is there if you find the alternative methods a little to hard to get to grips with!
I assume the way it works is that as long as ur server's mime type is setup to parse .php files with the php processor then even if the page your calling it from doesnt allow php directly it thinks its js so lets it go?
Enjoy!