Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
Re: Recent_articles Tag
You could just do it with txp:article
and using the pageby
-attribute. See example 4.
…Prrrrrrrr…
Offline
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
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
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
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 illogicaloffset="3" pageby="4"
…. texted postive
Offline
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
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
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
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
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
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