PDA

View Full Version : text in pages on fly - how?


bazz
07-16-2003, 02:15 PM
Hi, I am taking a bold new step forward :cool: I know many of you are into php, but I have just started perl.

Perl is new to me such that I can only amend an existing script but not write from scratch.

I am building a directory type site, which involves about 300 pages of exactly the same format. (imagine a page for each of 300 hotels). The only differences in each page, are those specific to the accommodation such as text, logos, images, etc.

I have it done so far, that the images are placed correctly by the ID of the accommodation (as described in the pl file) but I need to know this.

The 'body text' (ie that which describes the accommodation), is presently in its own HTML page. I want this text to appear in the page created by perl (specific to the accommodation).

Should I
1. include a .txt file (containing the relevant text for each acommodation), in the ID for the accommodation or
2. should I insert an HTML file in the fly page, again called by ID.

If you suggest the latter, how do I do it. Should I use <iframe></iframe> or is there a crossbrowser way that is better?


Much appreciate any pointers.

Thanks

ACJavascript
07-16-2003, 05:18 PM
So this is how you have it setup right?


<theHotelImage> - ID ect...

<theHotelImage2> ID2 ect...


all the way down?

are each hotel has its own html page and your just looking to have a page listing all of them

bazz
07-16-2003, 11:22 PM
Here's the script which works partially. Well it works perfectly but doesnt display all the content I require.

You can see from the second clump of data, beginning Marlfield_dpt, that the page displays what is included here. Now the images display fine but if I need text to display, it seems that I have to hard code it within the second clump of data (see the postal address there?)

I need to include a text (or .doc or .htm file which will contain a load of text (roughly A4 quantity). Is there a way to do this without hard coding it in the script itself?

if you want to see how it displays presently click here (http://www.ireland-info.com/cgi-bin/accommodation.pl?dpt=marlfield_dpt)

#!/usr/local/bin/perl -w

use CGI qw(:standard :form);
use strict;


#### CONFIG #####

# Department INFO
my %dpt_info = (
# Department ID => HTML FILE | IMAGE FILE | DEPARTMENT NAME | DEPARTMENT EMAIL | IMAGE MAIN | THUMB 1 | THUMB 2 | THUMB 3 | DEPT ADDRESS | DEPT BODY | DEPT URL | HYPERLINK1 | HYPERLINK2 | HYPERLINK3 | ENQUIRIES | RESERVATIONS |



'marlfield_dpt' => join("\t",'http://www.ireland-info.com/wexford_countryhouses/marlfield/index.htm','http://www.ireland-info.com/wexford_countryhouses/marlfield/images/logo.gif','Marlfield House','info@marlfieldhouse.ie','http://www.ireland-info.com/wexford_countryhouses/marlfield/images/main.jpg','http://www.ireland-info.com/wexford_countryhouses/marlfield/images/th_1.jpg','http://www.ireland-info.com/wexford_countryhouses/marlfield/images/th_2.jpg','http://www.ireland-info.com/wexford_countryhouses/marlfield/images/th_3.jpg','3 ############ Avenue<br />town######<br />###### ####<br />Tel: 00 44 (0)## #### ####','http://www.ireland-info.com/wexford_countryhouses/marlfield/body.txt','http://www.marlfieldhouse.ie','http://www.ireland-info.com/wexford_countryhouses/marlfield/images/image_1.jpg','http://www.ireland-info.com/wexford_countryhouses/marlfield/images/image_2.jpg','http://www.ireland-info.com/wexford_countryhouses/marlfield/images/image_3.jpg','http://www.ireland-info.com/wexford_countryhouses/marlfield/images/imagelarge.jpg','http://www.ireland-info.com/cgi-bin/enquiries.pl?dpt=marlfield_dpt','http://www.ireland-info.com/cgi-bin/reservations.pl?dpt=marlfield_dpt'),


);


#### END CONFIG ####


my $query = new CGI;
my $script_url = $ENV{'SCRIPT_NAME'};
my $department = $query->param('dpt');
my $action = $query->param('action');
my ($dpt_html,$dpt_img,$dpt_name,$dpt_email,$dpt_imagemain,$dpt_thumb1,$dpt_thumb2,$dpt_thumb3,$dpt_add ress,$dpt_body,$dpt_url,$dpt_hyperlink1,$dpt_hyperlink2,$dpt_hyperlink3,$dpt_imagelarge,$dpt_enquiri es,$dpt_reservations) = split(/\t/,$dpt_info{$department});

print "Content-Type: text/html\n\n";

if($action eq 'result') { &result; }
else { &form; }

sub form {
print qq(
<HTML>
<HEAD>
<title>$dpt_name</title><link rel="stylesheet" href="http://www.ireland-info.com/style_flypage.css">



</head>

<body>
<p class="res_whitepage"></p>

<p class="imagetext">Please click on a thumbnail for a larger view.</p>

<!--START OF SITE LINKS-->
<p class="sitelinks">|<a class="sitelinks" href="$dpt_enquiries" onFocus="if(this.blur)this.blur()">Contact Us</a>|&nbsp;|<a class="sitelinks" href="$dpt_reservations" onFocus="if(this.blur)this.blur()">Reservation Enquiry</a>|&nbsp;|<a class="sitelinks" href="javascript:window.close()" onFocus="if(this.blur)this.blur()">Close Window</a>|&nbsp |<a class="sitelinks" href="http://www.ireland-info.com/" onFocus="if(this.blur)this.blur()">Home Page|</a></p>
<!--END OF SITE LINKS-->


<!--START OF LOGO-->
<CENTER>
<A href="$dpt_url" onFocus="if(this.blur)this.blur()"><IMG SRC="$dpt_img" BORDER="0"></A>
</CENTER>
<!--END OF LOGO-->

<!-- START OF ADDRESS DETAILS-->
<p class="contact">$dpt_address</p>
<!--END OF ADDRESS DETAILS-->

<!--START OF THUMBS-->

<A HREF="$dpt_hyperlink1" onFocus="if(this.blur)this.blur()"><IMG CLASS="th1" SRC="$dpt_thumb1" BORDER="0"></A>
<A HREF="$dpt_hyperlink2" onFocus="if(this.blur)this.blur()"><IMG CLASS="th2" SRC="$dpt_thumb2" BORDER="0"></A>
<A HREF="$dpt_hyperlink3" onFocus="if(this.blur)this.blur()"><IMG CLASS="th3" SRC="$dpt_thumb3" BORDER="0"></A>

<!--END OF THUMBS-->

<!--START OF MAIN IMAGE-->

<a href="$dpt_imagelarge" onFocus="if(this.blur)this.blur()"><IMG CLASS="main" SRC="$dpt_imagemain" BORDER="0"></a>

<!--END OF MAIN IMAGE-->

<!--START OF URL-->

<p class="emaillink">Website for: <A class="emaillink" href="$dpt_url">$dpt_name </a></p>

<!--END OF URL-->



</BODY>
</HTML>

);

bazz
07-17-2003, 11:55 AM
Sorry folks. I started this thread having forgotten that I asked it before putting the cgi together.

I think it would be better if this thread were closed and the initial thread continued .

It is located here: -

http://www.codingforums.com/showthread.php?s=&postid=117659#post117659

sorry :o :rolleyes: