PDA

View Full Version : quick perl question...


DJ_B
12-23-2000, 10:34 PM
Howdy gang! In this script that I am messing with it asks you to define some things that you would like to be displayed everytime a record is displayed (it is a DB script). So i did this and it looks like the following:

# <-- Start of short display formatting -- >

print qq|
<table width="98%" border="0" cellspacing="0" cellpadding="1">

<td width="30%"><font face="arial,helvetica" size="2"><a href="$long_url">$rec{'Name'**</font></td>
<td width="25%"><font face="arial,helvetica" size="2">$rec{'License'**</font></td>
<td width="25%"><font face="arial,helvetica" size="2">$rec{'Date Added'**</font></td>
<td width="20%"><font face="arial,helvetica" size="2">$rec{'Download Size'**</font></td>
</tr>
</table>
|;

All great and dandy! But....I want a simple HTML link to be displayed only ONCE at the top of all of my pages. If I put the HTML for the link iin the code above it will display fine, except one link will be shown for every record. So for example, if I have 100 records, 100 HTML links will be shown. But I only want ONE html link at the top of my pages!!

Is there some PERL code that will tell the program to print the HTML link ONCE and only ONCE?

Thanks, and if you are confused, tell me, and I will try to explain some more http://geekvillage.com/ubb/smile.gif

Thanks!

JDF000
12-24-2000, 09:34 AM
Use a loop!

for( i=0; i<1; i++ )
{

execute your code here;

**

HTH,
Justin

DJ_B
12-24-2000, 11:58 PM
hmm...da loop didn't seem to work. Maybe it is a FRUITY LOOP !!! http://geekvillage.com/ubb/smile.gif Anyways, here is how I modified the script with the loop.

# Below is where you define what you want to appear for each record in the "short" display.
# You can make this whatever you want, and display as many fields as you would like.
# Choose which of the fields you would like for users to click on to reach the full display
# of records and use that field name in place of "Title" below.
#
# Be sure that you use <a href="$long_url"> for the link to your full record display.

# <-- Start of short display formatting -- >

for
( i=0; i<1; i++ )
{

<p>&nbsp</p><b>$html_title: <font face="Arial, Helvetica, sans-serif" size="2">Search Results </font></b>;

**
print qq|

<table width="98%" border="0" cellspacing="0" cellpadding="1">

<td width="30%"><font face="arial,helvetica" size="2"><a href="$long_url">$rec{'Name'**</font></td>
<td width="25%"><font face="arial,helvetica" size="2">$rec{'License'**</font></td>
<td width="25%"><font face="arial,helvetica" size="2">$rec{'Date Added'**</font></td>
<td width="20%"><font face="arial,helvetica" size="2">$rec{'Download Size'**</font></td>
</tr>
</table>
|;

When i add the loop I get an "DBMan encountered an error" error. Am I doing something wrong? Any other suggestions?

Oh yeah, if you want to take a look at the entire script (well not the entire script, but the part I am trying to modify) go to www.appleprograms.com/html.txt (http://www.appleprograms.com/html.txt)

thanks!

Click Here!