Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2006-03-28 22:55:52

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [howto] Make a category listing use the same section and template

Nice tip, Stuart. Just one thing, for the link’s text, you’ll want the category’s title, rather than its name. I think you just forgot about that when you posted the code here. :)

<a href="<txp:site_url /><txp:section />/?c=<txp:category1 />"><txp:category1 title=1 /></a>

Offline

#17 2006-03-29 23:19:59

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: [howto] Make a category listing use the same section and template

Well wash my mouth out with soap! Slight slip of the keyboard there Mary. Thanks for pointing it out. I’ve altered my original post. I should mention whilst I’m here that using this method will produce a category listing that is also “section-sensitive”.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#18 2006-03-29 23:39:13

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

Re: [howto] Make a category listing use the same section and template

Yeah, Stuart, good tip. I dont usually work with categories (it’s hard to me to make my head around the category concept…), but this tip is very helpful.

thebombsite wrote:

I should mention whilst I’m here that using this method will produce a category listing that is also “section-sensitive”.

How will you do that, Stuart?

I’m trying to think a way to replace the txp:category_list tag for the frontpage. It doesnt care if it doesnt work “automatically”. I mean, I trying to achieve a category list… hardcoded…

My first approach will be this:
<code>
<ul>
<li><a href=”<txp:section name=“journal” />/?c=<txp:category name=“software” />”><txp:category name=“software” title=1 /></a></li>
<li><a href=”<txp:section name=“journal” />/?c=<txp:category name=“humor” />”><txp:category name=“humor” title=1 /></a></li>
<li><a href=”<txp:section name=“journal” />/?c=<txp:category name=“textpattern” />”><txp:category name=“textpattern” title=1 /></a></li>

</ul>
</code>
Do you think something like that will work?

Also, I have discovered few minutes ago that <txp:category /> supports a section="section name text" attribute :|
So, could the snippet above be replaced by the following?
<code>
<ul>
<li><txp:category name=“software” link=1 title=1 section=“journal” /></li>
<li><txp:category name=“humor” link=1 title=1 section=“journal” /></li>
<li><txp:category name=“textpattern” link=1 title=1 section=“journal” /></li>

</ul>
</code>
What do you think?
Thanks in advance, god of tag combination (me… just a king)

Last edited by maniqui (2006-04-27 03:47:20)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#19 2006-03-29 23:53:52

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: [howto] Make a category listing use the same section and template

Well if I’m not mistaken maniqui, the resulting list will be section-sensitive because the article tag is section-sensitive, assuming that’s what you are using in your page template.

I’ll have to take a closer look at your code but you could use the “if_different” method that I suggested above and specify the section in the article_custom tag if your method doesn’t produce the correct results. Might be less coding too.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#20 2006-04-09 17:07:36

popstalin
New Member
Registered: 2006-04-09
Posts: 4

Re: [howto] Make a category listing use the same section and template

I’m wanting to achieve this with my category_list tag. I have a static index page, which will remain so, therefore, I’d like my category links to be by section (since they aren’t on the index page). Can anyone help?

I’ve tried different methods with the code given in the first post but can’t manage to get it to work correctly.

If you take a <a href=“http://www.popstalin.com/blog/ “>look here</a>, you’ll see what I mean.
(Index page for blog where there are categories and my sections will reside here as well)

Here is the <a href=“http://www.popstalin.com/”>static front page</a>

UPDATE:

I just found the <a href=“http://textpattern.org/plugins/470/”>cbs_category_list</a> plugin that does exactly what I’m looking for.

Last edited by popstalin (2006-04-15 20:34:46)

Offline

#21 2006-07-24 08:31:58

PeterH
Member
Registered: 2006-07-23
Posts: 10

Re: [howto] Make a category listing use the same section and template

Sorry to bring back an old thread, but can you do the same thing with clean URLs?

I tryed <code><a href=”<txp:site_url /><txp:section />/category/<txp:category1 />”><txp:category1 title=1 /></a></code>

But it just returned what you would usually see on: <code><txp:site_url />/<txp:section /></code>

Last edited by PeterH (2006-07-24 08:34:36)

Offline

#22 2006-07-24 14:51:45

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [howto] Make a category listing use the same section and template

Sorry to bring back an old thread, but can you do the same thing with clean URLs?

No.

Offline

#23 2006-09-04 15:10:45

edmungo
Member
Registered: 2006-07-10
Posts: 12

Re: [howto] Make a category listing use the same section and template

I couldn’t get the code above to work at all, so after some fiddling around I’ve found an alternative that does work for the (standard) setup I have:
<code> <a href=”<txp:site_url />index.php?s=<txp:section />&c=<txp:category1 />”><txp:category1 title=1 /></a>
</code>

Last edited by edmungo (2006-09-04 15:29:10)

Offline

#24 2007-08-29 23:49:15

maxvoltar
Member
From: Machelen, Belgium
Registered: 2007-08-16
Posts: 76
Website

Re: [howto] Make a category listing use the same section and template

Hey dudes, sorry to bring this topic back from the grave, but I (as a noob) have a small question:

This is the code on the mainpage of my blog:

<txp:if_category>
<div class="contentblock">
	<h2><txp:category1 link="1" /></h2>
	<ul class="simplelist">
	<txp:article_custom section="blog" limit="999" form="mv_blog_recent" />
	<ul><!-- simplelist -->	
</div><!-- contentblock -->
</txp:if_category>

I now can manipulate TXP’s behaviour when I click a category, but this method keeps displaying all my articles instead of the one I clicked…

Any ideas?


Textpattern projects: Maxvoltar, Made by Elephant, Twunch

Offline

Board footer

Powered by FluxBB