Continuing from this thread: http://ellislab.com/forums/viewthread/207408/
I’m able to style the {category_name}, but it always parses with a bunch of spaces before the category name.
Any ideas?
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
December 30, 2011 9:23am
Subscribe [1]#1 / Dec 30, 2011 9:23am
Continuing from this thread: http://ellislab.com/forums/viewthread/207408/
I’m able to style the {category_name}, but it always parses with a bunch of spaces before the category name.
Any ideas?
#2 / Dec 30, 2011 11:08am
If excessive spaces are causing trouble, try removing them from your template:
{categories show_group="1"}{category_image}<a href="http://{path=MYDOMAIN.COM/{category_url_title}/{category_id}">{category_name}</a>{/categories}#3 / Dec 30, 2011 11:14am
I tried that, still no change. :(
#4 / Dec 30, 2011 11:36am
Please paste HTML it’s generating here and I’ll take another look.
#5 / Dec 30, 2011 11:38am
Code
TAGS:
{categories show_group="1"}
<a href="http://{site_global_url}news_/category/{category_url_title}/{category_id}">{category_name},</a>
{/categories}
(Tried removing all the breaks and spaces)
HTML it’s generating
TAGS:
<a href="http://MYDOMAIN.COM/index.php/news_/category/architectural/4">ARCHITECTURAL,</a>
<a href="http://MYDOMAIN.COM/index.php/news_/category/graphics/22">GRAPHICS,</a>
<a href="http://MYDOMAIN.COM/index.php/news_/category/institutional/12">INSTITUTIONAL,</a>
<a href="http://MYDOMAIN.COM/index.php/news_/category/special_features/16">SPECIAL FEATURES,</a>
#6 / Dec 30, 2011 11:50am
The breaks/spaces in your template will create the breaks and spaces in your HTML; if you don’t want them in the HTML, don’t put them in your template.
Paste this into your template, clear the EE cache, and post the resulting HTML.
TAGS: {categories show_group="1"}<a href="http://{site_global_url}news_/category/{category_url_title}/{category_id}">{category_name}, </a>{/categories}#7 / Dec 30, 2011 11:58am
HTML doesn’t work that way. If you have more than one space without the
tags or a new paragraph.
Regardless, here’s the generated HTML but the issue remains:
TAGS: <a href="http://MYDOMAIN.COM/index.php/news_/category/architectural/4">ARCHITECTURAL, </a><a href="http://MYDOMAIN.COM/index.php/news_/category/graphics/22">GRAPHICS, </a><a href="http://MYDOMAIN.COM/index.php/news_/category/institutional/12">INSTITUTIONAL, </a><a href="http://MYDOMAIN.COM/index.php/news_/category/special_features/16">SPECIAL FEATURES, </a>#8 / Dec 30, 2011 12:22pm
I’m able to style the {category_name}, but it always parses with a bunch of spaces before the category name.
Regardless, here’s the generated HTML but the issue remains:
TAGS: <a href="http://MYDOMAIN.COM/index.php/news_/category/architectural/4">ARCHITECTURAL, </a><a href="http://MYDOMAIN.COM/index.php/news_/category/graphics/22">GRAPHICS, </a><a href="http://MYDOMAIN.COM/index.php/news_/category/institutional/12">INSTITUTIONAL, </a><a href="http://MYDOMAIN.COM/index.php/news_/category/special_features/16">SPECIAL FEATURES, </a>
HTML doesn’t work that way. If you have more than one space without the
it is ignored, and breaks aren’t generated withouttags or a new paragraph.
For the reasons that you described, the HTML generated by EE looks perfectly fine.
I suspect the spaces you see aren’t actually spaces, but padding/margin/border from your CSS.
#9 / Dec 30, 2011 12:37pm
That’s a possibility as I am fixing someone else’s work right now. I will investigate the CSS further. Thank you for the help!
#10 / Jan 02, 2012 3:39am
Hi zavio,
It does indeed sound like it points to a CSS rule as Nick has troubleshooted for you. Let us know the results of your investigation