Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#151 2020-02-07 07:21:16
Re: Dev news
This pagination example is great. We should do a small series of blog posts after 4.8.0 release demonstrating this one and a handful of other examples of what can be done with Oleg’s superb tag additions. The new tag stuff make my head spin a bit at times (in a good way) and I don’t pretend to know how they all work – but we would all benefit from some real-world examples (especially where they replace plugins that had to be used in the past to achieve the same thing).
Offline
#152 2020-02-07 09:23:53
Re: Dev news
Yes, great idea, Phil.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#153 2020-02-07 10:37:26
Re: Dev news
philwareham wrote #321558:
This pagination example is great. We should do a small series of blog posts after 4.8.0 release demonstrating this one and a handful of other examples of what can be done with Oleg’s superb tag additions. The new tag stuff make my head spin a bit at times (in a good way) and I don’t pretend to know how they all work – but we would all benefit from some real-world examples (especially where they replace plugins that had to be used in the past to achieve the same thing).
I so much agree with you! I’m still confused what test and shift are doing but also, what the series of numbers actually mean.
These tags, basically made etc_pagination obsolete for most cases.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#154 2020-02-07 11:09:28
Re: Dev news
colak wrote #321561:
These tags, basically made etc_pagination obsolete for most cases.
Yep. As <txp:images> pretty much wiped out the need for smd_gallery, and shortcodes / the <txp:header> tag eradicated the need for smd_macro and rah_beacon and rah_external_output. And hopefully we’ll be able to get rid of smd_thumbnail soon in favour of a core solution. All this stuff needs showcasing.
I’m still confused what test and shift are doing but also, what the series of numbers actually mean.
Yeah, it’ll need documenting but in an earlier post I asked some questions that were answered and can give insight:
shiftinside<txp:newer/older>is an offset from the end. It can either be valueless (meaning subtract one value ‘in’ from the extremity) or a negative number to move ‘in’ that many values from the extremity.shiftcan be a positive value, but I’ve yet to see the benefit of doing that as it goes “off the end” of the pagination by default.shiftcan represent a ‘width’ +/- either side of the current page (but I don’t know how to get it to behave this way yet).shiftinside<txp:pages>will add/subtract the given value to the page being iterated over.shiftinside<txp:pages total>represents a width +/- either side of the current page.- A valueless
totalattribute inside<txp:pages>sets it to ‘current page’, allowingshiftand<txp:yield>to operate from this page number. - A
totalattribute with a value given in a<txp:pages>tag acting as a wrapper sets the maximum number of pages for the navigation. limiton the<txp:pages>tag will curtail the maximum number of pages to the given limit.- Setting a valueless
pgattribute will cause the<txp:pages>tag to hook into the default Txp paging mechanism in the URL. Thetotalwill then be automatically set to the number of pages required to paginate all articles in the current section. - Using pure numbers in a
testattribute inside a<txp:evaluate>allows you to target individual items inside its container, to control the order they are processed. Normally, tags inside<txp:evaluate>are executed in order, top to bottom, most deeply nested out. But you can alter this by listing which tags you want to execute. e.g.test="3, 7, 5"will process the third<txp:/>tag, then the seventh, then the fifth, then the rest, in order.
That’s all I know right now and hopefully it’s accurate (but might not be!)
Last edited by Bloke (2020-02-07 11:13:36)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#155 2020-02-07 11:53:09
Re: Dev news
I’m still tweaking it, and your feedback gives new ideas, for example for negative total shift.
What looks settled at this moment? Say, we have 20 pages and the current one is the 3rd.
Number of pages:
<txp:pages total /> outputs 20
<txp:newer total /> outputs 2
<txp:older total /> outputs 17
Links:
<txp:pages shift="-3,-2,-1,0,1,2,3" /> iterates over pages 1...6 (3 + shift)
<txp:newer shift="3,2,1" /> iterates over pages 1,2 (3 - shift)
<txp:older shift="1,2,3" /> iterates over pages 4,5,6 (3 + shift)
<txp:newer shift="-1,-2,-3" /> iterates over pages 1,2,2 (1 - shift - 1, needs a fix)
<txp:older shift="-3,-2,-1" /> iterates over pages 18,19,20 (20 + shift + 1)
<txp:pages shift /> is not yet set, but could point to pages 1 and 20
<txp:newer shift /> points to page 1
<txp:older shift /> points to page 20
<txp:pages total shift /> iterates over pages 1...20
<txp:newer total shift /> iterates over pages 1...2
<txp:older total shift /> iterates over pages 4...20
<txp:pages total shift="3" /> iterates over pages 1...7 to produce 2*shift + 1 links
<txp:newer total shift="3" /> iterates over pages 1,2
<txp:older total shift="3" /> iterates over pages 4...7.
Negative total shift yet to consider.
Offline
#156 2020-02-07 14:07:56
Re: Dev news
THanks to both! This makes absolute sense now. If you do not mind me asking another question in order to fully clarify things in my head.
In this example Oleg starts with <txp:pages total="200" evaluate="3,7,5"> which it did not work but with his recommendation <txp:evaluate test="3,7,5"> worked just fine.
In the new article list pagination system of tags, are there any best practices recommendations on when we should be using pages and when to use other tags?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#157 2020-02-07 14:22:09
Re: Dev news
colak wrote #321564:
In this example Oleg starts with
<txp:pages total="200" evaluate="3,7,5">which it did not work
It did, what did not work was <txp:pages total evaluate="3,7,5"> for the reason explained above: <txp:pages total /> is supposed to output the number of pages.
In the new article list pagination system of tags, are there any best practices recommendations on when we should be using
pagesand when to use other tags?
They are still moving, but the global rule is: use <txp:pages /> as pagination container when you need to reset pagination parameters pg and total, for example when creating custom pagination bars.
Offline
#158 2020-02-07 14:44:59
Re: Dev news
etc wrote #321565:
They are still moving, but the global rule is: use
<txp:pages />as pagination container when you need to reset pagination parameterspgandtotal, for example when creating custom pagination bars.
Whoops, I did not want it to sound that I was pointing fingers. Apologies. I’m just trying to understand the concepts in order to be able to help others. This makes sense now. Thanks to both.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#159 2020-02-07 14:49:38
Offline
#160 2020-02-10 17:11:53
Re: Dev news
I updated my Complex Pagination using all the discussion ideas here.
It now only requires one block of code and no plugins.
Offline
#161 2020-02-14 11:41:16
Re: Dev news
Is there some documentation or some explanation of this <txp:pages /> tag noted above ? I’m trying to understand what is happening in the above posts, but it is a bit hard to follow.
philwareham wrote #321558:
The new tag stuff make my head spin a bit at times (in a good way) […]
We should do a small series of blog posts […]
Yes, a good idea. As I said above, this new navigation stuff in particular is still quite mysterious. Some other tags too, I don’t fully grog their scoop, yet.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
#162 2020-02-24 12:15:28
- singaz
- Member
- Registered: 2017-03-12
- Posts: 150
Re: Dev news
I do not know in which section to ask this question, I write here
Textpattern 4.8.0 beta.3
I use in Advanced options:
[js]
mediatype="application/javascript"
title="JavaScript"
[xml]
mediatype="application/xml"
title="XML page"
and so wrote:
[js]
mediatype="text/javascript"
title="JavaScript"
[xml]
mediatype="application/xml"
title="XML page"
I write on the site this:
<script type='text/javascript' src="<txp:page_url type="theme_path" />/js/slimbox.js"></script>
and this:
<script src="<txp:page_url type="theme_path" />/js/slimbox.js"></script>
and this:
<script type='text/javascript' src='<txp:page_url type="theme_path" />/js/navigation.min.js'></script>
and this on demo site:
<script type='text/javascript' src='<txp:page_url type="theme_path" />/js/navigationmin.js'></script>
The XML sitemap is working correctly.
With java script I get an error, not found.
hosting one:
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL /themes/default/js/slimbox.js was not found on this server.</p>
second hosting:
<title> 404 Not Found</title></head>
<h1 style="margin:0; font-size:150px; line-height:150px; font-weight:bold;">404</h1>
<h2 style="margin-top:20px;font-size: 30px;">Not Found</h2>
<p>The resource requested could not be found on this server!</p>
and demo site:
<script type='text/javascript' src='https://beta-demo.textpattern.co/themes/four-point-eight/js/navigationmin.js'></script>

Where is my mistake?
I missed something and I do not know what.
Sorry my horror English. I’m learning textpattern, I’m learning English
Offline
#163 2020-02-24 12:47:53
Re: Dev news
If you saved your script in the disk, you can use
<txp:output_form form="slimbox.js" format="flat.script" />
>Edited to add that the name of your js in the form should be slimbox.js, with the extension! Also, the form type should be js (Application/javascript), again selected from the pull-down in the form.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#164 2020-02-24 13:14:30
- singaz
- Member
- Registered: 2017-03-12
- Posts: 150
Re: Dev news
<txp:output_form form="slimbox.js" format="flat.script" />
This is working correctly. Many thanks!
Sorry my horror English. I’m learning textpattern, I’m learning English
Offline
#165 2020-07-31 08:45:25
Re: Dev news
I’ve spun up a thread specifically for 4.9.0 upcoming changes here
Offline