Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#61 2015-03-23 17:00:03

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

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

claywso wrote #289322:

changed to the below with no change…

OK, thanks for clarifying. Leave it with me…


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

#62 2015-03-23 17:03:43

claywso
Member
From: Durham, NC USA
Registered: 2004-12-20
Posts: 57
Website

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

thanks a bunch, just knocked an item off of your amazon wish list, really appreciate the help.

Offline

#63 2015-03-23 22:43:07

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

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

claywso wrote #289324:

thanks a bunch, just knocked an item off of your amazon wish list, really appreciate the help.

Most decent of you, thank you very much. I’ve done some digging and I’m utterly confused. I think there might be something more fundamental going on here, because the plugin’s supposed to do what you asked it, but I can’t make it behave any more.

I’ve posted my findings in the hope someone smarter than me can throw some light on it. Maybe then we can proceed and I can figure out whether the plugin’s at fault.


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

#64 2015-03-26 21:09:53

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

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

Notwithstanding the problem in Txp’s sorting mechanism highlighted above, I’ve done some testing on smd_horizon itself and found that I can indeed get it to step through articles ordered by category1 correctly, where Txp itself fails. So w00t for the plugin, but the next question is why can I get it to work and claywso can’t.

For clarity, I’m using a vanilla installation of Txp 4.5.7, using the stock template, and v0.11 of the plugin. Firstly, please try that version, which for some reason I never released. It has a few amendments that may well have a bearing on the problem you’re seeing.

The only alteration to the stock template is in the archive template, I’ve replaced the link_to-next/prev block with this:

<txp:smd_prev datasort="Category1">
    <txp:smd_link_to_prev>&laquo; Prev article</txp:smd_link_to_prev>
</txp:smd_prev>
<txp:smd_next datasort="Category1">
    <txp:smd_link_to_next>Next article&raquo;</txp:smd_link_to_next>
</txp:smd_next>

Note that both the previous and next are using the same datasort attribute. If I do that, my navigation items step through the articles in category1 order. I didn’t have to specify the sort order of the main <txp:article> tag because the plugin overrides it anyway (if I hadn’t been using datasort then the order would have been determined by Txp’s article tag itself, which we now know would result in buggy output).

For me, that works. If it doesn’t work for you we’ll need to delve a little deeper into your template structure to try and figure out why.

One other thing you can try just to see if you can get the plugin to behave in your setup is to specify a comma-separated list of categories you want to iterate over. Try adding those using the category attribute (you may remove the datasort attribute if so, as it’ll default to Category1, but there’s no harm in leaving it set). The plugin should only pull out the articles that match and you can then see if it steps over them correctly.

If you still have no luck, feel free to drop me a login if it’s a public-facing site and I’ll see if I can diagnose it in-situ.


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

#65 2015-03-28 14:23:25

claywso
Member
From: Durham, NC USA
Registered: 2004-12-20
Posts: 57
Website

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

thanks. still couldn’t get datasort to work, so i switched over to the category attribute and that made it work as intended. thanks for your help!

(if you want to dig in out of curiosity, i’d be happy to let you login, just let me know)

Offline

#66 2015-04-28 14:46:14

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 220
Website

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

I might shed some light here. I had a similar problem. The articles were just not sorting by category. No matter if with or without datasort. No matter if I was wearing a frozen spinach hat while coding or not. Then I read Stefs comment about the version. I had version 0.1 when I had problems. Installing 0.11 made them go away and all behaved as it should be.

Offline

#67 2015-12-05 12:20:42

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 809
Website

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

I’ve problems getting smd_horizon to work with stm_article_order. stm_article_order needs sort="position asc" in an article tag.

I’ve put the code metioned in this post into the source of smd_horizon:

if ($timesort) {
    $timesort = do_list($timesort);
    foreach ($timesort as $item) {
      switch(strtolower($item)) {
        case 'lastmod':
          $orderby[] = 'LastMod'.$sorder;
          break;
        case 'expires':
          $orderby[] = 'Expires'.$sorder;
          break;
        case 'posted':
          $orderby[] = 'Posted'.$sorder;
          break;
        default:
          $orderby[] = $item.$sorder;
			}
		}
	}

The smd_horizon snippet:

<txp:smd_link_to_prev >
         &#171; <txp:prev_title/>
</txp:smd_link_to_prev>
 | <a href="<txp:site_url /><txp:section />" itemprop="url" class="">Go to all articles in '<txp:section title="1" />'</a>
 | <txp:smd_link_to_next>
         <txp:next_title/> &#187;
</txp:smd_link_to_next>

The article tag:

<txp:if_individual_article>
<main class="row narrow">
<txp:article limit="1" form="single_nolink" sort="position asc" />
</main>
<txp:else />
<main class="row wide">
<txp:article limit="99" wraptag="ul" class="small-block-grid-1 medium-block-grid-2 large-block-grid-3" break="li" form="excerpt" sort="position asc" />
</main>
</txp:if_individual_article>

And this is what I get > terencejroe.com/new/art/paintings

Any help is appreciated.

Offline

#68 2019-10-22 12:28:39

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

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

Updated plugin to v0.2.0 to be more Txp 4.6+ aware, by registering its public tags to avoid throwing warnings all over the place.

Incidentally, this plugin is less relevant than it once was, due to the significant improvements in ‘neighbour’ article functionality in Textpattern core. That said, if you want to navigate between sections or maintain/rewrite the URL params as you do, this plugin may still have some life in it for you.

Last edited by Bloke (2019-10-22 12:31:02)


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

Board footer

Powered by FluxBB