JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 26th, 1999, 11:58 AM
Projecto EINet
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Could someone help me with this task.

I have this code to use in HTML pages to call a Picture Gallery

<!-- Start Galeria. -->
<p align=center>
<table border=0 cellpadding=0 cellspacing=0 width=210><tr><td>
<SCRIPT
LANGUAGE="JavaScript"
SRC="http://postais.comunidades.net/cgi-bin/galeria.cgi?dim=210&t=_top">
</SCRIPT>
</td></tr></table>
</p>
<!-- End Galeria. -->


And I've develop the following code to generate a table on page.


#!/usr/bin/perl -w

##########################################################################################
#
# The following code works. I've tested. See it till you found a separator like this one.
#
##########################################################################################

use CGI;
use Mysql;

# Required Library
#############################################
require "common.lib";

# Output Variable
#############################################
my $code = "";
my $nocomments = 1;

# Get PostCard Display Dim and Target
#############################################
my $query = new CGI;

# Postcard Display With or Height
my $dim = $query->param("DIM");
if ($dim eq "") { $dim = "210"; }

# Postcard Target to URL
my $targetURL = $query->param("t");
if ($targetURL eq "") { $targetURL = "_blank"; }

# Get Random PostCard
#############################################

# Now we connect to the database
&DBConnect();

# Make the SQL query string PID
my $command = "select images.graphic_id, images.graphic_title, images.graphic_name, author.copyright, images.graphic_format, author.url from images left join author using (author_id)";

# Send the SQL query to the database, catch possible errors
my $sth = $dbh->query($command);
&CGIError("<h2>Erro Mysql!</h2><br><br>$command<br><br>$!<br>") unless (defined $sth);

my $totalImages = $sth->numrows;

if ($totalImages > 0){

# Initiate Random Function
srand(time);

# random image ID
my $PID = int(rand($totalImages));

# Skip images to match image choosen
if ($totalImages > 1) { $sth->dataseek($PID); }

# OK, now we get the data
my @arr = ($sth->fetchrow);

# Separate the data by field
($gid, $graphic_title, $graphic_name, $graphic_author, $graphic_format, $author_url) = @arr;

if ($graphic_title eq ""){ $graphic_title = "Unknown"; }
if ($graphic_author eq ""){ $graphic_author = "Timeless"; }

# Show thumbnails
my $showImg = "width=$dim";
if ($graphic_format eq 1){ $showImg = "height=$dim"; }

##########################################################################################
#
# Now here is where I get troubled. It wont outputs nothing
#
##########################################################################################


# Format data
#############################################
print "Content-type: application/x-javascriptnn";

# Return everything nicely formatted
#############################################

print "document.write("<center><table>")n";
print "document.write("<tr><td valign=top>")n";
print "document.write("<a href="$URLPath$CGIPath/$ComposeCGI?GID=$gid" Target="$targetURL" Title="$PCName" Alt="$PCName" OnMouseOver="window.status='Visite o $PCName';return true;" OnMouseOut="window.status='';">")n";
print "document.write("<img src="$PostCardsPath/$graphic_name" alt="Clique e envie um postal a um amigo ou amiga..." $showImg align="center" border=0>")n";
print "document.write("</a>n</td></tr>")n";
print "document.write("<tr><td valign=top>")n";
print "document.write("<font face="Arial, sans-serif" color="#408080"><small>")n";
print "document.write("<small>$graphic_title</small><br>")n";

print "document.write("<small>© $graphic_author</small></small></font>")n";
print "document.write("</td></tr>")n";
print "document.write("</table></center>")n";
}


# And finally close it
#############################################
exit;


Thaks in advance or any help.


------------------
Projecto EINet

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Using "Content-type: application/x-javascript\n\n" from Perl


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway