Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-06-29 22:45:35

dimfish
Member
Registered: 2006-06-01
Posts: 72

General guidance on static site structure

OK.
I’ve been posting the odd specific message but not really getting anywhere so just before I get my head down for the night I thought I’d try my luck asking for some general advice.

I’m trying to do a static site..At the moment this is what I have
It is not how I’d like : (

What I’d like to know is: How would the smart TXP gurus out there tackle it?

I’d like:
Top level nav (sections)
2nd level nav (categories, ordered to my choosing, not alphabetically)
3rd level nav (articles, sometimes just one article per cat, sometimes several)…

I’d like so that when you first visit a section you are presented with the cat list in the side bar for that section, plus in the main content the article from the first category in the list, and if there are several in that cat, then you are presented with a landing page of title/excerpt/read more link. I’d like to style up current sections and categories.

Here’s how I am doing it currently, with problems:
Top level: Ako_nav (fine)
2nd level: cbs_category_list (ok, but I can’t order it how I’d like)
3rd level: I can figure out how to get the full article to show if there is just one art in the cat, and titles/excerpts if more than 1.

Styling current sections in top nav is ok. Current category styling doesn’t work when you land, only when you actually select a cat in the list.

So…. How would you guys do it?
Would you structure it differently, use different plugins, etc…que….? (I’ve tried doing it with sticky articles in the sidebar instead of cats, but it didn’t seem to work for me).

I’d really like to know if I am on the right track, or if there is a way people out there achieve this kind of site that I just don’t know about…..!

Thanks indeed people. I would love to get my head round this.

Offline

#2 2006-06-30 02:02:25

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

Re: General guidance on static site structure

If you use Category1 as your category, I think (I haven’t tested it) the following will work. Put this into a new article form:

<txp:if_first_article>

	<txp:if_last_article>

		<!-- we've got an article which is both the first and last article, -->
		<!-- which means there's only one -->

		<txp:title />

		<txp:body />

	<txp:else />

		<!-- there's a list, and this is the first one, -->
		<!-- so include the category title -->

		<txp:category1 title="1" />

		<txp:excerpt />

		<p><txp:permlink>Read more…</txp:permlink></p>

	</txp:if_last_article>

<txp:else />

	<!-- there's a list, and this isn't the first article -->

	<txp:title />

	<txp:excerpt />

	<p><txp:permlink>Read more…</txp:permlink></p>

</txp:if_first_article>

:)

Last edited by Mary (2006-06-30 02:07:02)

Offline

#3 2006-06-30 10:08:33

dimfish
Member
Registered: 2006-06-01
Posts: 72

Re: General guidance on static site structure

Thanks for you help Mary. It is kind of working
Except that when you first land in a section is shows all articles in a list rather than the first article only, and doesn’t show excerpts but article body in full. Once you start clicking in the category list is seems to work.

My form is as you suggest (form name ‘artorlist’). In my page the following:

<code>
<txp:output_form form=“artorlist” />
<txp:article />
</code>

Is that right? I thought I wouldn’t need to put <code><txp:article /></code> in but if I don’t no articles display at all.

Any further thoughts?

Thanks for any more help Mary. Really appreciate it.

Offline

#4 2006-07-01 12:24:12

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

Re: General guidance on static site structure

You’d do something like:

make another form and put in it how you want the article displayed if you land on the section front page. In your page:

<txp:if_category>

	<!-- we're looking at a category list -->
	<txp:article form="artorlist" />

<txp:else />

	<!-- we're looking at the section list -->
	<txp:article limit="1" form="your_section_form" />

</txp:if_category>

:)

Last edited by Mary (2006-07-01 12:24:23)

Offline

#5 2006-07-01 22:19:11

dimfish
Member
Registered: 2006-06-01
Posts: 72

Re: General guidance on static site structure

Thanks Mary. That’s working out just fine.
Great stuff.

One other thing you might be able to help with is that I can’t get the active category in the sidebar list to show with active styling when you first land in that section, only when you first click on a category in the list. Similar situation when you are on a category page with title/excerpt listing….when you choose an article from there, the active styling is lost when the article is displayed.

Any ideas?

Thanks.

Offline

#6 2006-07-02 18:06:48

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

Re: General guidance on static site structure

That’s because when you first land on the section page, you aren’t technically in a category yet. I think you might be able to fix that by:

page, place just above your category list:

<txp:article limit="1" form="set_category" />

form: set_category

<txp:php>global $c, $this_article; $c = $thisarticle['category1'];</txp:php>

Not sure if that’ll work, but you can give it a go.

Offline

#7 2006-07-13 22:38:13

dimfish
Member
Registered: 2006-06-01
Posts: 72

Re: General guidance on static site structure

HI Mary,
Still picking this up?
I couldn’t get your method to work. I put:
<txp:article limit="1" form="set_category" />
in my page, above the output_form that gets my category list.

Any other ideas?

(Edit: updated your code so it would display properly. :) -Mary)

Last edited by Mary (2006-07-14 00:19:07)

Offline

#8 2006-07-14 01:12:04

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

Re: General guidance on static site structure

I just tested it out and it works for me, so it must be where things are getting placed. Can you show what you’re using, exactly?

Offline

#9 2006-07-14 07:59:23

dimfish
Member
Registered: 2006-06-01
Posts: 72

Re: General guidance on static site structure

Excellent. Thanks Mary.
My category list is output in my sidebar by form subnavmenu2, so I put it in the page above that:

<code>
<div id=“sidebar-1”>
<txp:article limit=“1” form=“set_category” />
<txp:output_form form=“subnavmenu2” />

</div>
</code>

Here’s subnavmenu2:
<code>
<div id=“navlist2”>
<txp:cbs_category_list title=1 wraptag=“ul” break=“li” activeclass=“active” />
</div>
</code>

And I have set_category as you said:
<code>

<txp:php>global $c, $this_article; $c = $thisarticle[‘category1’];</txp:php>
</code>

Any clues to my foolishness there?!

Offline

#10 2006-07-14 19:09:13

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

Re: General guidance on static site structure

Hmm, that should work. Let’s see something.

<div id="sidebar-1">

<!-- <txp:category /> -->

<txp:article limit="1" form="set_category" />

<!-- <txp:category /> -->

<txp:output_form form="subnavmenu2" />

<!-- <txp:category /> -->
</div>

Save it, then reload the page. View source, and see what gets output.

Offline

#11 2006-07-15 09:48:31

dimfish
Member
Registered: 2006-06-01
Posts: 72

Re: General guidance on static site structure

Thanks Mary.
Here’s the page that is output

Last edited by dimfish (2006-07-15 09:50:10)

Offline

#12 2006-07-16 02:29:21

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

Re: General guidance on static site structure

It looks like <txp:article limit="1" form="set_category" /> is not using that form, but your regular form. Do you happen to be using an override form on that article?

Offline

Board footer

Powered by FluxBB