Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: smd_horizon: What's that coming over the hill...
maniqui
Ummm, I think that’s by design but, ummm, I’m not sure. Glad you got it sorted. Shall we brush this one under the carpet and hope nobody else notices ;-)
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: smd_horizon: What's that coming over the hill...
Thanks for the feedback, Bloke.
I still experimenting with smd_horizon, and I’ve noticed something buggy.
If I use article tags (like txp:title, txp:body, txp:permlink), inside smd_prev/smd_next, when I reach the start/end of a list, those tags are rendered using the value of the current article (usually the first/last article).
Expected behaviour: they should return empty (because there isn’t any next nor prev article).
Buggy behaviour: they return the value for current (first/last) article.
Edit: extra question: Bloke, any idea on how to make the links created by smd_link_to_next/prev to be affected by gbp_p_l rules? Most of my permlinks on a page are affected by gbp_p_l, but not the ones created by smd_horizon.
Last edited by maniqui (2009-11-24 20:50:03)
Offline
Re: smd_horizon: What's that coming over the hill...
maniqui wrote:
If I use article tags (like txp:title, txp:body, txp:permlink), inside smd_prev/smd_next, when I reach the start/end of a list, those tags are rendered using the value of the current article (usually the first/last article).
Nuts, thanks for the report. I’ll have to try and fix that, but I think it’s a bit tricky :-( You can get round it for now like this:
<txp:smd_next>
<txp:smd_if_end>
<txp:else />
<h3>Coming up next...</h3>
<txp:title />
</txp:smd_if_end>
</txp:smd_next>
any idea on how to make the links created by smd_link_to_next/prev to be affected by gbp_p_l rules?
Nope, sorry. I use the core’s permlinkurl_id()
function to create the links. I presume by the time smd_horizon has encountered the links, gbp_pl is long gone (it’s loaded early, right?) But having said that, if it correctly intercepts other tags in the page flow, why not mine? Hmmm. Perhaps you could bounce this off Graeme and see if he has any ideas how to get this to play with his plugin. I’ll do whatever it takes… ta!
Last edited by Bloke (2009-11-24 22:01:52)
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: smd_horizon: What's that coming over the hill...
Hi Bloke, thanks for the tips.
I ended up with this snippet, killing two birds with one shot :)
<txp:chh_if_data>
<ul class="prev-next-article_nav">
<txp:chh_if_data><txp:smd_prev category='<txp:category2 />'><txp:smd_if_start><txp:else /><li class="prev-article">Previous article:<br /><a href="<txp:permlink />" class="button button-arrow prev-article"><span><txp:prev_title /></span></a></li></txp:smd_if_start></txp:smd_prev></txp:chh_if_data>
<txp:chh_if_data><txp:smd_next category='<txp:category2 />'><txp:smd_if_end><txp:else /><li class="next-article">Next article:<br /><a href="<txp:permlink />" class="button button-arrow next-article"><span><txp:next_title /></span></a></txp:smd_if_end></txp:smd_next></txp:chh_if_data>
</ul>
</txp:chh_if_data>
Applying your last tip (smd_if_start/smd_if_end), allowed me to recreate the prev/next links using txp:permlink
(and avoid any extra/undesired output on first/last article).
And txp:permlink
is intercepted by gbp_permanent_links, so the output is the expected :)
Anyway, I’ll talk with Graeme about this and will let you know what he says.
Offline
Re: smd_horizon: What's that coming over the hill...
speeke wrote:
My problem is that when I use the code above, the link
/countries/a-b/
isn’t reproduced.
At the moment using urlvars, no it cannot do that. It always outputs messy URLs and can’t read or intepret your permanent link rules unless you do what maniqui did in the post above yours (which is probabyl not applicable here).
Thinking about it, I suppose I could make it more useful by allowing you to specify the format of the desired URL for any parameters. Perhaps I could allow you to specify placeholders where you want your variables to be added, e.g.:
urlformat="/{country_var}/{country_val}"
Without any urlformat
it’d default to ?var1=val1&var2=val2...
Not sure if I can pull that off, but if I could it’d be pretty cool. Would that help you out? If so, leave it with me and I’ll see what I can do.
Last edited by Bloke (2009-11-30 10:49:18)
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: smd_horizon: What's that coming over the hill...
Hi Stef
I’m scouting for a prev/next device that will play nicely with stm_article_order
I made a speculative stab at using txp:smd_next with stm_article_order’s sort="position"
atrtribute
<txp:smd_next timesort="position" />
I crossed all my fingers and toes, but not surprisingly it didn’t have the desired effect. Do you think it might it be possible?
Offline
Re: smd_horizon: What's that coming over the hill...
Hi mr bloke,
I am ordering articles with numeric values entered in a custom_field, where “01” comes before “02”, etc etc
The plugin works great except that the next and previous articles don’t reflect the order specified by custom_field.
Is there a way to make the tag honor my desired article order because using the datasort attribute doesn’t seem to work?
<txp:smd_next datasort="custom_12 asc" category='<txp:category2 />' form="-pag-next" />
<!-- form="-pag-next" -->
<txp:smd_if_end>
<txp:else />
<a href="<txp:link_to_next />" rel="next" class="next">Volgende pen: <txp:custom_field name="Kleur" /></a>
</txp:smd_if_end>
Last edited by Timid&friendly (2010-06-11 07:27:06)
I think, therefore I AM, … … er … I think :-?
Offline
Re: smd_horizon: What's that coming over the hill...
Timid&friendly wrote:
next and previous articles don’t reflect the order specified by custom_field.
No, I never considered that. Stupid really. To test this out, hack the plugin for now. Find line 241ish. You’ll see:
case 'author':
if ($author) {
$orderby[] = 'AuthorID'.$sorder;
}
break;
Add this immediately afterwards:
default:
$orderby[] = $item.$sorder;
pieman
Sorry for not getting back to you at the time but this fix will help you too. If you want to use timesort
though you’ll need to edit line 260ish as well. Remove the line with default:
on it and paste it below the ‘posted’ case, like this:
case 'posted':
$orderby[] = 'Posted'.$sorder;
break;
default:
$orderby[] = $item.$sorder;
Let me know how y’all get on. If it works and there are no undue side-effects I’ll issue an official version.
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: smd_horizon: What's that coming over the hill...
That works fantastically! Thx so very much
I think, therefore I AM, … … er … I think :-?
Offline
Re: smd_horizon: What's that coming over the hill...
Hi Stef – I’m trying to get next/prev links within a category1. I had some pretty weird stuff happening, but borrowing Maniqui’s final code things more or less work:
<txp:chh_if_data>
<txp:category1 title="1" />
<txp:chh_if_data>
<txp:smd_prev category='<txp:category1 />'>
<txp:smd_if_start>
<txp:else />
<a href="<txp:permlink />" class="breadcrumbs">
« <txp:prev_title />
</a>
</txp:smd_if_start>
</txp:smd_prev>
</txp:chh_if_data>
<txp:chh_if_data>
<txp:smd_next category='<txp:category1 />'>
<txp:smd_if_end>
<txp:else />
<a href="<txp:permlink />" class="right breadcrumbs">
<txp:next_title /> »
</a>
</txp:smd_if_end>
</txp:smd_next>
</txp:chh_if_data>
</txp:chh_if_data>
Only, Instead of the order getting sorted by posted
it seems to sort it alphabetically by title.
So instead of:
Conway House > Rockwell-Hondorp Residence > Inglese Queen Truss House
I get:
Conway House > Hapgood Residence > Harwood Stone House
Won’t you please help me, Mr. Bloke,
– A shy admirer.
Last edited by JanDW (2010-08-25 16:03:32)
TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX
Offline
Re: smd_horizon: What's that coming over the hill...
JanDW wrote:
Instead of the order getting sorted by
posted
it seems to sort it alphabetically by title.
Hmmm, I just tried this and got a bit confused. From my testing I think if you dig a little deeper you may find that it’s actually sorting by category2 (first) and then in the absence of a cat2 will default to posted. This may well be a bug (or at least an “unexpected feature” :-) but I think as soon as you choose ‘category’ as a horizon it takes both categories into account. Since it can’t know which you want to sort by it goes by cat1 first, then cat2. In your case, cat1 is all the same so it sorts by cat2.
I’m not sure how to get round this one. Might be something I can do in the plugin, or some clever soul might be able to find another way to approach it. Gotta run now. Will divert some brain cycles to it myself later if I can.
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: smd_horizon: What's that coming over the hill...
Ah yes that would make sense as category2 is virtually identical to the title of each.
I didn’t think of that, so I was baffled that it seemed to sort by title. Thanks for pointing that out.
Well, I just added datasort="category1"
:
<txp:smd_prev category='<txp:category1 />' datasort="category1">
and to <txp:smd_next>
as well and I think it now sorts by posted
secondly!
Thanks Stef!
Last edited by JanDW (2010-08-25 19:27:09)
TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX
Offline