dragon2309 Posted July 17, 2011 Share Posted July 17, 2011 Hi all, wasn't sure if this should be in PHP or in CSS, but as the page works fine without the PHP, i figured the issue must be there. Basically, i have a site designed, all running fine. I'm in the process of adding a basket system into it. The cart itself works fine aswell on its own. My pages are made up of a matrix of div layers, all styled and arranged using CSS, the design for the page is built by using the DIV layers and assigning them background images through CSS. Now, when i transpose the PHP elements of the basket system onto a template page of the site design, the design disappears.. The DIV's retain their positioning data and their size/layer positions, so the basket content is phyisically held and positioned correctly, but EVERYTHING involving an image (even the site background) is missing. I've tried a few things but i cant seem to get the images to return. I tried echoing the whole html page out as PHP, the result was exactly the same. The page renders fine if i take out all the PHP. Any ideas? The page concerned is www.thechocolatehut.co.uk/cart2 If you need to see the PHP then let me know and i'll post it up. Dave Quote Link to comment https://forums.phpfreaks.com/topic/242221-phpcss-issue-wont-load-divs-images-when-echoed-through-php/ Share on other sites More sharing options...
Cless Posted July 17, 2011 Share Posted July 17, 2011 If the problem lies with the PHP as you say, you should post the PHP. Otherwise, properly diagnosing the problem will be a tedious task. Quote Link to comment https://forums.phpfreaks.com/topic/242221-phpcss-issue-wont-load-divs-images-when-echoed-through-php/#findComment-1243901 Share on other sites More sharing options...
dragon2309 Posted July 17, 2011 Author Share Posted July 17, 2011 If the problem lies with the PHP as you say, you should post the PHP. Otherwise, properly diagnosing the problem will be a tedious task. Okay, PHP is below, just wondered if it might have been a known issue that was common or had been heard of and diagnosed before. Heres the PHP: <?php // MySQL class require_once('inc/mysql.class.php'); // database connection require_once('inc/global.inc.php'); // functions require_once('inc/functions.inc.php'); // start session session_start(); echo"<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'> <head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> <script type='text/javascript' src='iepngfix_tilebg.js'></script> <script type='text/javascript' src='js/prototype.js'></script> <script type='text/javascript' src='js/scriptaculous.js?load=effects,builder'></script> <script type='text/javascript' src='js/lightbox.js'></script> <link rel='shortcut icon' href='favicon.ico' /> <link rel='stylesheet' media='screen' type='text/css' href='style1.css' /> <title>The Chocolate Hut</title> </head>; <body> <div id='container'> <a href='index.htm'> <div id='header'> </div> </a> <div id='menucontainter'> <div id='menuleftpad'> </div> <div id='menuleftgrad'> </div> <a href='index.htm'> <div id='menuhome'> </div> </a><a href='products.htm'> <div id='menuyummy'> </div> </a><a href='find.htm'> <div id='menufind'> </div> </a><a href='contact.htm'> <div id='menuspeak'> </div> </a> <div id='menurightgrad'> </div> <div id='menurightpad'> </div> </div> <div id='contentleftpad'> </div> <div id='contentleftgrad'> </div> <div id='contentmain'> <p class='contentbodycentre'> <div id='shoppingcart'> <h1>Your Shopping Cart</h1>"; echo writeShoppingCart(); echo"</div> <div id='booklist'> <h1>The Chocolate Huts Stock</h1>"; $sql = 'SELECT * FROM chocstock ORDER BY id'; $result = $db->query($sql); $output[] = '<ul>'; while ($row = $result->fetch()) { $output[] = '<li>'.$row['title'].' :: £'.$row['price'].'<br /><a href="cart.php?action=add&id='.$row['id'].'">Add to cart</a></li>'; } $output[] = '</ul>'; echo join('',$output); echo"</div> </p> </div> <div id='contentrightgrad'> </div> <div id='contentrightpad'> </div> <div id='footerleftpad'> </div> <div id='footermain'> </div> <div id='footerrightpad'> </div> </div> <br /> <p class='footer'>Design and Style - Dave Byrne (C)2011</p> <br /> </body> </html>"; Quote Link to comment https://forums.phpfreaks.com/topic/242221-phpcss-issue-wont-load-divs-images-when-echoed-through-php/#findComment-1243905 Share on other sites More sharing options...
Cless Posted July 18, 2011 Share Posted July 18, 2011 Try pinning down the error by incrementally deleting parts of the PHP code. I don't see anything particularly wrong with it. Also, try putting ob_start() at the top of the PHP code. Quote Link to comment https://forums.phpfreaks.com/topic/242221-phpcss-issue-wont-load-divs-images-when-echoed-through-php/#findComment-1243981 Share on other sites More sharing options...
cssfreakie Posted July 18, 2011 Share Posted July 18, 2011 So to compress your question. The images on your page are not loading, what to do... this has nothing to do with php. the path to your image is incorrect. for example. this #contentmain { background-image: url("images/contentback.png"); background-repeat: repeat-y; float: left; height: 975px; width: 705px; } should be: #contentmain { background-image: url("../images/contentback.png"); /* see the ../ ? */ background-repeat: repeat-y; float: left; height: 975px; width: 705px; } You need to use the correct path from your stylesheet to the images folder. by using ../ you can go 1 level up -www | | +---images | +---------contentback.png | +---css | +-----------stylesheet | index.php Quote Link to comment https://forums.phpfreaks.com/topic/242221-phpcss-issue-wont-load-divs-images-when-echoed-through-php/#findComment-1244015 Share on other sites More sharing options...
dragon2309 Posted July 18, 2011 Author Share Posted July 18, 2011 So to compress your question. The images on your page are not loading, what to do... this has nothing to do with php. the path to your image is incorrect. for example. this #contentmain { background-image: url("images/contentback.png"); background-repeat: repeat-y; float: left; height: 975px; width: 705px; } should be: #contentmain { background-image: url("../images/contentback.png"); /* see the ../ ? */ background-repeat: repeat-y; float: left; height: 975px; width: 705px; } You need to use the correct path from your stylesheet to the images folder. by using ../ you can go 1 level up -www | | +---images | +---------contentback.png | +---css | +-----------stylesheet | index.php Hi, im honestly not that dumb in real life honest!! Lol. I swear i uploaded the complete images folder to that directory several times... Christ knows where i was actually putting it, its been a long few days. You are correct there is nothign wrong with my php at all, it all works sound. Pages are now being displayed correctly, many thanks for pointing out my epic fail there. Dave Quote Link to comment https://forums.phpfreaks.com/topic/242221-phpcss-issue-wont-load-divs-images-when-echoed-through-php/#findComment-1244277 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.