Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2010-02-16 17:48:59
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Can I get rid of the blank lines
Hello,
For my site i use this for my menu.
<ul id="topnav">
<li><a href="<txp:site_url />" class="home">Home</a></li>
<!-- niveau 1: alleen de categorieën die zelf geen parent hebben, en niet de child-categories, dus alleen 'zwangerschap', 'babytijd' enz.: -->
<txp:category_list parent="" children="0" break="li" exclude="voorpagina">
<!-- voor elk van deze parent categorieën de titel: -->
<a href="#" class="<txp:category />"><txp:category title="1" /></a>
<div class="sub">
<!-- en (niveau 2) de child-categorieën voor deze parent (jaar1, jaar2 enz.): -->
<txp:category_list parent='<txp:category />' exclude='<txp:category />' wraptag="" break="ul">
<!-- voor elk van deze child-categorieën de titel: -->
<li><h2><a href="#"><txp:category title="1" /></a></h2></li>
<!-- en (niveau 3) de maanden in deze child-categorie -->
<txp:article_custom sort="Posted asc" category='<txp:category />' break="" limit="999">
<txp:if_different>
<li><a href="/?c=<txp:category />&month=<txp:posted format="%Y-%m" />"><txp:posted format="%B %Y" /></a></li>
</txp:if_different>
</txp:article_custom>
</txp:category_list>
</div>
</txp:category_list>
</ul>
This works good except in the bron-code of the page I see this.
<li><h2><a href="#">zwanger</a></h2></li>
<!-- en (niveau 3) de maanden in deze child-categorie -->
<li><a href="/?c=zwanger&month=2005-02">februari 2005</a></li>
<li><a href="/?c=zwanger&month=2005-03">maart 2005</a></li>
Is there a way I get rid of the empty rules ?
Roelof
Offline
Re: Can I get rid of the blank lines
With Txp forms and container tags, the dilemma is whether to use enough whitespace in pages and forms to keep them readable, or whether to format so the HTML output won’t have excess line returns, tabs, etc. To get rid of the blank lines in your HTML you’ll have to delete line breaks in the page template, for example putting the entire if_different
block on one line.
Code is topiary
Offline
#3 2010-02-16 18:29:17
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: Can I get rid of the blank lines
Hello,
I changed the if_different block to this :
bc.. <txp:if_different><li><a href=”/?c=<txp:category />&month=<txp:posted format=”%Y-%m” />”><txp:posted format=”%B %Y” /></a></li></txp:if_different>
But no change.
If I understand you I have to make the whole pagetemplate in one rule ?
And thanks for the explanation
Roelof
Offline
Re: Can I get rid of the blank lines
Why bother? The visitor sees the page as rendered by the browser, not the HTML source. The extra empty lines or spacing doesn’t affect how the visitor sees it.
Offline
#5 2010-02-16 20:08:03
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: Can I get rid of the blank lines
Hello Ruud,
Youre right but i like to have clean code.
Roelof
Offline
Re: Can I get rid of the blank lines
roelof wrote:
I changed the if_different block to this :
…
But no change.
OK, it must be the line breaks just before and after the article_custom
tag.
BTW I agree with Ruud. A line break is only one character and doesn’t matter in the overall scheme of things.
Code is topiary
Offline
#7 2010-02-16 22:03:29
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,315
Re: Can I get rid of the blank lines
Roelof, have you tried jmd_trim?
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#8 2010-02-17 10:21:15
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: Can I get rid of the blank lines
Hello Uli,
No I haven’t tried this plugin so thanks for the tip.
Roelof
Offline
#9 2010-02-17 11:47:30
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,315
Re: Can I get rid of the blank lines
Sorry, Roelof, jmd_trim won’t help you at all, it will output your code on just one line.
But rah_replace will be of help. Note that you have to copy and paste what you want removed, even if this sets the apostrophes embracing such expressions onto different lines, which looks a little particular.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Offline
#11 2010-02-17 13:42:50
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: Can I get rid of the blank lines
Oke,
I will look into this plugin.
Roelof
Offline
Pages: 1