PDA

View Full Version : CSS & PHP dynamic pages



nicoleploehn
Sep 24th, 2010, 03:53 PM
So here's my problem:

this site www.iwantausedride.com is in uses tables, is in PHP, dynamically created, needs a little more pop, and can't be optimized.

I've been working on redeveloping the site using CSS.

Along the outside border of the main site (the white section) there is a left and right shade.

they appear fine on: http://kuhntest.designgoddessllc.com/index.php but they are hard coded to the height of the page.

When you begin pulling back the dynamic pages (search results) the page gets longer, and the shading stops, while the rest of the page keeps going.

I was told to create two wrappers one for left and one for right --- that didn't work.

I was told to create one background image with the spacing in the center of the two shades for the page content (i know the width of the page and so this was simple enough) -- still no luck.

abduraooft
Sep 24th, 2010, 04:27 PM
Since this is a fixed width layout, you don't need two wrappers. Instead, just make a horizontal strip(>930px width) having the shadow elements on its either side and then set it as the background of wrapper.

nicoleploehn
Sep 24th, 2010, 04:33 PM
tried that already :(

abduraooft
Sep 24th, 2010, 05:03 PM
tried that already :(
Can we have a link to your trial page?

nicoleploehn
Sep 24th, 2010, 05:13 PM
kuhntest.designgoddessllc.com/index.php (this is with it static). it works but doesn't work on the longer pages

kuhntest.designgoddessllc.com/index2.php this is with the wrapper bg image. (the image doesn't show up at all :(

abduraooft
Sep 24th, 2010, 05:24 PM
kuhntest.designgoddessllc.com/index2.php this is with the wrapper bg image. (the image doesn't show up at all Let's try in a step by step way. First of all, there are a lot of errors in your markup, out of which which some of them are critical. http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fkuhntest.designgoddessllc.com%2Findex2.php.

PS: How about making a very simple/basic page with some Lorem ipsum (http://www.lipsum.com/) to learn/familiarise the trick, and then progressively add the other components?

nicoleploehn
Sep 24th, 2010, 05:27 PM
this is what happens when you come in on a project and someone else has done everything and you're trying to put it in a better format but i'm sure as hell not coding out all the php stuff to a database that i don't even have control over or setup. :(

i'll go through the markup.

nicoleploehn
Sep 24th, 2010, 05:39 PM
Thats how it started and i got it working so i added the components, but then when i went on to the next page with the pre-owned.php page it doesn't have the shadow.

nicoleploehn
Sep 24th, 2010, 05:40 PM
ois my best bet to start over period -- including the php?

I have a copy of the database on the test server I am working with and can build the php around it. it appears as if most of the errors/invalid markups is from the php code.

jimhill
Sep 24th, 2010, 06:21 PM
Can you post a sample of the php code?

nicoleploehn
Sep 24th, 2010, 06:42 PM
i was actually able to clean up most of the code -- however, there is one error I now get -- i managed to clean up the rest of the php code...but it looks like this one is not going to be fixed...

its this section (which on the front end is the listing of manufacturers and the number of vehicles in that manufacturers set:

<?php

$translationArray = array(
"Mercedes-Benz" => "Mercedes",
"Volkswagen" => "VW" ,
);

$q = "SELECT make,COUNT(make) AS carCount FROM vehiclesinfo WHERE newUsed='Used' GROUP BY make ORDER BY make";
$r = mysql_query($q);

$Counter = 0;
while ( $row = mysql_fetch_array($r) ) {
//echo $Counter."<br/>";

$translatedMake = ( array_key_exists($row['make'],$translationArray) ) ? $translationArray[$row['make']] : $row['make'];

echo "
<td valign='top' width='33%'>
<a href='pre-owned.php?make=$row[make]&amp;task=pre-owned' class='quicksearch'>$translatedMake</a> ($row[carCount])
</td>
";
$Counter++;
if ( $Counter == 3) {
echo "</tr><tr>";
$Counter = 0;
}

}

?>

It's he echo "</tr><tr>"; that is causing an error ... since there are includes files those were causing errors and i have two more to add and check.

Thanks.

jimhill
Sep 24th, 2010, 07:17 PM
Technically that wouldn't cause an error depending on the code after it and before it, they are just doing a row change after 3 makes. Can you show the other code?
I saw some posts to make the bg stretch in a td as your page is trying to do, but tested it and it didn't work.

nicoleploehn
Sep 24th, 2010, 07:49 PM
<?PHP

$q = "
SELECT
vi.*,vic.*
FROM
vehiclesinfo
AS
vi
JOIN
vehiclesinfo_carmax
AS
vic
ON
vi.stockNumber=vic.stockNumber
WHERE
vi.newUsed='Used'
AND
vi.dealerID='8612'
AND
vi.images!=''
AND
vi.make!='Honda'
AND
vi.internetPrice > '0'
AND
vic.carmaxPrice > '0'
AND
vic.carmaxImage!=''
ORDER BY
RAND()
LIMIT
1
";
$r = mysql_query($q);

$row = mysql_fetch_array($r);

function formatMoney($string) {
$money = '$'.number_format($string,2);
return $money;
}

$price = formatMoney($row['internetPrice']);
$carmaxPrice = formatMoney($row['carmaxPrice']);
$totsavings= $row['carmaxPrice']-$row['internetPrice'];
$totsavings = formatMoney($totsavings);

echo "
<table width='570' cellpadding='0' cellspacing='0' border='0' class='tablebg'>
<tr>
<td height='15'></td>
</tr>
<tr>
<td colspan='2' align='center'><img src='/images/guaranteed.png' alt='guaranteed' style='curser:point;' width='550px' height='58px' onclick='javascript:window.open(\"display-guaranteed.html\",\"\",\"scrollbars=0,maximise=1,resizeable=1,status=0,toolbar=0,menubar=0,height=410,width=501,left=250,top= 100\");' /></td>
</tr>
<tr>
<td width='290' valign='top' align='center' style='padding: 15px 0px'>
<a href='viewDetails.php?id=$row[vin]'><img src='views/size1/$row[images]_1.jpg' border='0' alt='used car comparison' /></a>
</td>
<td valign='top' align='center' style='padding: 15px 0px'>
<img src='views/carmax/size1/$row[carmaxImage]' border='0' alt='used car comparison' width='280' height='185' />
</td>
</tr>

<tr>
<td colspan='2' align='center'>
<table width='100%' cellpadding='0' cellspacing='0' border='0'>
<tr>
<td valign='top' align='center'>
<p class='carbelowtext'>$row[year] $row[make] $row[model]</p>
<p class='carbelowtext2'><strong>Kuhn Outlet Price:</strong></p>
<p class='carbelowtext4' style='padding-bottom:6px;'>$price</p>
<span class='stock' >Stock#:$row[stockNumber] Updated ". date("Y/m/d",strtotime("yesterday")) ."
</span>
<p class='carbelowtext3'><a href='viewDetails.php?id=$row[vin]' class='clickhere'>View Details </a></p>
<br />
</td>
<td align='center' valign='top'>
<div class='carbelowtext3' style='font-size:18px; padding-top:25px'>Total Savings <br /> $totsavings</div>
</td>
<td valign='top' align='center'>
<p class='carbelowtext'>$row[year] $row[make] $row[model]</p>
<p class='carbelowtext2' style='padding-bottom:6px;'><strong>Compare to AutoTrader:</strong><br />
<span style='padding-bottom:6px;'>$carmaxPrice</span></p>
<span class='stock'>AT Car ID# : $row[carmaxVin] Updated ";
if($row['date_updated']=="")
echo date("Y/m/d");
else
echo $row['date_updated'] ;
echo "<br />
Source : www.autotrader.com</span>
</td>
</tr>
</table>
</td>
</tr>
</table>

";

?>

this is the other section of php that is not from an includes file.

I am not sure if this is why there is such a difficult time with the background image ---

nicoleploehn
Sep 24th, 2010, 09:22 PM
I have managed to get the code cleaned up and have created a new page. I have hidden the header file just for the time being.

I wanted to see if the image was "hidden" behind that image. It is not.

The wrapper background is the correct image fit perfectly around the header but yet IT DOES NOT show up!?!?!?!

nicoleploehn
Sep 24th, 2010, 09:58 PM
so now i have the imge showing up but only when i specify the height which doesn't help me when i need to have it fit the specific page which will vary and is determined dynamically.

nicoleploehn
Sep 24th, 2010, 10:58 PM
http://kuhntest.designgoddessllc.com/pre-owned.php

here is what happens when the page height changes --- because i have to set the height to a static amount i get extra length from the shadow ...

I have spent all day on this one aspect --- luckily once this is fixed the rest if a breeze! (I hope!)

jimhill
Sep 24th, 2010, 11:24 PM
Yeah I feel your pain and frustration. Beating my head against the wall for an answer. lol I'm sure I will run into it down the road.

abduraooft
Sep 25th, 2010, 09:49 AM
You don't need to set float on any of the elements header,results, specials, copyright. A float is required when you need to align more than one block level elements adjacently.

Now, if you are okay with what you've achieved (and don't have the patience to fix the rest ;)), then remove the height from the wrapper and apply overflow:auto; to it, which will clear the floats and automatically stretch the wrapper according to the height of inner elements . Read http://www.quirksmode.org/css/clearing.html

nicoleploehn
Sep 25th, 2010, 07:04 PM
So far so good -- i am making my way into additional pages. It appears as if for the most part when coded correctly (on additional pages) thanks for the help.

I do have another issue:

It's the details page for example when the list of available cars populates and you click on it - there is a detailed view available.

The old page is here: http://www.iwantausedride.com/viewDetails.php?id=3VWSK69M93M147685

The new page will go here: http://kuhntest.designgoddessllc.com/viewDetails.php?id=3VWSK69M93M147685

The base page looks fine, it's when i link to the includes file: details.php that gives me issues.

I do not have that includes file linked right now as i am trying to find the issue...in the meantime. if you look at the old page i'd like to take the payment calculator and put it on a separate page with just a link from the details page.

there is the javascripting coding that needs to be removed but i think some of it is relative to the other part of the page. can anybody see this or do i need to post the javascripting code?

Thanks.