Jump to content

Dynamic Height /no of rows


vikinggirl***

Recommended Posts

I am a real php newbie, I am having to learn as I go along - no time for tutorials or books!

[B]Background to my problem: [/B]
I am working on a Wordpress theme for my personal blog -[URL=http://www.vikingprincess.net]Jo's site[/URL].
The layout is a centre column and two sidebars.

I just decided I want a fourth sidebar at the very right, floating at the right of the rest of the content.

The reason for the fourth sidebar is to [I]display some images for decoration[/I] to the right of the content.
This is done at the moment, using a 1 column table, with one picture per row.

The images are set using the rand() function and an array.  They are of no relevance other than decoration, so I only want images to be displayed as long as there is content in the right sidebar which is next to it.

[B]Problem: [/B]
I would like the number or pictures display (img) or rows in the table to be dynamically set, depending on the height of the right sidebar.

i.e. something like this:
[CODE]
.outer_sidebar{height = $height_of rightsidebar}[/CODE]

[B]I'd like for enough rows / img to be produced until the height of the outer sidebar is equal to the length of the right sidebar! Some kind of "Loop until", I guess. [/B]

At the moment, the amount of rows in the table (and images to display) is static.

Please would you be able to point me in the right direction for how to go about achieving this? It's best done using php / javascript, right?
But how?

Best
Jo
Link to comment
https://forums.phpfreaks.com/topic/28508-dynamic-height-no-of-rows/
Share on other sites

The only way you can get the actual size of the right content column is using client side javascript.  In fact, the height of that column can be variable for the same exact content if the user uses a different default text size, or different font family, or even if the user has a different monitor resolution set.  The displayed size of pictures changes with a change in monitor resolution as well. 

Probably the best you can do is guessimate the number of pics you will need based on either the # of rows of content to be printed, or the sum of the number of characters of content in all the rows.  You can do that server side in .php.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.