Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2009-11-24 16:48:37

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,740
Website GitHub

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

#14 2009-11-24 20:48:16

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#15 2009-11-24 22:00:59

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,740
Website GitHub

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

#16 2009-11-24 22:18:50

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#17 2009-11-30 06:12:49

speeke
Member
From: Bruny Island, Australia
Registered: 2009-03-29
Posts: 161
Website

Re: smd_horizon: What's that coming over the hill...

Hi Bloke,

I’m using a variation of your plugin help example:

<txp:smd_link_to_next urlvars="countries">
  <txp:title />
</txp:link_to_next>

where my url is http://domain.com/section/title/countries/a-b/. The url outputs the variable like this because of an .htaccess directive I’ve set up, which rewrites this to map: http://domain.com/section/title?countries=a-b.

My problem is that when I use the code above, the link /countries/a-b/ isn’t reproduced.

Is it possible to do this?

Last edited by speeke (2009-11-30 06:15:20)


“People who value their privileges above their principles soon lose both.”
Dwight D. Eisenhower

Offline

#18 2009-11-30 10:48:25

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,740
Website GitHub

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

#19 2009-11-30 21:59:13

speeke
Member
From: Bruny Island, Australia
Registered: 2009-03-29
Posts: 161
Website

Re: smd_horizon: What's that coming over the hill...

Bloke wrote:

Not sure if I can pull that off, but if I could it’d be pretty cool.

Not only am I sure you could pull it off, but then not only would the plugin be cool, but so would you – me hoping that this gratuitous praise will be sufficient ;)

Would that help you out? If so, leave it with me and I’ll see what I can do.

Absolutely :-)

Otherwise, I imagine I’ll have to use a menagerie of plugins/php code to try and reproduce this??? Thank you in advance!

EDIT: BTW, would it also be possible to create options for whether rel= and title= are included in the link output? I prefer not to use title in a link, for example, due to accessibility issues. As I understand it, screen readers, used by people with a visual impairment, end up “reading out” the link and the title name, which creates unnecessary “noise”.

Last edited by speeke (2009-11-30 22:58:00)


“People who value their privileges above their principles soon lose both.”
Dwight D. Eisenhower

Offline

#20 2010-02-09 16:03:42

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

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

#21 2010-06-11 07:21:58

Timid&friendly
Member
From: The Netherlands
Registered: 2006-05-28
Posts: 252
Website

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

#22 2010-06-11 09:00:26

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,740
Website GitHub

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

#23 2010-06-11 09:17:03

Timid&friendly
Member
From: The Netherlands
Registered: 2006-05-28
Posts: 252
Website

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

#24 2010-08-25 16:01:12

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

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">
                    	&laquo; <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 /> &raquo; 
                  </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

Board footer

Powered by FluxBB