Re: Calculating Cell Height
| From: | DL Neil | Date: | Wed, 17 Oct 2001 20:15:45 +0000 |
| Subject: | Re: Calculating Cell Height | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71392@lists.php.net to get a copy of this message | ||
> I need to figure out a rough number that will represent a (table)
> cell height, based on the amount of content that's in it. The site
> design is made in such a way that there are several table cells for
> several things. One of those cells, the largest one, will be filled
> with (dynamic) content, however the length of the data will affect how
> the design flows. A visual representation of what I'm faced with is
> this:
>
> +--------------+-------------------------+-+
> | graphic | graphic | | <-- fixed height pixel
> +--------------+-------------------------+-+
> | | | |
> | graphic | content | | <-- fixed height pixel
> | | cell | |
> +--------------+ |-+
> | | | |
> | graphic | | |
> |(top aligned) | | | <-- variable height pixel
> | | | |
> | | | |
> +--------------+-------------------------+-+
>
> As long as the "content cell" is a specific height (or less), the
> three graphics to the left are okay. However, as soon as the content
> height gets too large, those three graphics on the left start to show
> blank spaces between them as their cells also get stretched.
>
> To "fix" that problems, I created that third column you see, which
> has a 1 x <whatever height> pixel in it with the top two being fixed,
> and the bottom one being variable height. And right now, that variable
> height is being determined by me, visually. When I see a page getting
> too long, and it breaks the graphics, I increase the height of that
> pixel, so that it pushes the other two cells back up. This works
> great. My problem is, the dynamic content that will be changing every
> time.
>
> I want to switch to a template mode where I don't have to create a
> zillion different pages for everything, but rather have one template per
> section where the content gets pulled in. But, I need a way to figure
> out how to adjust that one "variable pixel" based on the content.
Ashley,
You're right, I hear the siren of the PHP Police approaching!
I think these are the pertinent HTML tag/arguments: <TD valign="top"
height="54" width="100">
If you can use PHP to ascertain the size of the two graphics, you could build your template to set
the vertical size of
each graphic-space as a variable, which could be calculated from the size of the about-to-be-loaded
graphic.
I recommend that you define the horizontal and vertical size of each graphic-space, leaving the
content-space to expand
or contract accordingly - it is not fixing sizes/leaving 'breathing space' that is causing
those embarrassing blank
spaces. To add a 'breathing space' add a fifth 'graphic-space' at the bottom of
the left-side column (so that the
content-space rowspans three graphics-spaces) and leave this to have no defined vertical size - that
way, if and when
content-space expands, despite the two 'major' graphics spaces being set to a fixed size,
the difference will be taken
up by the new/extra table cell (which will always 'contain' only blank space. NB
background color).
If you want to toss around other ideas, I'll 'trade' you for info about how you get
on with the templating tool ('soon'
on my 'ToDo' list), so feel free to email me directly/off-list (don't put [PHP] in
subject line).
Regards,
=dn