Gossamer Forum
Home : Products : DBMan : Customization :

Attn: JPD

Quote Reply
Attn: JPD
 
Hiya Carol,

I have a question for a change! On a html_record_long type site, is it easier to draw the content (like say a html description of the item) from the database or from a separate file?

For example, on the sites that I use this kind of system, I draw the content from a file name in much the same way I get an image, like $rec{'name'}.dat, and that works fine, but I'm wondering how it works if you have a $description field in the database. Wouldn't the html delivered back to the browser be outputted as one long string?

And another thing, while I'm at it, I've noticed that sometimes the '' aren't necessary when getting the value from a hash, i.e. $rec{'name'} works the same as $rec{name}. Is this to do with the version of Perl or wha?

Thanks,
adam
Quote Reply
Re: Attn: JPD In reply to
Hey Adam!

A lot depends on how long the descriptions are. You need to weigh the difference between the ease of having the text in the database and the potential of eventually slowing down search functions when the database gets too big. I'd keep the descriptions in the database if they are no more than 1 or 2K. More than that, I'd make separate files.

Also, you need to decide whether you want the field to be searchable. If you do, you'll need to have the text in the database.

Quote:
Wouldn't the html delivered back to the browser be outputted as one long string?

Yes, but you can fix that. You can put html formatting within the description field itself or, if you just want the lines to be broken up, use a carriage return in the text field when you enter the data. Then, in html_record, before you start your print qq| statement, add

$rec{'FieldName'} =~ s/\n/<BR>/g;

That will substitute an html line break everywhere you had used the carriage return.

Quote:
$rec{'name'} works the same as $rec{name}

Hmmmmm. I've never seen that, but then, I haven't tried it. All my books say to use the quotes.


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





Quote Reply
Re: Attn: JPD In reply to
Thanks Carol,

I think that maybe sticking with the files would be the best option so, at least it will keep query speeds up as you said. I've integrated FileMan with dbMan to some extent on the site, so I may just do a little more work on it and add upload popups for the images and html, it'd make things easier all round.

Or then again I may go the whole hog and have a go off a categorised version, working off Links. Yup, I think I will, it's about time I did something constructive. Smile

Again thanks,
adam

ps. jpdeni.com? That's new innit? You're putting us commoners to shame with your "proper" sites! I've got twelve of 'em and they all have "This site isn't active." like they SHOULD! Smile
Quote Reply
Re: Attn: JPD In reply to
Yep. jpdeni.com is new. Last week. What can I say? I'm vain!! Wink

I was trying to work with some of the FileMan code and I understand the uploading of the files. What I don't get is how to change the name of a file once it's uploaded. How do I do that?


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





Quote Reply
Re: Attn: JPD In reply to
Carol,

When you click on rename it pops a JavaScript prompt which asks you for the new filename. Then it redirects to the the script with the query string:

?action=rename&name=" + name + "&newname=" + newname +"&wd="

with the old name and new names filled in obviously. So ($action eq 'rename') sends it off to the subroutine rename_file which uses the Perl function rename() to, well rename the file...

But I guess if you were just looking to find out how perl does it... use rename(). Smile

You could use JavaScript to rename the file before it uploads too if you wanted. I'm not entirely sure how, but I saw it somewhere out there. Oh gods, that's gonna drive me nuts now!

[ROFL! I just realised where I saw it. In FileMan. You just rename the file in the second box. Duh!]

tata,
adam

[This message has been edited by dahamsta (edited April 28, 1999).]
Quote Reply
Re: Attn: JPD In reply to
Oh. Now I see. Thank you!! Smile Being completely unfamiliar with Java, I didn't understand the form. But I think I can figure it out now.

Thanks again, Adam!


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