Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2009-08-28 18:57:33

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: List problem

TextBook should be your first port of call whenever you encounter something strange.

In this case, see this entry in the article_custom page I linked to above for the following:

break="tag text"
The (X)HTML tag (without brackets) or string to separate list items.
Default: br.

Change your code like so to turn off the <br />

<txp:article_custom section='<txp:section />' category='<txp:category />' wraptag="div" break="" class="intro" status="5">
         <txp:body />

Offline

#32 2009-08-28 19:06:12

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: List problem

decoderltd wrote:

I’ve adapted your code so it pulls in a piece of section specific ‘intro’ text (each section has a short introductory paragraph)-

I think you may want to remove the <h4><txp:category title="1" /></h4> from that code, because it leaves you with a pair of empty h4 tags.

it currently pulls my lists so long as there is a category assigned, is there a way to have the code continue to behave as it does, but also produce an article list even if there is no category assigned?

I’m not sure if I understand you correctly, but does it do what you want if you remove category=''<txp:category / >'' from the article_custom tag?

Finally, there seems to be a series of <br /> appearing which I can’t trace back to any code, not sure if there is any connection…

I think it’s the break attribute in category_list rather than in article_custom, Jonathan. So you’d have to change the opening tag to <txp:category_list break="">.

Offline

#33 2009-08-28 19:13:10

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: List problem

jstubbs wrote:

In this case, see this entry in the article_custom page

Jonathan, thanks for pointing this out, the default value for break in article_custom is not br, but empty. I corrected the Textbook entry.

Offline

#34 2009-08-28 19:25:32

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: List problem

Is the category_list entry correct Els?

break="value"
(X)HTML tag (without brackets) or string used to separate list items.
Default: br.

I thought Wet said that category_list wraptag is set to empty by default, so why is the break tag adding a br tag? Would make more sense to keep it empty too, no?

Offline

#35 2009-08-28 19:35:31

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: List problem

jstubbs wrote:

Is the category_list entry correct Els?

Yes, unfortunately it is.

I thought Wet said that category_list wraptag is set to empty by default, so why is the break tag adding a br tag? Would make more sense to keep it empty too, no?

I couldn’t agree more. I’d prefer an empty default value for break in all tags that use the attribute.

Offline

#36 2009-08-28 19:53:06

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,501
Website GitHub

Re: List problem

Els wrote:

I’d prefer an empty default value for break in all tags that use the attribute.

Confusingly, it is.

This ‘feature’ is a side-effect of the function doWrap() which a tonne of tags (and plugins) use to render their list output. As far as I can make out — would have to play with it some more — it tries to figure out if you’ve used a non-enclosing break (i.e. something other than a tag) and takes different action in each case. Perhaps it chooses wrongly sometimes.

I’ve noticed odd things with the break tag on occasion. Really must work out a definitive list of weirdness and try to find out why one day.

Last edited by Bloke (2009-08-28 19:54:16)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#37 2009-08-28 22:05:41

decoderltd
Member
From: London
Registered: 2006-06-20
Posts: 248
Website

Re: List problem

Thanks again Els, Jonathan + Bloke,

That’s working perfectly now, it never occurred to me about nulling the break attribute like that. I also assumed it was empty by default and would possibly make more sense if it was.

I’m off to take a look at the goodies in TXP 4.2.0 now – great to see a new upgrade.

Last edited by decoderltd (2009-08-28 22:24:53)

Offline

#38 2009-09-08 10:46:35

decoderltd
Member
From: London
Registered: 2006-06-20
Posts: 248
Website

Re: List problem

Sorry guys, one final question.

Following on from the list code you kindly helped me with, I’m trying to create the same technique for a link list. I thought I had this worked out but using the code below is creating repetition of the links. I think this may be from having two linklist tags but I can’t think of another way around it.

<txp:linklist break="">
 <txp:variable name="has_link" value='<txp:link_category />' />
      <txp:if_variable name="has_link" value="">
         <txp:else />
         <div class="module">
            <h4><txp:link_category title="1"/></h4>
            <txp:linklist category='<txp:link_category />' wraptag="ul" class="listing" break="li">
               <txp:permlink><txp:link /></txp:permlink><br />
               <txp:link_description />
            </txp:linklist>
         </div><!-- end module -->
      </txp:if_variable>
</txp:linklist>

Offline

#39 2009-09-08 11:15:23

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: List problem

Off the top of my head:

<txp:category_list type="link" break="">
	<txp:variable name="has_links" value='<txp:linklist category=''<txp:category />'' limit="1" />' />
	<txp:if_variable name="has_links" value="">
	<txp:else />
		<div class="module">
		<h4><txp:category title="1" /></h4>
		<txp:linklist category='<txp:category />' wraptag="ul" class="listing" break="li">
			<txp:link /><br />
			<txp:link_description />
		</txp:linklist>
		</div><!-- end module -->
	</txp:if_variable>
</txp:category_list>

If you ever need a similar code for files as well, see this tip on TXP Tips :)

Offline

#40 2009-09-08 11:55:03

decoderltd
Member
From: London
Registered: 2006-06-20
Posts: 248
Website

Re: List problem

Perfect! Thanks again Els, really appreciate your help.

Offline

Board footer

Powered by FluxBB