Gossamer Forum
Home : Products : DBMan : Installation :

Desperate to get html.pl output right

Quote Reply
Desperate to get html.pl output right
Hi all,

I've been tearing my hair out trying to get this to work. Everytime i get near the tables end up all over the place.

Let me explain.

I have a standard header which is the same throughout the site and this is placed in my &html_print_headers; section.

I then want to be able to display a table of links the left of the page and the information searched in the middle of the page.

Please tell me how to set out my tables in the rest of the html.pl file.

Thanks MDJ

P.S. Eliot the Amazon gift voucher is on its way!
Quote Reply
Re: Desperate to get html.pl output right In reply to
mdj1,

This is a totally design issue. If you can provide the specs for what you want to appear, I can assist with writing the HTML codes. If I understand you correctly, you want to have a table that has two columns. One column with a menu and another column with the search results, right?

Also, you might be having problems with the header codes, which could be adversely affecting the table. If I may provide a suggestion? Try to use an inserted .txt or .htm file for the header file.

You can do this by adding the following codes to the bottom of your db.cgi file:

Code:
sub header_file {
#---------------------------------------------
# This prints out header file that is inserted into web pages.

open (INC, "/path/to/header.txt") or return "Can't find include file: $patterns{'Other'}";
return join ("", <INC> );
}

Change the /path/to/ to your header.txt file. The header.txt file should include the HTML codes for the header portion of your site minus the following codes:

Code:
<html>
<head>
<title></title>
</head>
<body>

These codes are already in your view_success routine.

Then in your sub html_header routine, use the following codes:

Code:
sub html_top_header {
# --------------------------------------------------------
# Print the top header.

print qq|

|;print &header_file; print qq|

|;

}

Then in your sub view_success, place the following codes below the <body> tag:

Code:
|; &html_top_header; print qq|

You could also repeat these above steps in creating a "menu sub-routine" for the links in the left column of your table. Make sure that you rename the sub-routines to something specific relating to "menus".

Example:

sub menu_file (in db.cgi)
sub html_menu (in html.pl)

An example table for your sub view_sucess routine could look like the following:

Code:
<table border="0" cellpadding="2" cellspacing="0" width="90%">
<tr>
<td width="30%">|; print html_menu; print qq|</td>
<td width="70%">
HTML codes
|;
<P>
<$font>
Your search for <$font_subtitle><b>$search_terms</b></font><br>
returned <b>$db_total_hits</b> match(es) out of a total of <b>|; &num_records;
print qq|</b> Records.
<p>
|;
if ($db_next_hits) {
print "<p><center><$font><b>Result Pages:</b> $db_next_hits</font></center></p>";
}
print qq|
</font></center></p>
|;

# Go through each hit and convert the array to hash and send to
# html_record for printing.

if ( $db_total_hits == 1 ) {
%rec = &array_to_hash(0, @hits);
&html_record_long(%rec);
print "<P><CENTER><$font><b><a href=\"$ENV{'HTTP_REFERER'}\"><img src=\"http://www.coco.cc.az.us/images/navigation/smredarrow.gif\" border=\"0\"> Previous Page</a></b></font>";
}

else {
&html_record_row(&array_to_hash($_, @hits));
for (0 .. $numhits - 1) {
&html_record(&array_to_hash($_, @hits));
}
print "</TABLE></DIV></CENTER>";
}

if ($db_next_hits) {
print "<p><center><$font><b>Result Pages:</b> $db_next_hits</font></center>";
}
&html_footer;
</td></tr>
</table>

Of course, you can change the width percentages to something that fits your site. You can also change the alignment of the table by adding in the following codes:

Code:
<div align="center"><center>
</div></center>

I tend to use percentages rather than pixils, because percentages show up more universally with different screen size resolutions (e.g., 640x480, 800x600, 1024x800, etc.). Using pixils creats too much white space.

Hope this helps.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited September 27, 1999).]
Quote Reply
Re: Desperate to get html.pl output right In reply to
I would suggest that you not use sub html_print_headers to print out any html code that will appear on a page.

My suggestion is to take a look at the "User-friendly html.pl" file at http://www.jpdeni.com/dbman/Mods/html_pl.txt . It will allow you to create a header and footer for each page by just altering a couple of subroutines.

As for setting up your tables, there are a couple of things you can do.

I have a tutorial on building forms and displays at http://www.jpdeni.com/dbman/tutorial6.html . If you follow the tutorial, you should be able to get a good start on your forms and displays.

Another option is to go to the "Configurator" at http://www.jpdeni.com/...figurator/config.cgi . Using this script, you enter your field information and other configuration and the script generates both the .cfg file (which you probably won't need) and the subroutines sub html_record_form and sub html_record. It's just a matter of copying and pasting the code. From there, you can adjust things for aesthetics, but the basic structure will be there.


------------------
JPD





Quote Reply
Re: Desperate to get html.pl output right In reply to
Thanks you 2 I'll give it a try.

MDJ
Quote Reply
Re: Desperate to get html.pl output right In reply to
Im Lost I keep getting errors.

I ve places a copy of html.pl file at
http://www.thehairshop.co.uk/htmlpl.txt

Thanks Mark
Quote Reply
Re: Desperate to get html.pl output right In reply to
The syntax on the file is okay. What sort of errors are you getting?


------------------
JPD





Quote Reply
Re: Desperate to get html.pl output right In reply to
Sorry, I wasn't clear.

This is the original file, when i inserted the code it wnt wrong. I thought it would be easier to tell me what i should delete and where to replace stuff by showing you this

PS im redaing your tutorial know..

MDJ