5 Replies - 1515 Views - Last Post: 19 August 2007 - 03:37 PM
#1
Can I and if so how do I put this javascript in Wordpress page of php?
Posted 29 July 2007 - 11:51 PM
The function of the javascript is as follows. It identifies words in the text that correspond to items that Amazon sells. When the reader hovers over the text, the link to the product shows itself in a little box.
I see that wordpress pages are written in php and I have no idea whether it is possible to insert this javascript and make it work, or, if it is possible, which pages to insert the script into.
I am a beginner-beginner.
<script type="text/javascript"><!--
amzn_cl_tag="exampleID";
//--></script>
<script type="text/javascript" src="http://cls.assoc-amazon.co.uk/gb/s/cls.js"></script>
thanks
Replies To: Can I and if so how do I put this javascript in Wordpress page of php?
#2
Re: Can I and if so how do I put this javascript in Wordpress page of php?
Posted 01 August 2007 - 11:30 AM
#3
Re: Can I and if so how do I put this javascript in Wordpress page of php?
Posted 03 August 2007 - 08:16 AM
The function of the javascript is to somehow identify words used in the text as relevant to products that amazon sell.
If you look the Blogger blog at http://digitaladvice.blogspot.com/ you will see that on the fourth line of the first paragraph, the word 'SLR' is in blue. If you hover your curser over the word, a little amazon box opens.
I put that script into the blog html. It was easy because the page was written in html.
I also have blogs hosted on commercial servers and these blogs are built using wordpress. Wordpress is written in php, and I want to inset the javascript into the relevant pages so that the javascript does the same thing that it does in the Blogger blog.
If it will work with 'echo', how do I do it?
#4
Re: Can I and if so how do I put this javascript in Wordpress page of php?
Posted 05 August 2007 - 01:16 AM
photographworks, on 3 Aug, 2007 - 08:16 AM, said:
Adding Javascript in a PHP page using echo is done like this
<?
echo "<script language=\"Javascript\">\n";
echo "alert("You just used echo to add Javascript");\n";
echo "</script>";
?>
inside the <script> tags, you would, of course, have your Javascript code not my simple alert message
Hope this helps
Happy Coding!
This post has been edited by PsychoCoder: 05 August 2007 - 01:17 AM
#5
Re: Can I and if so how do I put this javascript in Wordpress page of php?
Posted 19 August 2007 - 12:44 PM
PsychoCoder, on 5 Aug, 2007 - 01:16 AM, said:
photographworks, on 3 Aug, 2007 - 08:16 AM, said:
Adding Javascript in a PHP page using echo is done like this
<?
echo "<script language=\"Javascript\">\n";
echo "alert("You just used echo to add Javascript");\n";
echo "</script>";
?>
inside the <script> tags, you would, of course, have your Javascript code not my simple alert message
Hope this helps
Happy Coding!
Dear PC
Thanks, it helps but doesn't quite get me there. Could you show me by copying the stuff I put in my original post, into the code you used, so I can see exactly where it goes?
thanks
David
#6
Re: Can I and if so how do I put this javascript in Wordpress page of php?
Posted 19 August 2007 - 03:37 PM
photographworks, on 19 Aug, 2007 - 12:44 PM, said:
PsychoCoder, on 5 Aug, 2007 - 01:16 AM, said:
photographworks, on 3 Aug, 2007 - 08:16 AM, said:
Adding Javascript in a PHP page using echo is done like this
<?
echo "<script language=\"Javascript\">\n";
echo "alert("You just used echo to add Javascript");\n";
echo "</script>";
?>
inside the <script> tags, you would, of course, have your Javascript code not my simple alert message
Hope this helps
Happy Coding!
Dear PC
Thanks, it helps but doesn't quite get me there. Could you show me by copying the stuff I put in my original post, into the code you used, so I can see exactly where it goes?
thanks
David
<?php echo ' <script type="text/javascript"><!-- amzn_cl_tag="exampleID"; //--></script> <script type="text/javascript" src="http://cls.assoc-amazon.co.uk/gb/s/cls.js"></script> '; ?>
This will do it
This post has been edited by formalsleek: 19 August 2007 - 03:37 PM
|
|

New Topic/Question
Reply



MultiQuote




|