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...
I’m starting to think the way to go might be make all the category pages sections. Although that would mean a lot more pages and code and would be sloppy. But I don’t see any way to maintain the current category page once an individual article is selected.
its a bad hen that wont scratch itself.
photogallery
Offline
Re: smd_horizon: What's that coming over the hill...
kvnmcwebn wrote:
Everything is working fine until you drill down to an individual article in a category page…. I’m starting to think the way to go might be make all the category pages sections.
We’re nowhere near ready to throw the towel in yet!
Thanks for the link to your site. That’s helped a lot. So the issue is that the site ‘forgets’ the category when you drill down. So all we need to do is help it remember. Perhaps on your list page, do something like this:
<txp:if_category>
<h3 class="entry-title"><a href="<txp:permlink />?cat=<txp:category />"><txp:title /></a></h3>
<txp:else />
<h3 class="entry-title"><txp:permlink><txp:title /></txp:permlink></h3>
</txp:if_category>
And then later in the page where you have the smd_prev/smd_next, read that variable in using <txp:adi_gps /> and then use it:
<txp:smd_prev category='<txp:if_variable name="cat"><txp:variable name="cat" /></txp:if_variable>' >
<txp:smd_link_to_prev urlvars="cat">« Previous</txp:smd_link_to_prev>
</txp:smd_prev>
Notice I’ve used <txp:smd_link_to_prev> because we want to use the urlvars attribute to preserve the ?cat URL var in the links.
Through judicial use of the datasort atribute as I mentioned above you should be able to limit the navigation to the given category.
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
Re: smd_horizon: What's that coming over the hill...
>>…So the issue is that the site ‘forgets’ the category when you drill down. So all we need to do is help it remember…
:) I like that.
Well I’ve got my homework now. Thanks a mill Steph.
its a bad hen that wont scratch itself.
photogallery
Offline
Re: smd_horizon: What's that coming over the hill...
Steph before moving on to step two using <txp:adi_gps /> is this how the individual article category urls should look?:
http://www.graphx.macdesign.eu/signs/signs-example-14?cat=business_signs
thanks
its a bad hen that wont scratch itself.
photogallery
Offline
Re: smd_horizon: What's that coming over the hill...
kvnmcwebn wrote:
http://www.graphx.macdesign.eu/signs/signs-example-14?cat=business_signs
That should do the trick, yes. I just chose cat= because we can’t use c= as it’s used internally by TXP. As long as that value is passed forward to each page that originates from a category list you can use that variable for whatever purpose you see fit. Just have to make sure that you aren’t passing any more messy vars about the place or you might end up making ?cat=business_signs?m=2, which ain’t valid.
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
Re: smd_horizon: What's that coming over the hill...
Well it’s passing the variable and keeping it for each article in the category but I’m not sure how the adi_gps is supposed to pass the variable to the if variable statement:
From what i read in the adi_gps docs it looks like its all done in the code you posted right:
<txp:smd_prev category='<txp:if_variable name="cat"><txp:variable name="cat" /></txp:if_variable>' >
<txp:smd_link_to_prev urlvars="cat">« Previous</txp:smd_link_to_prev>
</txp:smd_prev>
I mean that actually gets the var as well right?
its a bad hen that wont scratch itself.
photogallery
Offline
Re: smd_horizon: What's that coming over the hill...
kvnmcwebn wrote:
I’m not sure how the adi_gps is supposed to pass the variable to the if variable statement
Magic :-)
It creates a txp:variable called cat if there’s a ?cat= in the URL. If there isn’t, it’s not created, hence the reason we need to test if it exists using <txp:if_variable>. If you skip the if_variable part and the cat= is omitted a warning shows up on your page.
So, yes, the code I posted gets the value of the variable and plugs it into the smd_next/prev category attribute so it’s passed between pages when you click next/prev. All that remains is to get the right datasort attributes (probably Posted, Category1, Category2?) so it can do your bidding by providing the next/prev links you expect.
Last edited by Bloke (2011-03-06 17:51:19)
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
Re: smd_horizon: What's that coming over the hill...
cool thanks, I was wondering why we needed the if_variable
ok going to try the datasort now
fingers crossed
its a bad hen that wont scratch itself.
photogallery
Offline
Re: smd_horizon: What's that coming over the hill...
hmm…
any thing wrong with this?
<ul id="previous-next">
<li id="n-previous">
<txp:if_individual_article>
<txp:smd_prev category='<txp:if_variable name="cat"><txp:variable name="cat" /></txp:if_variable>' datasort="posted, category1, category2" >
<txp:smd_link_to_prev urlvars="cat">« Previous</txp:smd_link_to_prev>
</txp:smd_prev>
<txp:else />
<div class="older"><txp:older>Older Projects »</txp:older></older>
</txp:if_individual_article>
</li>
<li id="n-next">
<txp:if_individual_article>
<txp:smd_next category='<txp:if_variable name="cat"><txp:variable name="cat" /></txp:if_variable>' datasort="posted, category1, category2" >
<txp:smd_link_to_next urlvars="cat">« Next</txp:smd_link_to_next>
</txp:smd_next>
<txp:else />
<div class="newer"><txp:newer>«Newer Projects </txp:newer></div>
</txp:if_individual_article>
</li> </ul> <!-- end previous-next -->
its a bad hen that wont scratch itself.
photogallery
Offline
Re: smd_horizon: What's that coming over the hill...
kvnmcwebn wrote:
any thing wrong with this?
Not as far as I can see. Is it live now? ‘Cos if it is then the component that’s missing (assuming adi_gps is in your page template somewhere) is the ?cat= in your URL. Without that bit the if_variable won’t fire and you’ll be back to navigating a regular section list.
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
Re: smd_horizon: What's that coming over the hill...
holy mary mother of god it works. you are the man. I learned a lot from this. THANK YOU.
its a bad hen that wont scratch itself.
photogallery
Offline
Re: smd_horizon: What's that coming over the hill...
I think when I get this cleaned up I might put an article in txp tips about it. what do you think. Im mean giving all the credit to where it’s due(not me). Because i think that this could help other users.
its a bad hen that wont scratch itself.
photogallery
Offline
Re: smd_horizon: What's that coming over the hill...
kvnmcwebn wrote:
holy mary mother of god it works. you are the man. I learned a lot from this. THANK YOU.
Excellent. You are most welcome. I learned a lot too.
I’d also forgotten how cumbersome the plugin is when it comes to this level of navigation so it’d be nice to retool it a bit in future to make it easier to accomplish this kind of thing. But keeping a bit of history on where an article came from (section list or cat list) is a little outside TXP’s regular scope so perhaps this level of hoop jumping is justified in this case. If anything strikes me I may take the opportunity to do something about it in future versions.
I think when I get this cleaned up I might put an article in txp tips about it.
Great! No worries about heaping credit on me. The important thing is documenting it so others can get to the end result quicker than it’s taken my foggy brain and slightly awkward plugin to catch up with your, very reasonable, site layout logic :-)
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
Re: smd_horizon: What's that coming over the hill...
ha ha. it’s me who is the foggy brained designer!
its a bad hen that wont scratch itself.
photogallery
Offline
Re: smd_horizon: What's that coming over the hill...
Thank you for writing this plugin at first :)
Using
<txp:smd_prev category="category1"><txp:link_to_prev><div id="back"> </div></txp:link_to_prev></txp:smd_prev><txp:smd_next category="category1"><txp:link_to_next><div id="next"> </div></txp:link_to_next></txp:smd_next>
on txp 4.4.0 in an article form produces links still pointing to ALL articles of the current section, independent from a particular category setting.
This also happens, when i use a particular category name instead of “category1” .
Anything i am obviously doing wrong?
Thanx a bunch in advance!
Last edited by jayrope (2011-05-23 14:39:05)
A hole turned upside down is a dome, when there’s also gravity.
Offline