Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Cheryl Jones
13,405 PointsWhy does my logo appear on localhost but when I upload it to the server it disappears?
I'm making 2 sites that are basically the same except for a few details. I've set it up with php so that they both have the same css and inc files. Both of these sites work fine in localhost, but when I uploaded them to a live server I have one site that looks fine, and the logo for the other site has disappeared. I've tried everything I can think of to troubleshoot this, and I'm really stumped. Here's the code:
css
.main-logo {
margin-top: 22px;
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
.fl {
background: url('../img/fl-logo.png') no-repeat;
z-index: 100;
width: 320px;
height: 39px;
}
.bp {
background: url('../img/bp-logo.png') no-repeat;
z-index: 100;
width: 351px;
height: 39px;
}
<?php
$logo_img = "fl";
?>
<a class="main-logo <?php echo $logo_img ?> pull-left" href="<?php echo $homesite ?>">LJ Hooker</a>
3 Answers
Micheal Allen
19,311 PointsThis may be your problem, your opening php tag isnt correct. heres what you have so far:
<php?
$logo_img = "fl";
?>
when it should be
<?php
$logo_img = "fl";
?>
Give this a crack and let me know how you go!
Mike.
Micheal Allen
19,311 PointsHaha no problem, try closing off your php echoes by adding semi-colons ;
// at the moment you have
<?php echo $logo_img ?>
// when it should be
<?php echo $logo_img ; ?>
Cheryl Jones
13,405 PointsI went ahead and changed all the php echoes (I missed quite a few!) but unfortunately it still hasn't changed. the site is real.social/market-report/forestlake.php, if that helps
Cheryl Jones
13,405 PointsI've used chrome developer tools to inspect the header. The class seems to be loaded properly and so is the css. So is it the actual file? I've opened the image in photoshop and re-saved as a png and it seems to look exactly the same as the other logo image.
Micheal Allen
19,311 PointsUsing chrome dev tools, try right clicking the link of the background image of in the styles panel for the .fl class and open in a new tab. If the image doesnt appear or shows an error, it may mean the file isn't within the directory your css is pointing to.
Micheal Allen
19,311 PointsI just realised that your project is related to the suburb I grew up in ( Forest Lake! woohoo! ). But yes looks like the file isn't within the directory your trying to get the image from. Upload the fl-logo.png to the same folder as the bp-logo.png and you should be good to go! :D
Cheryl Jones
13,405 Pointswow, isn't it a small world!? So I've looked at the image and it was there, but the permissions were set wrong. I've changed the permissions but it still isn't doing anything. I might just ask them for a new logo image and see if that does anything. Thanks very much for your help! I definitely feel like I'm on the right track now.
James Pask
13,600 PointsYour css is looking for the png here: https://real.social/market-report/img/fl-logo.png - I've tried that link myself and the file doesn't appear to be there.
Cheryl Jones
13,405 PointsCheryl Jones
13,405 Pointswhoops! I actually just copied that down wrong. It was right in my file