How to insert geophrase code (javascript) in a php file?

Dynamically insert customized welcome messages onto your web page.

Moderators: Moderators, GeobytesAdmins

How to insert geophrase code (javascript) in a php file?

Postby Kas » Wed Jan 21, 2004 1:10 pm

To use GeoPhrase (http://www.geobytes.com/GeoPhrase.htm) on a PHP page - you could use something like:

<?php
print"<script language=\"Javascript\" src=\"http://map.geoup.com/geoup?template=welcome\">
</script>\n";
?>

To use GeoDirection's (http://www.geobytes.com/GeoDirection.htm) "Sample Content Localisation Script" on a PHP page - you could use something like:

<?php
print"<script language=\"Javascript\" src=\"http://gd.geobytes.com/gd?after=-1&variables=GeobytesCountry,GeobytesCity\">
</script>
<script language=\"Javascript\">document.write(\"<p>Welcome to visitors from \"+sGeobytesCity+\", \"+sGeobytesCountry); </script>\n"; ?>
Kas
Moderator
 
Posts: 37
Joined: Thu Nov 20, 2003 10:17 am

Postby RussWilde » Thu Apr 15, 2004 9:52 pm

I know this topic has been dead for a while, but for the sake of complete-ness this probably should be added:

While the above will produce a php page with the javascript in it, it would be simpler (And marginally faster to process) if you stepped out of PHP to include the script and then step back in to perform the rest of the logic associated with the page content.

So you could do:

<?php
//include some content from a database say...
include('database_connection.php');
$my_page_content_header = mysql_query("SELECT content from 'mainpagecontent' WHERE position = 'header'");
print $my_page_content_header;

//then step out of PHP to include the javascript
?>
<script language="Javascript" src="http://map.geoup.com/geoup?template=welcome">
</script>
<!-- Then Step back in to PHP for more content, logic etc -->
<?php
include('body.php');
include('footer.php');
?>

See what I mean? And then, for the lines between ?> and <?php PHP will not process the file, saving that many nano-seconds in rendering the page for the user :wink:
User avatar
RussWilde
 
Posts: 8
Joined: Sun Apr 11, 2004 8:42 pm
Location: halfway between the gutter and the stars

Postby Russell » Sat Apr 17, 2004 7:25 am

Thanks for the good idea, it is also easier for the not-so technically inclined to paste in (not having to change code) and is less error prone....
Russell
Image it's the end of spam...
http://m.geobytes.com/
<geoselect><geoif geodefault>Special Welcome to folks from <geobytes city>, <geobytes country>.</geoif></geoselect>
User avatar
Russell
Moderator
 
Posts: 368
Joined: Mon Dec 08, 2003 9:05 am
Location: Brisbane, Australia

Postby RussWilde » Sat Apr 17, 2004 11:18 am

glad to be of help.
Spelling and gramatical errors are for entertainment purposes only to enhance your reading pleasure otherwise it would be really REALLY boring, right?

http://www.RussWilde.com
User avatar
RussWilde
 
Posts: 8
Joined: Sun Apr 11, 2004 8:42 pm
Location: halfway between the gutter and the stars

Re: How to insert geophrase code (javascript) in a php file?

Postby zottona » Wed Oct 21, 2009 11:13 am

How to move div pane with javascript smoothly? I need to make a div pane move up or down in a smooth manner. I believe that this is possible with javascript. I tried looking on Google but could not find any good tutorials. Please help. Thanks.
zottona
 
Posts: 1
Joined: Thu Oct 15, 2009 4:56 am


Return to GeoPhrase

Who is online

Users browsing this forum: No registered users and 1 guest

cron