Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-07-20 19:17:20

sams101
Member
Registered: 2009-11-09
Posts: 23

Simple one (semantic I think)

I think I’m on the right lines but would love a little input on this subject.

I have a portfolio site with 3 sections. Homepage, Work, Blog.

Easy enough… Now on my homepage I am using the txp article_custom tag with the category set as ‘portfolio’ all pieces of work will have this category (along with other specific categories i.e ‘website’ ‘logo’ ‘illustration’). My question is:

Does each type of work in my portfolio section need its own ‘section’ and own ‘page’ ?

I’m a little confused as to how I should structure it/call the individual categories when i only want to display ‘logos’ for example.

Any feedback would be most appreciated. I’m sure I must be missing something obvious here!

Offline

#2 2010-07-20 19:27:18

kritoke
Member
From: Florida
Registered: 2010-07-19
Posts: 26

Re: Simple one (semantic I think)

You really do not need to have a separate page for each. I actually have several different sections that are fed by just one page, I do a if_section command and then put in the needed code. I think you could just as easily use the if_category command to achieve the same results.

Offline

#3 2010-07-20 20:25:12

sams101
Member
Registered: 2009-11-09
Posts: 23

Re: Simple one (semantic I think)

Hi Kritoke,

Interesting. So how would I go about linking to or displaying a particular category within the same page? (just trying to get my head around how this works).

Really appreciate your assistance though.

Offline

#4 2010-07-20 20:48:37

kritoke
Member
From: Florida
Registered: 2010-07-19
Posts: 26

Re: Simple one (semantic I think)

This is a very basic structure, also note that by doing this, you may take a performance hit rather than having individual pages for each section (versus doing everything as a category driven in one page using if conditionals), it just kind of depends on the size and scope of the site. I have never done a category driven site, but this is the code I would assume should work for it. Also, what I find very useful is abstracting out each common set of code to a form and referencing it like <txp:output_form form="header" /> for my header, footer, etc. An additional note, this code does not check to see if it is in more than one category, if you are in more than one category, then it will output two pages. I am doing this from memory, but I think it should be alright:

<!-- insert usual header code from <html><head> all the way to </head> -->
<txp:if_section name=",default">
<body id="home">
<!-- insert relevant stuff for your front page -->
<txp:else />
<body id="<txp:category />">
<txp:if_category name="website">
<!-- insert relevant stuff for your website pages -->
</txp:if_category>
<txp:if_category name="logo">
<!-- insert relevant stuff for your logo pages -->
</txp:if_category>
<txp:if_category name="illustration">
<!-- insert relevant stuff for your illustration pages --
</txp:if_category>
</txp:if_section>
</body>
</html>

Last edited by kritoke (2010-07-20 20:51:42)

Offline

#5 2010-07-20 21:02:31

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Simple one (semantic I think)

From reading your post about pagination I think I have a better idea of what you’re after. article_custom is static — it shows the same content no matter the URL (that is, assuming it is on the page template for that URL). You should explore the basic article tag, especially how it works on the home page. You should be able to come up with templates that won’t require you to assign the same category to every article in a section, as you are doing now.

A few questions for you:

How should the home page be different from the “work” section front page? In particular, what articles should appear by default on each?

Do you want “work” and “blog” to be completely separate, or do you want some crossover? In particular, will the two sections share any categories, and do you want to allow a user to search both sections at once?


Code is topiary

Offline

#6 2010-07-20 21:02:37

sams101
Member
Registered: 2009-11-09
Posts: 23

Re: Simple one (semantic I think)

Wow, you didn’t need to go as far as to write all that out, but thanks a lot!

Yeah I have been grouping all my code into forms. That’s probably the only bit I haven’t struggled with!

So with code similar to this in place, I’m guessing I need to highlight what category I want visible on the page via a special link to itself? (is that correct, if so, don’t suppose you could give me an example link code? – I can research it once I know how it should work though!).

Offline

#7 2010-07-20 21:08:04

kritoke
Member
From: Florida
Registered: 2010-07-19
Posts: 26

Re: Simple one (semantic I think)

Once you have articles made in each category, you just link to the category and it should give you a list if you use if_article_list in the sample code above for whichever category you are using.

To link to each category, you could use this: <txp:category title="1" link="1" name="category name" />
This displays the category title in the nice form, makes a link to it, and the name attribute will link to that category rather than the current category that is default.

Last edited by kritoke (2010-07-20 21:10:55)

Offline

#8 2010-07-20 21:49:06

sams101
Member
Registered: 2009-11-09
Posts: 23

Re: Simple one (semantic I think)

Excellent. I shall have a play with it now I understand it a whole lot better.

Thanks for your patience and support!

Offline

Board footer

Powered by FluxBB