Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2005-11-19 08:12:21

nasv
Member
Registered: 2005-11-14
Posts: 22

Re: [howto] taking advantages of status="live" and status="sticky"

<p>Maniqui, thanks again for the responses… I tried the code how you showed me without the sticky, just the text and the links inside the if statement, and the same behavior happens. You are right, there simply is something weird with linking to an article that has another article, which, unfortunately, I need since the first layer of articles I link to I need to be able to link to somewhere else</p>
<p>The clicking is happening!! Eso! I’m thinking that my best solution for now might be to create a form that manually lists and manually links to the permanent URL of the individual articles and then output the form where necessary. Unfortunately, I would have to update the form with any additional articles (or if I remove an article), but the URL for a single article doesn’t chage, right?<br>Now the only thing so far that I’m still a little confused is how you don’t use <code><txp:else /></code> nor <code><txp:if_individual_article></code>… I don’t see/understand the effect of having txp:article parsed both in article-list and in individual-article (I do understand the control logic and why it executes, I don’t understand the effect).</p>
<p>Che, mil gracias, en serio por tomar tanto tiempo conmigo en discutir esto. Saludes allá a “la ciudad de la furia” -Soda,<br>~Nico</p>

Last edited by nasv (2005-11-19 08:12:44)

Offline

#14 2005-11-19 08:53:51

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: [howto] taking advantages of status="live" and status="sticky"

You are welcome. We wont stop until the “click” sounds clearly and loud and with a huge reverb in your head.
But this thread has gone a little off-topic… When we finish, maybe I will consider to do a “cleaning-up” of the thread.. but I dont know… maybe someone can find useful our dialogue…

I don’t see/understand the effect of having txp:article parsed both in article-list and in individual-article (I do understand the control logic and why it executes, I don’t understand the effect).

Txp:article is “context-sensitive”. that means that it will output different things depending the context (the context = the actual URL in your browser).
If the context is an article-list context (/section), it will output a list of articles (the sort and the quantity and other things depends of the attributes).
If the context is an individual-article context (/section/articleTitle), it will output the article corresponding to that URL.

Now the only thing so far that I’m still a little confused is how you don’t use <txp:else /> nor <txp:if_individual_article>

Look at this code:

<code><txp:if_article_list>
…some content from the section frontpage here…
<txp:article />
</txp_if_article_list>
<txp:if_individual_article>
<txp:article />
</txp:if_individual_article>
</code>

That code will work fine and it means: “if we are in an article-list context (if_article_list), output this piece of text (…some content…) and then the article list (txp:article). If we are in individual-article context (if_individual_article), output the article (txp:article).”

Then, look at this code:

<code><txp:if_article_list>
…some content from the section frontpage here…
<txp:article />
<txp:else />
<txp:article />
</txp:if_article_list>
</code>

That code will do the same and it means: “if we are in article-list, output the piece of text and then the article-list. Else (txp:else, that if executed, it means that we are in an individual-article context), display the article.”

Finally, look at this code:

<code><txp:if_article_list>
…some content from the section frontpage here…
</txp_if_article_list>
<txp:article />
</code>

That code will also do the same and it means: “if we are in article-list, output the piece of text (…some content…). Then, parse txp:article.”
That means that if we are in article-list context, it will output the text and the article list (txp:article).
And if we are in individual-article context, it wont output the text but will output the individual article.

So, it’s exactly the same as the first and the second snippets. But shorter.

pd: Soda is ok for me. In wich year have you been here?.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#15 2005-11-19 16:15:52

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: [howto] taking advantages of status="live" and status="sticky"

Hi nasv:

From the FAQs: Can I use TXP tags in articles?

Some, but not all. In particular, <txp:article /> and <txp:article_custom /> usually won’t work at all, and are likely to fail in subtle ways if they do.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#16 2005-11-28 23:26:14

-rr-
Member
Registered: 2005-09-11
Posts: 73

Re: [howto] taking advantages of status="live" and status="sticky"

I dont find the sticky behavior logical at all. I want sticky articles to show at the top of an article list all the time. When an article is selected from the list, however, the sticky article disappears from the top of the list even though I want it to stay there. Heres the code I’m using:

<code>
<txp:article category=“Articles” listform=“titleonly” status=“sticky” />
<txp:chh_article_custom category=“Articles” listform=“titleonly” />
</code>
-

Logically I would think this would show sticky articles at the top of the list at all times… but instead they only show in the section frontpage???

Last edited by -rr- (2005-11-28 23:27:00)

Offline

#17 2005-11-29 01:09:20

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: [howto] taking advantages of status="live" and status="sticky"

It is logical. Your front-page is a list, your back-page is in “individual_article” mode. Have you tried adding the sticky tag to your back-page template as well, assuming you have a separate template for it, or within the “if_individual_article” tags? I’m not sure if it will work mind you.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#18 2005-11-29 03:27:13

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: [howto] taking advantages of status="live" and status="sticky"

As thebombsite said, it is logical.

Your articles are sticky in an article-list context (/section frontpage).
When you are in an individual-article context (/section/myarticle), the txp:article tag will only output the called article (myarticle).
So, to show an sticky in both individual-article and article-list context I will use txp:article_custom and the id="" attribute, where the value should be the ID of the sticky article you want to show in both context.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#19 2005-11-29 13:23:21

-rr-
Member
Registered: 2005-09-11
Posts: 73

Re: [howto] taking advantages of status="live" and status="sticky"

There has to be another way.

I can’t use the <code>id=”“</code> attribute, because it’s too much asked for the users to understand how to use it. Teaching them all how to set the article as sticky is much simpler.

How can change the code to make it visible? I’ve tried without success.

Offline

#20 2005-11-29 16:20:18

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: [howto] taking advantages of status="live" and status="sticky"

rr wrote:

I want sticky articles to show at the top of an article list all the time. When an article is selected from the list, however, the sticky article disappears from the top of the list even though I want it to stay there.

I can’t use the <code>id=”“</code> attribute, because it’s too much asked for the users to understand how to use it. Teaching them all how to set the article as sticky is much simpler.

rr, what are you exactly trying to achieve?
As far as I understand, you want that an “sticky” article stays at the top, both in article-list an individual-article context.
I can understand that you want to keep that “sticky” at the top in an article-list, but do you want to keep the whole “sticky” at top also when you are reading another article (individual-article)?
Mmmm… now… i think I understand.
This is a job for txp:article_custom.
Try:

<txp:article_custom section="thesection" status="sticky" limit="1" />

txp:article_custom is not context-sensitive, that is why you have to use the “section” attribute.
The “problem” is that you will have to set this once per each section you want to achieve your goal (to show an sticky article both in article-list and individual-article context), using some conditionals (if_section) or different page templates.

How can change the code to make it visible? I’ve tried without success.

I didnt understand.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB