Results 1 to 6 of 6

Thread: Is it possible to determine column heights in dynamic pages?

  1. #1
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default Is it possible to determine column heights in dynamic pages?

    Does anyone know if this is possible? I have a dynamic site (loads from a database). One page has content in the left column and a narrow right column containing ads. The amount of content in the left column varies depending on which record is displaying.

    Is there a way to determine what the height of the left column will be right before the page is displayed so that it can be used to determine how many ads will fit in the right column? For example, if the left column is 900px in height, display 4 ads in the right column. If the left column is 1200px in height, display 5 ads in the right column.

    Thanks! e
    Last edited by kuau; 12-09-2008 at 01:04 AM. Reason: to clarify

  2. #2
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    I'm not sure if this is any help but you can take a look at this thread:

    http://www.dynamicdrive.com/forums/showthread.php?t=39499

  3. The Following User Says Thank You to Snookerman For This Useful Post:

    kuau (12-09-2008)

  4. #3
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    Dear snookerman: Thank you. That example is very similar in concept to what I am trying. I did go through the entire thread but couldn't find any examples of a real page to see what it looked like, so am not sure. I thought iframes were being deprecated (?). I was hoping for a simpler solution that would allow me to use code something like this:

    Code:
    if($leftcol_height > 600) {
      include('rightcol5ad.php')
    } else {
      include('rightcol4ad.php)
    }
    I suppose I could add a field to the database record to indicate how much content there is, but that would be a maintenance nightmare. I was hoping the column height could be calculated on the fly as the page is rendered. Perhaps this is not possible.
    Last edited by kuau; 12-09-2008 at 03:11 PM. Reason: sp

  5. #4
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    Yeah, of course, I agree that a php solution would be much better than inline frames, especially since we didn't get that to work in FF. If you still want to look at the working example I did have one in the thread, here is the post:
    http://www.dynamicdrive.com/forums/showpost.php?p=174129&postcount=14.

    Like I said though, I don't do much php (not as much as I would like to), but if I stumble upon anything I'll make sure to tell you.

  6. The Following User Says Thank You to Snookerman For This Useful Post:

    kuau (12-09-2008)

  7. #5
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    I downloaded the 3 files and checked it out. It's very cool what you did.

    I admit to being brain-dead when it comes to Javascript, so I have no clue how I would adapt it to solve my problem. Your script seems to use the size of the external files to determine the size of the main page. My main page needs to use the size of the main column to determine which right column to use, and that can vary depending on data in a database. The page doesn't really exist until someone clicks on the link. I'm starting to think that there is no way to do this, so I am just going to forget it for now.

    Thanks very much for sharing your solution. Maybe it'll suddenly dawn on me after I've had some sleep how to incorporate the logic. This happens sometimes.

    Mahalo, e

  8. #6
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    You're welcome, sorry I couldn't be of more assistance. Like I said, I don't use php enough (it's on my to-do list).

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •