Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-02-14 08:54:15

Bongo-man
Member
Registered: 2009-03-18
Posts: 243

Label customization in <txp_article_custom />

Firt of all: I’ve seen <txp:article_custom /> does not have the label’ attribute, but I’ve got the same, in my blog.

Then I need to customizate this label: What I need to do is to skip the label display when are no article listed.
How can I get this?
Thanks

Offline

#2 2010-02-14 09:30:55

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Label customization in <txp_article_custom />

Bongo-man wrote:

Firt of all: I’ve seen <txp:article_custom /> does not have the label’ attribute, but I’ve got the same, in my blog. Then I need to customizate this label:

?

no article listed.

Basics:

<txp:variable name="is_article" value='<txp:article />' />
<txp:if_variable name="is_article" value="">
	<!--
		No.
	-->
<txp:else />
	<!--
		Is.
	-->
</txp:if_variable>

Offline

#3 2010-02-14 11:32:36

Bongo-man
Member
Registered: 2009-03-18
Posts: 243

Re: Label customization in <txp_article_custom />

Where do I need to put all this? Within the <txp_article_custom label=’…..’ /> tag, or..?

Offline

#4 2010-02-14 14:59:00

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

Re: Label customization in <txp_article_custom />

It may be easier to do it like this (in your article form):

<txp:if_first_article>
   // your label
</txp:if_first_article>
// the other tags

This way, if there are no articles, the label won’t show either.

Offline

#5 2010-02-14 21:04:39

Bongo-man
Member
Registered: 2009-03-18
Posts: 243

Re: Label customization in <txp_article_custom />

I’m sorry there is another problem: I usually don’t list articles, but article permalinks, for this reason I made a mistake in expressing my question, also in this case.

What I need is not to have the labels displayed when no links to articles are displayed, in their specific lists.

So I need to use <txp_article _custom /> . :-(

Last edited by Bongo-man (2010-02-14 21:05:48)

Offline

#6 2010-02-14 22:29:52

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

Re: Label customization in <txp_article_custom />

A list of permalinks is also an article list ;) So if you use article_custom, your article form (or the code inside the article_custom container tag) should look something like this:

<txp:if_first_article>
   <h3>This is a list</h3>
</txp:if_first_article>
<txp:permlink><txp:title /></txp:permlink>

Offline

#7 2010-02-17 12:50:03

Bongo-man
Member
Registered: 2009-03-18
Posts: 243

Re: Label customization in <txp_article_custom />

It does not work, I have tried also changing the tag ftom <txp:article_custom /> to <link_list />.

Maybe it coulb be useful I publish all the expression I have used:

<txp:article_custom section=“press-releases” sort=“Posted desc” break=“li” limit=“5” label=”<br /><i>Some press releases:</i>” ><txp:permlink><txp:title /></txp:permlink>, <i> <txp:custom_field name=“press-release-source” /></i>
</txp:article_custom>

<p><div><font size=“2”><i>- A note about the press-releases published.</i></font></p>

——————-

What I need is that all above disappear when no press-releases are available.

Last edited by Bongo-man (2010-02-17 17:13:28)

Offline

#8 2010-02-17 19:11:41

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

Re: Label customization in <txp_article_custom />

<txp:linklist /> is for links, not articles, so you can’t use it here.
I don’t think the html tags in the label attribute are possible, you can achieve the same in the CSS, and anyway this would do the same:

<txp:article_custom section="press-releases" sort="Posted desc" break="li" limit="5">
   <txp:if_first_article>
      <br /><i>Some press releases:</i>
   </txp:if_first_article>
   <txp:permlink><txp:title /></txp:permlink>, <i> <txp:custom_field name="press-release-source" /></i>
   <txp:if_last_article>
      // here the code after the list in case it also shouldn't be displayed when there are no articles
   </txp:if_last_article>
</txp:article_custom>

And by the way, “It does not work” isn’t very helpful for troubleshooting ;)

Last edited by els (2010-02-17 19:12:33)

Offline

#9 2010-02-22 18:32:11

Bongo-man
Member
Registered: 2009-03-18
Posts: 243

Re: Label customization in <txp_article_custom />

Els wrote:

<txp:linklist /> is for links, not articles, so you can’t use it here.
I don’t think the html tags in the label attribute are possible, you can achieve the same in the CSS, and anyway this would do the same:

<txp:article_custom section="press-releases" sort="Posted desc" break="li" limit="5">
   <txp:if_first_article>
      <br /><i>Some press releases:</i>
   </txp:if_first_article>
   <txp:permlink><txp:title /></txp:permlink>, <i> <txp:custom_field name="press-release-source" /></i>
   <txp:if_last_article>
      // here the code after the list in case it also shouldn't be displayed when there are no articles
   </txp:if_last_article>
</txp:article_custom>

You were very helpful, but there is a very little graphical problem I’ve solved in a not so good way:

- When press-releases are displayed the first ‘li’ break, is close to the paragraph title.
IThe problem is solved if I remove break=“li” and place ‘<li>’ directly as html tag

here -> <li><txp:permlink><txp:title /></txp:permlink>, <i> <txp:custom_field name=“press-release-source” /></i>

And by the way, “It does not work” isn’t very helpful for troubleshooting ;)

I can’t understand what you mean my familiarity with English slangs is not so good.
Does my expression have been not so polite, or perhaps a little ‘formal’?
In that case I’m sorry.

Thank you for your help,
bongo-man

Offline

#10 2010-02-22 19:06:11

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

Re: Label customization in <txp_article_custom />

Bongo-man wrote:

The problem is solved if I remove break=“li” and place ‘<li>’ directly as html tag

here -> <li><txp:permlink><txp:title /></txp:permlink>, <i> <txp:custom_field name=“press-release-source” /></i>

That’s a good solution, nothing wrong with it!

I can’t understand what you mean my familiarity with English slangs is not so good.
Does my expression have been not so polite, or perhaps a little ‘formal’?

No, I didn’t mean that at all! Sorry if I wasn’t clear. I was trying to say that instead of just saying ‘it doesn’t work’, it’s better to explain what you wanted it to do, and what it does in reality: does it display nothing at all, does it display something different than you expected, if so, what? etcetera. That way you make it easier for people trying to help you to find out what may be wrong with the code.

Offline

Board footer

Powered by FluxBB