Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-02-17 05:17:38

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,075
Website Mastodon

Recent_articles Tag

I can’t seem to find any reference to offsetting the output the list of recent articles.

I currently have the most recent 3 articles on my Homepage. I have an area where I would like to list the next 4 Recent Articles Titles only.
I was hoping to use something like this:

<txp:recent_articles label="Some Other Articles " limit="4"  offset="3" wraptag="ul" break="li" sortby="Posted" sortdir="desc"  /> 

But i can’t fine any reference to offset in the recent_articles Tag Reference

I would have thought this would exist.
So how to accomplish what I wish?


…. texted postive

Offline

#2 2015-02-17 09:04:17

TNT
Member
From: Rotterdam, Netherlands
Registered: 2006-01-06
Posts: 256
Website

Re: Recent_articles Tag

You could just do it with txp:article and using the pageby-attribute. See example 4.


Prrrrrrrr

Offline

#3 2015-02-17 09:07:11

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Recent_articles Tag

bici wrote #288330:

I can’t seem to find any reference to offsetting the output the list of recent articles.

Hmm, conspicuously missing. That tag is hard-coded to start from 0. <txp:recent_comments> has an offset attribute, so this should too, imo.

So how to accomplish what I wish?

If you didn’t want a plugin (etc_query, smd_query) and wanted to carry on using the recent_article tag, you’d have to probably set up a counter <txp:variable>, tell your recent_articles tag to have limit="7", then in your Form/container, test the value of that counter and if it’s 3 or more, start outputting content. Increment the counter each time (adi_calc is good for this) and that’ll work, albeit a bit kludgy. TNT’s solution is way neater.


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

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2015-02-17 10:01:46

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Recent_articles Tag

@Bloke

Is that an easy fix? I also think it should have an offset attribute (and should be fixed in both Textpattern 4.5.x and 4.6).

Offline

#5 2015-02-17 10:12:34

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Recent_articles Tag

philwareham wrote #288349:

Is that an easy fix?

Yep. Two lines I think. Should be as simple as adding an offset attribute (default 0) to the latts array and then using intval($offset) in place of the 0 when specifying the SQL limit (currently line 823 in 4.5.x’s taghandlers.php). Effectively, the same as the recent_comments function.


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

Txp Builders – finely-crafted code, design and Txp

Offline

#6 2015-02-17 20:38:15

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,075
Website Mastodon

Re: Recent_articles Tag

Thanks all. I went with TNT’s suggestion,

<txp:article listform="article_listing" limit="4" offset="3" pageby="4"   />

I don’t think i would have ever “divined” that the pageby tag does what it does, But it works …

In my article_listing Form I specify to only output Article Title and PostDate.

to my mind having to use these two variables seems illogical
offset="3" pageby="4"

…. texted postive

Offline

#7 2015-02-18 05:06:59

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,075
Website Mastodon

Re: Recent_articles Tag

Update: As I indicated .. The solution offered works fine when I am on the default Home Page But when I go to other Sections that information does not get output.

I have the code in a Footer Form, which calls the Article_Listing form. I have tried a variety of solutions without success. I tried name=“default” ( which is my home page ) also section=“default”

How does one get output to all sections even if one is calling for article titles?


…. texted postive

Offline

#8 2015-02-18 10:42:35

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Recent_articles Tag

OK, I’ve added the offset attribute to <txp:recent_articles /> tag in v4.5.x dev and 4.6 dev builds now.

Offline

#9 2015-02-19 00:22:38

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,075
Website Mastodon

Re: Recent_articles Tag

Note: I now , after a series of trials and errors have the desired article titles appearing in my Footer Form for all sections.

I used this in my Footer Form:

<txp:article_custom listform="article_listing" limit="4" offset="3" pageby="4"   />

…. texted postive

Offline

#10 2015-02-19 00:23:08

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,075
Website Mastodon

Re: Recent_articles Tag

philwareham wrote #288387:

OK, I’ve added the offset attribute to <txp:recent_articles /> tag in v4.5.x dev and 4.6 dev builds now.

cool


…. texted postive

Offline

#11 2015-02-19 09:23:40

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Recent_articles Tag

By the way, this will be an undocumented feature in Textpattern v4.5.x if we release another minor point release of that branch, since we aren’t really meant to add features between major point releases – so it’s officially a v4.6 feature.

Please don’t add anything to the Wiki on this – I’ll do that at the correct time.

Offline

#12 2017-02-18 03:42:47

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,075
Website Mastodon

Re: Recent_articles Tag

bici wrote #288404:

Note: I now , after a series of trials and errors have the desired article titles appearing in my Footer Form for all sections.

I used this in my Footer Form:

<txp:article_custom listform="article_listing" limit="4" offset="3" pageby="4" />...

this feature is not available in 4.6.2 or not working

my site is now not displaying article titles only by the an offset of 3 articles. totally borked

Last edited by bici (2017-02-18 03:43:25)


…. texted postive

Offline

Board footer

Powered by FluxBB