Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-03-01 16:50:18
- aeris
- Member
- Registered: 2009-03-01
- Posts: 12
noob questions: navigation (menu/submenu), index title
1. I want index page title to be something like Mysite-Slogan. How do I limit the slogan (or any text) to that page?
2. What’s the best way of making a navigable website? Like most people, I want something like this:
1 writing (section)
1a poetry (category)
1b essays
1c fanfic
2 information
2a about
2b contact
When one clicks on writing, a submenu (information: about contact) appears and is visible throughout the section so you can jump straight from eg. poetry to essays. Only this has worked:
1 information (section)
1a information (category)
1aa about (subcategory)
1ab contact
And then in page template: if_category name=“information”, …“about” and …“contact”. But if I start doing it this way, I need 23 if-lines. Making a form or template for each category is essentially the same (though templates would probably be simplest). While writing this, I toyed with sectionlist+breadcrumb. But I’m still missing that vital one level.
Offline
Re: noob questions: navigation (menu/submenu), index title
- Just put it on that page :) If you use one page for multiple sections you could contain the tags in
<txp:if_section>
instead
TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX
Offline
Re: noob questions: navigation (menu/submenu), index title
TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX
Offline
#4 2009-03-01 21:09:40
- aeris
- Member
- Registered: 2009-03-01
- Posts: 12
Re: noob questions: navigation (menu/submenu), index title
Put what on what page? You mean make different templates for all sections, and add a static submenu to each? That’s probably the only way, but I don’t like it since all my pages look the same. Or put the entire list in the same place? That’s what I’m trying now, there are 30 links so I have to work to make it look good and not messy :)
Oh, and I though it’s slower to use server-side script to fetch a link list if you have to write a different one for every section/category. Am I wrong?
Is this
<ul>
<txp:section wraptag=“li” link=1 title=1 name=“about” />
<txp:section wraptag=“li” link=1 title=1 name=“articles” />
<txp:section wraptag=“li” link=1 title=1 name=“news” />
<txp:section wraptag=“li” link=1 title=1 name=“contact” />
</ul>
better than this
<ul>
<li><a href=“index.php?s=about”>about</a></li>
<li><a href=“index.php?s=article”>article</a></li>
<li><a href=“index.php?s=news”>news</a></li>
<li><a href=“index.php?s=contact”>contact</a></li>
</ul>
Offline
Re: noob questions: navigation (menu/submenu), index title
aeris wrote:
Put what on what page? You mean make different templates for all sections, and add a static submenu to each? That’s probably the only way, but I don’t like it since all my pages look the same. Or put the entire list in the same place? That’s what I’m trying now, there are 30 links so I have to work to make it look good and not messy :)
What I gathered from your question was that you wanted to display <txp:site_name />
& <txp:site_slogan />
only on the default page. So in case you had a page per section you’d only have to put it in the default page. If you’re rendering several sections using a single page, you could target the default section by using
<txp:if_section name="default">
<txp:site_name /><txp:site_slogan />
</txp:if_section>
Is this
<ul>
<txp:section wraptag=“li” link=1 title=1 name=“about” />
<txp:section wraptag=“li” link=1 title=1 name=“articles” />
<txp:section wraptag=“li” link=1 title=1 name=“news” />
<txp:section wraptag=“li” link=1 title=1 name=“contact” />
</ul>better than this
<ul>
<li><a href=“index.php?s=about”>about</a></li>
<li><a href=“index.php?s=article”>article</a></li>
<li><a href=“index.php?s=news”>news</a></li>
<li><a href=“index.php?s=contact”>contact</a></li>
</ul>
why not use <txp:section_list break="li" wraptag="ul" />
also if you’re going to reuse chunks of code on several pages, you should put them in a form and reference the form. <txp:output_form />
for more info on the tags: check out the tags reference
TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX
Offline
#6 2009-03-01 22:15:11
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: noob questions: navigation (menu/submenu), index title
aeris wrote:
Is this (…) better than this (…)
Two small notes in addition to what JanDW said:
- you need quotes around attributes’ values:
link="1" title="1"
- if the reason you were more or less hard coding your section menu was that you want to keep control over the order, you can also do that with section_list:
<txp:section_list sections="about,articles,news,contact" />
Offline
#7 2009-03-02 07:17:04
- aeris
- Member
- Registered: 2009-03-01
- Posts: 12
Re: noob questions: navigation (menu/submenu), index title
Thank you guys!
I didn’t know you could add different category names to category_list, but it is possible. This way it’s not too much code.
<txp:if_category>
<p>
<txp:if_category name=“writing, poetry, essays, fanfic”>
viewing: writing
subcategories:
<txp:category_list parent=“writing” exclude=“writing” break=” “ />
</txp:if_category>
etc.
</p>
</txp:if_category>
And I forgot that index page is the same as default section. My site is currently down so can’t test it, but I think <txp:page_title /><txp:if_section name=“default”> <txp:site_slogan /></txp:if_section> will work. Any other way will mess up name, path and/or slogan.
Edit: No, you need an else <txp:page_title /><txp:if_section name=“default”>: <txp:site_slogan />*<txp:else />*</txp:if_section>
- you need quotes around attributes’ values:
link="1" title="1"
I know :) I copied it from the link and didn’t think twice. What I meant was, does using txp tags in this case have any advantage (loading speed, server load) over simple html? For example, my site uses the same template all over. Should I still create forms for header, sidebar, content and footer, or only use tags when they’re absolutely necessary?
Last edited by aeris (2009-03-02 07:33:10)
Offline
#8 2009-03-03 13:04:53
- aeris
- Member
- Registered: 2009-03-01
- Posts: 12
Re: noob questions: navigation (menu/submenu), index title
Another problem:
<txp:article limit=“5”>
(heading and post info)
<txp:if_individual_article>
<txp:body />
<txp:else />
<txp:if_article_list>
<txp:if_excerpt><txp:excerpt /><p><txp:permlink>Read More…</txp:permlink></p>
<txp:else /><txp:body /></txp:if_excerpt>
</txp:if_article_list>
</txp:if_individual_article>
</txp:article>
I’ve tried other ways, but the individual article page always has a duplicate. One using the default form, then another below it looking like it should. How do I get rid of the default form?
I wrote “should not see this” in it so I know when I see it.
edit: Tried removing body from <txp:if_individual_article>, but didn’t make any difference.
edit2: Now a lot of things have stopped working.
this shows a list:
<txp:category_list wraptag=“p” children=“0” exclude=“art” break=“br” />
this shows blank:
<txp:category_list wraptag=“p” children=“0” exclude=“art” sort=“life,web,fun,guides,goodies” break=“br” />
if viewing a category, this shows Sitename – Category – Slogan:
<title><txp:page_title separator=” | “ /><txp:if_section name=“default”> | <txp:site_slogan /><txp:else /></txp:if_section></title>
<txp:if_section name=“default”>The quick brown fox
<txp:else />Jumps over a lazy dog</txp:if_section>
Same here, “The quick brown fox” shows up on index page, but category pages say “The quick brown foxJumps over a lazy dog”. The individual article page has 1. “should not see this” & comment form 2. Jumps over a lazy dog 3. title & other info & comment form.
I installed rss_admin_db_manager and clicked “repair all”. Could it have something to do with it?
Last edited by aeris (2009-03-03 14:56:32)
Offline
#9 2009-03-03 16:35:27
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: noob questions: navigation (menu/submenu), index title
aeris wrote:
<txp:if_individual_article>
<txp:body />
<txp:else />
<txp:if_article_list>
<txp:if_excerpt><txp:excerpt /><p><txp:permlink>Read More...</txp:permlink></p>
<txp:else /><txp:body /></txp:if_excerpt>
</txp:if_article_list>
</txp:if_individual_article>
You don’t need if_article_list there:
<txp:if_individual_article>
<txp:body />
<txp:else /><!-- this *is* an article list -->
<txp:if_excerpt><txp:excerpt /><p><txp:permlink>Read More...</txp:permlink></p>
<txp:else /><txp:body /></txp:if_excerpt>
</txp:if_individual_article>
this shows blank:
<txp:category_list wraptag="p" children="0" exclude="art" sort="life,web,fun,guides,goodies" break="br" />
The sort attribute is not used like that:
<txp:category_list wraptag="p" children="0" categories="life,web,fun,guides,goodies" break="br" />
if viewing a category, this shows Sitename – Category – Slogan:
<title><txp:page_title separator=" | " /><txp:if_section name="default"> | <txp:site_slogan /><txp:else /></txp:if_section></title>
You don’t need a <txp:else />
if you don’t have anything after it. It’s showing the category because that’s what <txp:page_title /> does.
I installed rss_admin_db_manager and clicked “repair all”. Could it have something to do with it?
No, I’m sure it’s just incorrect tag use :) Textbook is your friend!
Offline
#10 2009-03-03 17:43:09
- aeris
- Member
- Registered: 2009-03-01
- Posts: 12
Re: noob questions: navigation (menu/submenu), index title
Okay, now everything works * phew *. Except if_section.
Would you be so kind and tell me what’s wrong with this (just one more, I swear =)):
<txp:if_section name=“default”>The quick brown fox</txp:if_section>
<txp:if_category name=“life,me,memes,pictures,thoughts”>viewing: life subcategories: <txp:category_list parent=“life” exclude=“life” break=” “ /></txp:if_category>
Looks like this on category pages: The quick brown foxviewing: life … Also tried if_section – else – if_category, but then The quick brown fox was everywhere. I’ve checked and double-checked that all tags are closed etc.
Now that I think about it, I could try if_category – else.
Oh, and title looks like this: Sitename: Categoryname: Slogan. It’s correct on individual article pages, though (Sitename: Title)
Edit: I tried, and it works. Navmenu shows on category pages, text string elsewhere.
Last edited by aeris (2009-03-03 17:54:09)
Offline
#11 2009-03-04 11:07:00
- aeris
- Member
- Registered: 2009-03-01
- Posts: 12
Re: noob questions: navigation (menu/submenu), index title
If anyone else is wondering about this, it doesn’t seem possible to restrict something to default section with one rule only.
Showing slogan on index page only:
<title><txp:page_title /><txp:if_category><txp:else /><txp:if_section name="default"> <txp:site_slogan /></txp:if_section></txp:if_category></title>
Getting one thing to show on index page, another on category pages and nothing on individual article pages:
<txp:if_individual_article>(single-article view)
<txp:else />
<div id="tnav" class="navbar"><p>
<txp:if_category>
(all category lists)
</txp:if_category>
<txp:else />
(default section)
</txp:if_category>
</p></div>
</txp:if_individual_article>
Offline
#12 2009-03-04 18:08:17
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: noob questions: navigation (menu/submenu), index title
aeris wrote:
it doesn’t seem possible to restrict something to default section with one rule only.
That only depends on how you’ve set up your site structure. If you don’t tell them otherwise, category and search results pages use the default section, so in that case you are right, <txp:if_section name="default">
will still be true for all these situations. But you can just as well display category and search pages on their own section page(s), in which case your remark would not be correct. Therefore it is always wise to try and mention all relevant info in your post when asking for advice :)
Offline