Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Database Output

Status
Not open for further replies.

Jables

Programmer
Aug 28, 2001
148
US
I want to build a web interface using ASP so that daily columnists on my site can type their stories in a web-based form and submit them to a database. I already know how to solve this part of the development process.

I'm confused on formatting the stories when they appear. I would like them to be formatted into a dynamic table. That is, the table would be like 4 columns across and one row tall. When the first column of the table gets filled up, the story would continue in the next column, and so on.

Anyone have an efficient solution to this?

 
Jables,

Are you storing the entire story into a memo field on the DB or something like that ??

ToddWW
 
No, I just needed to know that to start brainstorming..

ToddWW
 
It doesn't have to be in one memo field in the DB. I toyed around with the idea of making a paragraph table in the DB and storing the stories by paragraph and then linking all the paragraphs to their related headline.

This method became pretty cumbersome really fast. Just couldn't think of an effective and easy way to implement it on the user end.

AT this point I just want to concentrate on the table formatting. Will concentrate on preserving carriage returns and other text formatting at a later time.

Clay
 
Well, the challenge here is that you need the table to be fixed horizontally but it needs to dynamically expand vertically based on the length of the story. Also, the story needs to be broken up into column(s) before ASP starts writing to the table.

With that, a set of rules needs to be setup so ASP can break the data up before writing it to the table.

Here's my thinking.

IF character length is < x THEN
entire story is stored in variable 1
and written into column 1
ELSEIF character length is > x AND < x*2 THEN
story is seperated into two variables
and written into column 1 and 2
ELSEIF character length is > x*2 AND < x*3 THEN
story is seperated into three variables
and written into columns 1, 2 and 3
ESLEIF character length is > x*3 THEN
story is seperated into four variables
and written into all four columns.
END IF

Now, setting x will depend on the typeface you intend to use, and how deep you want the table to expand before it breaks into the next column. The last condition where the character length is greater than z you would simply divide the story into four blocks and the table would expand as necessary.

Now I'm thinking that the final product won't flow perfectly like you might expect at first. I mean the bottom of the columns probably won't line up exactly because of carriage returns, etc.. But with some fancy string parsing, you could get it pretty close.

Are we on the same page ??

ToddWW
 
Well, we're on the same page, but I think that the scope of this thing is a little over my head in terms of my knowledge and experience with ASP. I thought maybe someone would have a quick solution that I just wasn't aware of due to my lack of experience.

Thanks a lot for your thoughts.
 
Hi Jables,

Sounds like you're taking a classical print industry approach to Web publishing (which isn't bad...and is something we in the biz could use more of). I know exactly what you mean...I manage a news site, but all of my content just reads vertically.

ToddWW was right on...if you want to achieve the &quot;conditional columnar&quot; effect wherein the content will bleed into the next column over if the previous gets filled, and using a DB field of type Memo, you'll need to do some scripting.

Other than than, for a low-budget-but-still-functional solution (my specialty), I'd recommend testing the maximum capacity of each column in your page with static content (just type in some nonsense and get the max # of characters), and then create a Web form with 4 seperate text fields or TEXTAREA fields to which your columnists will have to put a column's worth of content each, and just indicate that they would have to limit each field to [n] characters. This would still do the trick, albeit cheaply.

However if you do it like this, you'll increase the size of your database by a factor of 4...having 4 large Memo fields.

That's all I could think of.

Jas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top