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 trialFlo Tubes
5,110 PointsDisplays too many items
I the video it displays 4 items horizontally. On my screen displays way more items verticaly.
This is my catalog.php:
<?php
include("include/data.php");
$pageTitle = "Full Catalog";
$section = null;
if(isset($_GET["cat"])){
if($_GET["cat"]== "books"){
$pageTitle = "Books";
$section = "books";
}
else if($_GET["cat"]== "movies"){
$pageTitle = "Movies";
$section = "movies";
}
else if($_GET["cat"] == "music"){
$pageTitle= "Music";
$section = "music";
}
}
include("include/header.php");
?>
<div class="section catalog page">
<div class="wrapper">
<h1><?php echo $pageTitle;?></h1>
<ul class="itemS">
<?php foreach($catalog as $item){
echo
"<li><a href='#'>
<img
src='" .$item["img"]."'
alt='"
.$item["title"];"'/>"
. "<p>View Details</p>"
. "</a></li>";
}
?>
</ul>
</div>
</div>
<?php include("include/footer.php");?>
2 Answers
Seth Kroger
56,414 Points[edited OP for formatting -- to include a code block you should rap your code with 3 backticks (```) on the line before and after as shown in the Markdown cheatsheet.]
In this line you have a semi-colon in the middle of the output you are trying to build. This will end the echo statement and cut off anything after it. This includes the closure of the image tag and closing tags of the anchors and list items.
.$item["title"];"'/>"
Prince Henry
4,312 Pointsperhaps you should look into your <ul> class and try using <ul class="items">
Flo Tubes
5,110 PointsFlo Tubes
5,110 PointsIt displays them properly now but still too many but I think I can fix that somehow