Link to home
Start Free TrialLog in
Avatar of sulentho
sulentho

asked on

embed php in javascript

I have the following piece of code that I need to run on a server that does not support php so I have been advised to convert the entire code in javascript with document.write and have them as javascript functions. I am not sure how exactly it needs to be done as I am not very experienced in JS. Any kind of help will be sincerely appreciated. The code is as under




code.txt
ASKER CERTIFIED SOLUTION
Avatar of b0lsc0tt
b0lsc0tt
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
sulentho,

By the way ... please don't take the PS note personal and it isn't meant to be a general statement on the person giving the advise.  Maybe there was some miscommunication.  Otherwise they just don't know PHP and Javascript.  Just a heads up. :)

b0lsc0tt
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry, I didn't read your post completely it seems, b0lsc0tt... I have actually just repeated everything you said!!  Don't mind me, it's getting late...
Avatar of sulentho
sulentho

ASKER

Thank you very much for the advice guys, I will find out further if the server has any kind of scripting language like ASP on it to help. Thanks so much for the help and have a great day
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
sulentho,
Your welcome!  Let us know if we can help more with this or you have a question about what you learn from your new host.  If you have a lot of PHP scripts and your new host will just not support them or your old DB then you might really consider what Roonaan suggested.  There are lots of hosting providers that offer PHP.

purplepomegranite,
No worries!  Thanks for noticing and the apology.  Get some rest so you will be very helpful when Sulentho needs more help.  Yesterday was like that for me too.  ;)

bol
I need to echo the following lines of code in javscript which will in turn document.write the html . I am not sure about the string escape characters so will need your help on this. Any help on this will be appreciated. Thanks and have a great day


<a href="http://www.insidetoday.com/ban_click.php?id=<?=$hed_ban['banner_id']?>&url=<?=$hed_ban['link_url']?>" target="_blank"><? if($hed_ban['banner_image']){ ?><img src="http://www.insidetoday.com/bannerimages/<?=$hed_ban['banner_image']?>" alt="ad" width="468" height="60" border="0" /><? } ?></a>
 
this is what I have started with
header("Content-type: text/javascript");
echo "document.write('<a href="http://www.insidetoday.com/ban_click.php?id=<?=$hed_ban['banner_id']?>&url=<?=$hed_ban['link_url']?>" target="_blank"><? if($hed_ban['banner_image']){ ?><img src="http://www.insidetoday.com/bannerimages/<?=$hed_ban['banner_image']?>" alt="ad" width="468" height="60" border="0" />);";

Open in new window

Hate to say, but this is another question, which means you should start it as a new question and assign points accordingly.  As far as I can see, it isn't even related to the original question except for the fact it mentions JavaScript...
Thank you purplepomegranite will do so accordingly.
Feel free to post the URL of the new question in a comment here if you'd like our help on it too.  If you need anymore help or have a question about this question then let us know.

bol