PHP is server side and JavaScript is client side; so you would need to do use AJAX to call a PHP script that returns the HTML desired and/or runs the code required. For an example, try Googling for "Introduction to AJAX".
Is it possible to save a Google Adword (adword referral to be specific) javascript code, save it as whatevername.js and upload it in the server so that if the url is clicked (whatevername.js) it would redirect to Google landing page of Adword? What is the code for that?
I'm not quite sure I understand what you're asking. You want to embed google adwords (did you mean Adsense?) into a page, and have users click on a URL that would count as a(n adsense?) click? Something like Kontera? If so, I don't know how that complies with the TOS. But in either case, you could just generate your Javascript with your PHP file and have it interact that way.
Hi Louis, do you have a sample code of javascript within PHP code? I would like to put Google Firefox referral in php.
Sorry for the late reply: <? $javascript = '<script>alert("Javascript in PHP!");</script>'; print $javascript; ?> PHP: That should do it for you! Cheers, Louis
I cannot use this code for Google adwords. I still need to learn more about PHP and Javascript. Any more input?
It looks like this thread discusses my issue. Can I insert Kontera code into PHP pages? If so how? The code is: <script type='text/javascript'> var dc_AdLinkColor = '#969600' ; var dc_UnitID = 14 ; var dc_PublisherID = 12345; var dc_adprod = 'ADL' ; </script> <script type='text/javascript' src='http://kona.kontera.com/javascript/lib/KonaLibInline.js'> </script> I'm a noob. Thanks.
Just put the code outside the <? and ?> tags of the php script. Or use something like echo " <script type='text/javascript'> var dc_AdLinkColor = '#969600' ; var dc_UnitID = 14 ; var dc_PublisherID = 12345; var dc_adprod = 'ADL' ; </script> <script type='text/javascript' src='http://kona.kontera.com/javascript/lib/KonaLibInline.js'> </script> "; PHP: printf(" <script type='text/javascript'> var dc_AdLinkColor = '#969600' ; var dc_UnitID = 14 ; var dc_PublisherID = 12345; var dc_adprod = 'ADL' ; </script> <script type='text/javascript' src='http://kona.kontera.com/javascript/lib/KonaLibInline.js'> </script> "); PHP:
Hello all before all, this is my first post here, and this post its eaxctly what i was looking for, ive got this function: function load_SpecialDays() { add_SpecialDay("01-Jun-2008", 'booked') add_SpecialDay("4/Jun/2008", 'booked') add_SpecialDay("5-Jun-2008", 'booked') } And this php code: <?php include 'config.php'; include 'opendb.php'; $query = "select arrival from confirmed where room_id = 1"; $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)) { list( $anio, $mes, $dia ) = explode( "-", $row['arrival'] ); echo "add_SpecialDay($dia-$mes-$anio, 'booked')<br>\n"; } ?> php code prints on screen this: add_SpecialDay(18-06-2008, 'booked') add_SpecialDay(03-07-2008, 'booked') add_SpecialDay(12-07-2008, 'booked') Could i assign this result to the function, i mean could i assign value for this result to include on load_SpecialDays()? Thanks in advance. R3g@rd$.