Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2006-02-08 00:20:18

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Re: articles only from certain category

OK I have got to a point with if_category where i display as much articles as I would like, but how do I add pagination? txp:newer and txp:older don’t work. :( (it says they are an undefined variable)

Last edited by Dragan (2006-02-08 00:22:13)

Offline

#17 2006-02-08 01:47:15

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

Re: articles only from certain category

You would need something like:-

<code>
<txp:if_category>
<txp:article limit=“30” form=“formName” />
<txp:else />
<txp:article limit=“5” />
</txp:if_category>
<txp:older>previous</txp:older> <txp:newer>next</txp:newer></code>


Stuart

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

Offline

#18 2006-02-08 08:40:57

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Re: articles only from certain category

thebombsite that works like a charm, but, I can’t say I understand what it acctually does, here is what I put in in the archive page:
<code> <txp:if_category> <txp:article limit=“5” /> <txp:else /> <txp:article limit=“5” /> </txp:if_category>

<ul class=“pagin”> <li><txp:newer>&laquo; Noviji</txp:newer></li> <li class=“older”><txp:older>Stariji &raquo;</txp:older></li>
</ul>
</code>

Offline

#19 2006-02-08 10:37:05

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

Re: articles only from certain category

Well it simply asks if we are in a category list output 30 articles using the “formName” form template, else if we aren’t, output 5 articles (using the default form which doesn’t need specifying), then output the paging links what ever we are in.


Stuart

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

Offline

#20 2006-02-09 15:01:09

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Re: articles only from certain category

> doggiez wrote:

> bq. I’m also interested in getting rid of empty elements, for instance while paginating, when there is no “next” or “previous”.
Also, I don’t like having empty elements lying around serveing no purpouse.

Would chh_if_data help you with this?

I have been messing with this plugin and it doesn’t seem to do what I want. It still outputs an empty a element, my code goes something like this:
<code>
<txp:cch_if_data>
<a href=”<txp:site_url /><txp:section />/?c=<txp:category2 />”><txp:category2 title=“1” /></a>
</txp:cch_if_data>
</code>

Am I not using it correctly? I didn’t use the :else because I don’t want anything output.

Offline

#21 2006-02-09 15:36:21

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

Re: articles only from certain category

Ah, I was wondering why you didn’t use <txp:category2 title=1 link=1 />, but I see you need the section in the url.

I think the plugin doesn’t work because there is more than one txp tag inside, and only one of them doesn’t have content.

Try this:
<code>
<txp:if_article_category number=“2” name=”“>
<a href=”<txp:site_url /><txp:section />/?c=<txp:category2 />”><txp:category2 title=“1” /></a>
</txp:if_article_category>
</code>

Offline

#22 2006-02-09 19:32:17

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Re: articles only from certain category

Oh my god I can’t believe that worked! :)
BTW, what’s the name=”“ for? I ditched it.

Offline

#23 2006-02-09 19:41:46

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

Re: articles only from certain category

Ah, so it works without that as well? I am using that with <txp:if_category> to say ‘if we are on a (any) category page…’ so I guessed it would work with <txp:if_article_category>. But nice to know you don’t even need it :)

Offline

#24 2006-02-09 19:49:20

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Re: articles only from certain category

coudn’t be better :)

Offline

#25 2006-02-10 11:19:27

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Re: articles only from certain category

Question: How do i get the article title into the title element (page title) when viewing a single article in a section (a quazy static page)?

Offline

#26 2006-02-10 17:36:53

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

Re: articles only from certain category

You can use conditional tags in the page title. I use something like this:

<code><title><txp:sitename /> -<txp:if_section name=”“><txp:if_category> <txp:category title=“y” /><txp:else /> <txp:site_slogan /></txp:if_category></txp:if_section><txp:if_section name=”“><txp:else /> <txp:section title=“y” /></txp:if_section><txp:if_individual_article> <txp:category title=“y” />: <txp:article limit=“1” form=“title” /></txp:if_individual_article></title>
</code>
In article form ‘title’ is only <txp:title />.

NOTE that you can only use an article tag here if you have set ‘Automatically append comments to articles?’ in admin > preferences to ‘no’.

Last edited by doggiez (2006-02-10 17:38:27)

Offline

#27 2006-02-10 17:57:34

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Re: articles only from certain category

NOTE that you can only use an article tag here if you have set ‘Automatically append comments to articles?’ in admin > preferences to ‘no’.

BTW what does that do? Does it mean that I have to manually call the comment form to the article? It says nothing when you click the littel question mark in the admin area.

Offline

#28 2006-02-10 18:06:18

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

Re: articles only from certain category

That’s right. Read the FAQ: Comment display confusion.

Offline

#29 2006-02-16 20:20:19

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Re: articles only from certain category

I’m having trouble with this auto appending thing, I have turned it off in order your code to work for the title doggiez, but I get the comments twice even though I have turned auto append off. I use th form “Single” to display the full article and at the end of it I have tried adding:
<pre>< txp:comments_display /></pre>
but it doesn’t display anything (my comments_display form contains all necessary for the comments to appear), thae I have “hardcoded” my comments_display form into the Single form which looks like this:
<pre><!— start comments —>

< txp:if_comments>
< h3 id=“komentari”>Komentari na ovaj članak</h3>
< txp:comments />
< txp:else />
< h3 id=“komentari”>Nema komentara</h3>
< /txp:if_comments>
< txp:comments />

< txp:if_comments_allowed>
< txp:comments_form />
< /txp:if_comments_allowed>

< txp:if_comments_disallowed> < p>
Komentari na ovaj članak su zatvoreni.
< /p>
< /txp:if_comments_disallowed></pre>
and it still it double adds them. What am I doing wrong?

EDIT:

OK, I got it, it needs to go to the page template, not the Single article form.

Last edited by Dragan (2006-02-16 20:29:44)

Offline

#30 2006-02-16 22:51:46

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

Re: articles only from certain category

OK, I got it, it needs to go to the page template, not the Single article form.

No, it doesn’t, the single article form is the right place… But you’ve got two <txp:comments /> tags, I think that’s the problem.

Offline

Board footer

Powered by FluxBB