Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-10-2012, 10:32 AM   PM User | #1
utnalove
Regular Coder

 
Join Date: Oct 2008
Location: Poland
Posts: 358
Thanks: 141
Thanked 2 Times in 2 Posts
utnalove is an unknown quantity at this point
How to make the text stay in 1 row only

Hello, I think this questions is more related to CSS/HTML than to PHP.

Please take a look here.

As you can see in the post, at the very top there is something like:
Code:
sie - 09 | Napisała: glamourina | 2 comments.	i
4
komentarze z Facebook'a
I would like to appear like this:
Code:
sie - 09 | Napisała: glamourina | 2 comments.	i 4 komentarze z Facebook'a
.

The code is the following:
PHP Code:
<div class="post_date">

<?php the_time('M'?> - <?php the_time('d'?> | <?php _e("Posted by: ","language")?> <?php the_author_posts_link(); ?> | <a href="<?php comments_link(); ?>"><?php comments_number('no comments','one comment','% comments'); ?>.</a>    i <a href="<?php comments_link(); ?>"><div class="fb-comments-count" data-href="<?php echo get_permalink($post->ID); ?>">0</div> komentarze z Facebook'a</a>                           

</div>
Please help me to make all this code in one line, I'm getting crazy, there are no <br> anywhere
utnalove is offline   Reply With Quote
Old 08-10-2012, 10:37 AM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
Code:
<a href="<?php comments_link(); ?>"><div class="fb-comments-count" data-href="<?php echo get_permalink($post->ID); ?>">0</div> komentarze z Facebook'a</a>
Change that <div> to <span>.

PS: Nesting a block level element like <div> inside an inline element like <a> is in fact invalid.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Users who have thanked abduraooft for this post:
utnalove (08-10-2012)
Old 08-10-2012, 10:40 AM   PM User | #3
utnalove
Regular Coder

 
Join Date: Oct 2008
Location: Poland
Posts: 358
Thanks: 141
Thanked 2 Times in 2 Posts
utnalove is an unknown quantity at this point
Thanks. The good thing is that it is now in one line.
The bad thing is that the facebook function is not working anymore and instead of 4 comments it's showing 0.

Btw. I found that code here.
I've also found this code that may help, but probably it does not.

Last edited by utnalove; 08-10-2012 at 10:58 AM..
utnalove is offline   Reply With Quote
Old 08-10-2012, 11:18 AM   PM User | #4
Arbitrator
Senior Coder

 
Arbitrator's Avatar
 
Join Date: Mar 2006
Location: Splendora, Texas, United States of America
Posts: 2,902
Thanks: 5
Thanked 188 Times in 185 Posts
Arbitrator is on a distinguished road
Quote:
Originally Posted by utnalove View Post
The bad thing is that the facebook function is not working anymore and instead of 4 comments it's showing 0.
The Facebook API probably requires that the element be a div element. You can use a div element and style it with display: inline to be rid of the line-breaking behavior:

Code:
.fb-comments-count { display: inline; }
abduraooft was correct in noting that your code was invalid. div elements are disallowed within a elements in XHTML 1.0 Transitional.

That restriction has since been removed in HTML5, however. You may want to consider switching to that from XHTML 1.0 Transitional. Your document has a number of other errors that can also be remedied with such a change, including use of the document.write method (which is disallowed in XHTML) and data-* attributes (used by the Facebook API).
__________________
Please for the love of god stop making IE. You current "browser"s cause me to cry every day. —Phil *
Arbitrator is offline   Reply With Quote
Users who have thanked Arbitrator for this post:
utnalove (08-10-2012)
Old 08-10-2012, 11:24 AM   PM User | #5
utnalove
Regular Coder

 
Join Date: Oct 2008
Location: Poland
Posts: 358
Thanks: 141
Thanked 2 Times in 2 Posts
utnalove is an unknown quantity at this point
Thank you so much! It is now working with the following code:

PHP Code:
<?php the_time('M'?> - <?php the_time('d'?> | 
<?php _e("Posted by: ","language")?> <?php the_author_posts_link(); ?> | 
<a href="<?php comments_link(); ?>"><?php comments_number('no comments','one comment','% comments'); ?>.</a>

i <a href="<?php comments_link(); ?>"><div class="fb-comments-count" style="display: inline" data-href="<?php echo get_permalink($post->ID); ?>">0</div> komentarze z Facebook'a</a>
So this code above is HTML5 valid, but XHTML invalid?
For me it is important for it to be HTML5 valid, because in few weeks I am going to have somebody to convert the full site to HTML5.
utnalove is offline   Reply With Quote
Old 08-10-2012, 11:56 AM   PM User | #6
Arbitrator
Senior Coder

 
Arbitrator's Avatar
 
Join Date: Mar 2006
Location: Splendora, Texas, United States of America
Posts: 2,902
Thanks: 5
Thanked 188 Times in 185 Posts
Arbitrator is on a distinguished road
Quote:
Originally Posted by utnalove View Post
So this code above is HTML5 valid, but XHTML invalid?
That's actually PHP, but, yes, the expected output would be valid HTML5 and invalid XHTML 1.0.

That data-href (data-*) attribute used by your Facebook code is derived from HTML5 and is the reason—other than the div issue—as to why that portion of the code is invalid XHTML 1.0.
__________________
Please for the love of god stop making IE. You current "browser"s cause me to cry every day. —Phil *
Arbitrator is offline   Reply With Quote
Users who have thanked Arbitrator for this post:
utnalove (08-10-2012)
Old 08-10-2012, 12:00 PM   PM User | #7
utnalove
Regular Coder

 
Join Date: Oct 2008
Location: Poland
Posts: 358
Thanks: 141
Thanked 2 Times in 2 Posts
utnalove is an unknown quantity at this point
Thank you for the explanation. I hope html5 and the w3c validation will also help in seo terms ^_^
utnalove is offline   Reply With Quote
Old 08-10-2012, 04:47 PM   PM User | #8
utnalove
Regular Coder

 
Join Date: Oct 2008
Location: Poland
Posts: 358
Thanks: 141
Thanked 2 Times in 2 Posts
utnalove is an unknown quantity at this point
Maybe you are interested in it or you know... I have asked a related question here ... now I would like to merge the two counts.
utnalove is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:02 PM.


Advertisement
Log in to turn off these ads.