Log in

View Full Version : Need help with this part of a script - think it is HTML



fmv503
07-03-2005, 08:43 PM
Hi ALL -

This is at the end of Matt's simple search script. You can see the entire script if you want to go here. ( http://www.scriptarchive.com/search.html (http://) ). I need to get the part that I copied below centered on the page with a border around it. I have tried everything and nothing has worked. Below is the original, unedited, script. If you go to:

http://www.ados.com/~vanover/a2/index.htm (http://)

and search for (type in the search box on the lower right) pcmm you will see how the results page is to the left of the window with no border.

sub return_html {
print "Content-type: text/html\n\n";
print "<html>\n <head>\n <title>Search Results</title>\n </head>\n";
print "<body bgcolor=\"white\" link=\"black\" vlink=\"orange\">";
print "<table width=\"720\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
print "<tr><td><img src=\"/images/topgradient.jpg\"></td></tr>";
print "<tr><td><img src=\"/images/LogoHeader.jpg\"></td></tr>";
print "</table><font face=\"Verdana,Tahoma,Arial\">";
print "\n <center>\n <h1>Search Results</h1>\n </center>\n";
print "Below are the results of your Search:<p>\n";
print "<ul>\n";
foreach $key (keys %include) {
if ($include{$key} eq 'yes') {
print "<li><a href=\"$baseurl$key\">$titles{$key}</a>\n";
}
}
print "</ul>\n";
print "<a href=\"$title_url\">Back to $title</a>\n";
print "<table width=\"720\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
print "<tr><td><img border=\"0\" src=\"/images/bottomgradient.jpg\"></td></tr></table>";
print "</body>\n</html>\n";
}

If I can get it centered, it will make the whole site consistent. Any help would be greatly appreciated! Thank you.

jscheuer1
07-03-2005, 09:32 PM
Did you try:


sub return_html {
print "Content-type: text/html\n\n";
print "<html>\n <head>\n <title>Search Results</title>\n </head>\n";
print "<body bgcolor=\"white\" link=\"black\" vlink=\"orange\"><center>";
print "<table width=\"720\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
print "<tr><td><img src=\"/images/topgradient.jpg\"></td></tr>";
print "<tr><td><img src=\"/images/LogoHeader.jpg\"></td></tr>";
print "</table><font face=\"Verdana,Tahoma,Arial\">";
print "\n <center>\n <h1>Search Results</h1>\n </center>\n";
print "Below are the results of your Search:<p>\n";
print "<ul>\n";
foreach $key (keys %include) {
if ($include{$key} eq 'yes') {
print "<li><a href=\"$baseurl$key\">$titles{$key}</a>\n";
}
}
print "</ul>\n";
print "<a href=\"$title_url\">Back to $title</a>\n";
print "<table width=\"720\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
print "<tr><td><img border=\"0\" src=\"/images/bottomgradient.jpg\"></td></tr></table>";
print "</center></body>\n</html>\n";
}

fmv503
07-04-2005, 01:39 AM
Hi John -

Thank you for your reponse! I thought that work too, but alas it did not. I thought it would. After your post, I tried it again - still no luck. Any other suggestion(s)? :D

Thanks John!

jscheuer1
07-04-2005, 04:30 AM
I'd try putting the ul inside a centered table's cell:
sub return_html {
print "Content-type: text/html\n\n";
print "<html>\n <head>\n <title>Search Results</title>\n </head>\n";
print "<body bgcolor=\"white\" link=\"black\" vlink=\"orange\">";
print "<table width=\"720\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
print "<tr><td><img src=\"/images/topgradient.jpg\"></td></tr>";
print "<tr><td><img src=\"/images/LogoHeader.jpg\"></td></tr>";
print "</table><font face=\"Verdana,Tahoma,Arial\">";
print "\n <center>\n <h1>Search Results</h1>\n </center>\n";
print "Below are the results of your Search:<p>\n";
print "<table align=\"center\" width=\"50%\"><tr><td><ul>\n";
foreach $key (keys %include) {
if ($include{$key} eq 'yes') {
print "<li><a href=\"$baseurl$key\">$titles{$key}</a>\n";
}
}
print "</ul></td></tr></table>\n";
print "<a href=\"$title_url\">Back to $title</a>\n";
print "<table width=\"720\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
print "<tr><td><img border=\"0\" src=\"/images/bottomgradient.jpg\"></td></tr></table>";
print "</body>\n</html>\n";
}I mean, most of it is just HTML with double quotes escaped, so it should be possible to work it out one way or the other. The '%' in 50% may have to be escaped too, not sure. If so, it would be:
width=\"50\%\"

fmv503
07-04-2005, 04:47 AM
Hi John -

Thank you again! Just now tried that and it still didn't move. I am really stumped on this. Actually, I have been working on this for several days. lf you think of anything else, I would be so glad to give it a try.

IanMarlowe
07-05-2005, 05:07 AM
why not try css to format it so everything will be in the middle?

IanMarlowe
07-05-2005, 05:08 AM
what language is it any ways??? If it is html why not use the basi:

<p align="...">
</p>

...="left","center","right"

fmv503
07-05-2005, 06:34 PM
Hi -

And thanks for the responses! I have a new twist to this one. I am sure there is a "gremlin" somewhere. I deleted the cgi-bin folder and any other files in folders that had the name search.pl. Front Page <sigh> can sure be a stinker at times. I have a feeling this is one of them. Nonetheless, all files dealing with the search code have been deleted. Thought I would start from scratch. HOWEVER - after all that - I tried a search and it STILL WORKS as if the files were still there (even had someone try it on their computer with the same result). Talk about being stumped. Can anyone shed some light on this? ...please as I have no brain cells left! :confused:

Twey
07-05-2005, 06:41 PM
Now this is odd.
I've actually had this happen to me before - the webserver serve up a file that isn't there any more - but it shouldn't have happened on someone else's computer as well.
I think it might, as you suspect, be a FrontPage problem. FrontPage is never worth the bother. I am against the idea of WYSIWYG editors in the first place, but FrontPage (by report) seems to be by far the worst.

Does it work if you edit it in something else?

fmv503
07-05-2005, 06:56 PM
What a relief to know it has happened to someone else - thought I had lost it for sure. I would never use FP (especially from what I know now). This was a case of working with what was already there. The site is rather large so I have to work with it the way it is BUT (lol) guess I will see if in time the code disappears. I am not sure of anything I can do even with hand-coding, since the files are not there now. Have to think on this for a bit. hmmmmmmmm JUST what I needed!

Thanks for letting me know of your experience. How did you address the issue?

I forgot to say that I am/have been editing the code in Another Notepad (it is like Notepad - pretty basic).

Twey
07-05-2005, 07:18 PM
Doesn't matter, if you can edit plain text.
As a temporary measure, I saved the files under a different name, as it was a problem of not being able to overwrite the ones I wanted.
Eventually the server sorted itself out. I think it took about an hour.

jscheuer1
07-05-2005, 07:19 PM
FP is a powerful program and, for someone who really knows how to use it, not so bad. The problem lies in its power though. Depending upon how it is configured it may decide to do all sorts of things on its own. If you are not intimately familiar with its configuration options, it is like having a coworker on a project who never tells you what they've been doing.

fmv503
07-06-2005, 01:18 AM
Twey, I will give that a try. I will try saving under a new name and see if that works - tomorrow may bring better results.

John - you sure have FP nailed! It can/does insert code without your knowing. Validating has been challenging to put it mildly.

Many thanks for the responses, appreciate it - I will keep you posted!! :D