cheezylu Posted February 13, 2007 Share Posted February 13, 2007 This is probably a stupid question, but I'm curious to know if there is a way to automatically determine the height of each page? I asking because I have a site with a main body column and a side column and hate it when there is blank space vertical on one side of the other just because the content of one of the columns is larger than the other. I was hoping if there is a way to determine how tall the page is then I could create a PHP formula to include a certain number of content features along the side column based on the page height. Perhaps there's a different way to do this... any ideas? Quote Link to comment Share on other sites More sharing options...
trq Posted February 13, 2007 Share Posted February 13, 2007 I'm curious to know if there is a way to automatically determine the height of each page? No there is not, and even if there was it would have nothing to do with php. PHP doesn't know what a page is, it just outputs strings that most people happen to format as html. Quote Link to comment Share on other sites More sharing options...
cheezylu Posted February 13, 2007 Author Share Posted February 13, 2007 Is there way to count the number of characters in a string? Perhaps I could get the same result that way as the content in question are text articles. Quote Link to comment Share on other sites More sharing options...
trq Posted February 13, 2007 Share Posted February 13, 2007 Is there way to count the number of characters in a string? Of course. strlen(). Quote Link to comment Share on other sites More sharing options...
cheezylu Posted February 13, 2007 Author Share Posted February 13, 2007 Thanks! It seems to be working great! In case anyone is curious, this is what I have done... <?php $articleSize = strlen($article); // # of characters in the article $featureSize = 650; // approx. # of article characters that equal the height of the average featured item $featureEq = $articleSize/$featureSize; $featureQty = round($featureEq); //# of features to post $i=1; while( $i <= $featureQty ){ echo "\<?php include 'feature$i.php' ?\><br/>"; $i++; } //end of while ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.