How do I resize pages to fit content with PHP?
I have a slight problem with the sizes of pages being to short to display all of the items I pull from the database. Basically, the guy who made the website before I took it over has pages set up with this command:
$page_height = "2000px";
This doesn't seem like a very good way to size the pages. I have pages that have content going further down the page than the content area. How do I fix this? Is there a better way to resize the pages or is there a way to make them size to fit just the content at hand? I don't know much about PHP and this function seems faulty... I just need an easier way to make the content fit the products.
This sounds like it *should* be more of a CSS issue than a PHP issue, either using a more fluid design that will allow the container to expand/contract as needed, or else setting "overflow: auto;" to the container so that a scroll-bar is displayed when needed to view all the content.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
I'd imagine the page_height variable in php is merely being outputted within a css style (inline more than likely) for an element.
Though, if your content is exceeding 2000 pixels, they you might want to consider doing some sort of pagination so that you can access all of the data from the tables on multiple smaller pages. Or if you have some page code already, try shortening the amount of data per page.
But, if you want to keep your current code and output all to the same page, then yes, there is a better way. You say that your content is overflowing past the 2,000 pixel mark, if so, just get rid of the 2000px, or set it to auto, and the height of the container will adjust itself to the amount of content within it.
Last edited by Jarrod1937; 02-02-2011 at 07:50 PM.
Well I went through the CSS and set the mainContent and wrapper to haight: auto so that worked with some of my problem. However, I still have a slight problem with getting the pages to fit. Mainly on this page:
I have the white background behind all of the product pictures now but I need to get the bottom bar to fit at the bottom. This page is a concern but I would like to get it so that all of my pages have enough room for the products and not too much room, because some of them have a lot of whitespace and it looks bad.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread