justlukeyou Posted July 5, 2012 Share Posted July 5, 2012 I've now my site set up but I have strange uneven echo of columns into DIVs which isn't coming out as other designs I have used. My Limit is 3 so I am only echoing 3 articles but they are coming out uneven. For some reason the "discussionarticlescontentborder" does not close (with the </DIV>) on the first echo but then on the second echo it does. But then on the third echo it doesn't close. So only the second article is laid out properly. What I dont understand is why it ignores, then followers, then ignores the DIV closure on "discussionarticlestitleborder". Does anyone have any ideas why it may ignore but then follow the DIV closure. I have similiar layouts all over the site but this one behaves differently. <div id="discussionsarticlescell"> <?php $query = mysql_query("SELECT * FROM articles ORDER BY ID DESC LIMIT 3"); while($row = mysql_fetch_array($query)) { ?> <div class="discussionarticlestitleborder"><a href="/articles/article/<?php echo $row['ID']; ?>" class='articleslink' rel="nofollow" ><?php echo $row['title']; ?></a></div> <div class="discussionarticlescontentborder"><?php echo substr($row['articleintro'], 0, 200); ?></div> <div class="discussionarticlesimageborder"><a href="/articles/article/<?php echo $row['ID']; ?>" rel="nofollow" ><img src="<?php echo $row['image'];?>" /></a></div> <?php } ?> </div> Quote Link to comment Share on other sites More sharing options...
PeoMachine Posted July 6, 2012 Share Posted July 6, 2012 Have you tryed to show the PHP Errors? The only problem i can see is in the database incoming data, your PHP looks fine. Quote Link to comment Share on other sites More sharing options...
justlukeyou Posted July 9, 2012 Author Share Posted July 9, 2012 Hi, I've worked out what it is. Its this part here... <?php echo substr($row['articleintro'], 0, 200); ?> For some reason this part messing up the echo outlay in the DIVs If I just echo it like this it works fine but I want limit it to 200 characters. <?php echo $row['articleintro']; ?> Any ideas please? Quote Link to comment Share on other sites More sharing options...
xyph Posted July 9, 2012 Share Posted July 9, 2012 What does $row['articleintro'] contain in it's entirety? Quote Link to comment Share on other sites More sharing options...
justlukeyou Posted July 9, 2012 Author Share Posted July 9, 2012 Its around 1000 characters which is limited by the MySQL set tup. I could use 'article' intro which unlimited. I am trying to constrain either of these just to echo only 200 character of either of these. When I use substr as above it messing up the CSS. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted July 9, 2012 Share Posted July 9, 2012 That wasn't the question. Quote Link to comment Share on other sites More sharing options...
justlukeyou Posted July 9, 2012 Author Share Posted July 9, 2012 I answered what I thought the question was. What was the question? Quote Link to comment Share on other sites More sharing options...
scootstah Posted July 9, 2012 Share Posted July 9, 2012 The question was, what content does $row['articleintro'] contain - not how much it can contain. My guess is that you are cutting off an HTML tag that is in the content. Quote Link to comment Share on other sites More sharing options...
justlukeyou Posted July 10, 2012 Author Share Posted July 10, 2012 Yes your right, I was cutting out the end paragraph. Cheers dude. Quote Link to comment 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.