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? Link to comment https://forums.phpfreaks.com/topic/38313-auto-determine-page-height/ 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. Link to comment https://forums.phpfreaks.com/topic/38313-auto-determine-page-height/#findComment-183613 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. Link to comment https://forums.phpfreaks.com/topic/38313-auto-determine-page-height/#findComment-183626 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(). Link to comment https://forums.phpfreaks.com/topic/38313-auto-determine-page-height/#findComment-183637 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 ?> Link to comment https://forums.phpfreaks.com/topic/38313-auto-determine-page-height/#findComment-183701 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.