Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#13 2009-06-26 16:49:02
- alarius
- Member
- Registered: 2009-05-28
- Posts: 45
Re: Go to Category section from wherever
as I wrote i another post (http://forum.textpattern.com/viewtopic.php?id=31092&p=2#13)
I want a navigation menu on the left like:
Section 1
Section 2
Section 3
Categories
and I would like that:
- selecting “Section 1”, it shows on the content part of the page (center) all the articles of Section 1
- (the same thing for Section2 and Section3)
- selecting “Categories”, it shows all the categories like this:
Section 1:
article 1.1 (linked to the article)
article 1.2 (linked to the article)
Section 2:
article 2.1 (linked to the article)
article 2.2 (linked to the article)
but I’m going mad for this
probably the problem is that I’m not good in english, I’m bad in understanding how txp works and moreover really bad in php… :(
Offline
#14 2009-06-26 19:32:27
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Go to Category section from wherever
Ah OK, that shouldn’t be too hard. Just a couple of questions first:
- selecting “Section 1”, it shows on the content part of the page (center) all the articles of Section 1
Do you want to show a list of full articles, or just links to the individual full articles?
- selecting “Categories”, it shows all the categories like this:
Here I guess that you are not using the expression ‘Categories’ in the sense Txp uses it, am I right? Otherwise I don’t see where categories fit in…
Offline
#15 2009-06-26 20:14:37
- alarius
- Member
- Registered: 2009-05-28
- Posts: 45
Re: Go to Category section from wherever
hi Els, and thankyou for trying to help me…
in my specific example suppose that section represents some dessert, and the categories are the Counrty of production,so the menu wuold show us:
cakes
ice creams
other kinds
………..
show me Countries
well, selecting cakes i should have the complete list of cakes in normal alphabetical list, and the same fore 2 and 3 menu item.
selecting show me Countries I’d like to see a list like this:
—united states—
U.S. cake 1
U.S. cake 2
U.S. ice cream 1
U.S. ice cream 2
—italy—
italian cake 1
italian cake 2
italian cake 3
italian ice cream 1
etc
so I supposed to use txp “sections” as the kind of stuff (section1 is cakes, section2 is icecreams) and assign to every one article a txp category (every Country is a category).
But by your last question I think probably I have to use another method? but please no plugin..
Offline
#16 2009-06-26 20:19:44
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Go to Category section from wherever
Ah thank you, now it all makes sense to me :) No, I don’t think you’ll need a plugin, this looks like a perfectly logical use of Txp. I’ll think of something and post back.
Offline
#17 2009-06-26 20:59:07
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Go to Category section from wherever
OK, here’s how I would do it. Create a section ‘countries’ that you can use to display the articles sorted by country, it can use the same page as your other sections are using. This section will have no articles in it.
This is your navigation menu on the left:
<ul>
<txp:section_list exclude="countries" wraptag="" break="li" />
<li><txp:section name="countries">Show me countries</txp:section></li>
</ul>
The code for the content part of the page (on the page template(s) used for your section pages) can be something like this:
<txp:if_section name="countries">
<h2>Desserts by country</h2>
<txp:category_list sort="title" break="">
<h3><txp:category title="1" /></h3>
<txp:article_custom category='<txp:category />' sort="Title asc" limit="999" wraptag="ul" break="li">
<txp:permlink><txp:title /></txp:permlink>
</txp:article_custom>
</txp:category_list>
<txp:else />
<txp:if_article_list>
<h2><txp:section title="1" /></h2>
</txp:if_article_list>
<txp:article form="your-individual-article-form" listform="your-article-list-form" sort="Title asc" limit="999" />
</txp:if_section>
Offline
#18 2009-06-26 22:02:05
- alarius
- Member
- Registered: 2009-05-28
- Posts: 45
Re: Go to Category section from wherever
sorry Els my example was not good to explain my doubt.
let’s start from the beginnig:
I’ve textpattern like is installed.
I explain with a musical example, a site with only one article for every one artist.
what I need is a main page with the menu on the left where I have:
classical
rock
punk
….
provenience
so, when I select classical, I want to see in the content of site a linkable list of classical artist
so, when I select rock, I want to see in the content of site a linkable list of rock artist
so, when I select punk, I want to see in the content of site a linkable list of punk artist
but if I select “provenience” I’d like to see a list like this:
classical
- mozart
- chopin
- ………
rock
- Eagles
- Fleetwood Mac
- ………
punk
- greenday
- bad religion
- ………
could you explain me how to obtain this modifying the textpattern default models (page/form)?
thnakyou for the patience, if you still have…
Offline
#19 2009-06-26 22:34:20
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Go to Category section from wherever
So it’s not using categories now? Rock, punk etcetera are sections?
Offline
#20 2009-06-26 22:47:06
- alarius
- Member
- Registered: 2009-05-28
- Posts: 45
Re: Go to Category section from wherever
I’m asking you what is the best and simplest way to obtain that lists, so please tell me if I have to use category or section or both
edit:
example, I’m using this part for the page:
<!— left —> <div id=“sidebar-1”> <txp:section_list default_title=’<txp:text item=“home” />’ include_default=“1” wraptag=“ul” break=“li”> <txp:if_section name=’<txp:section />’>»</txp:if_section> <txp:section link=“1” title=“1” /> <txp:if_section name=’<txp:section />’> <txp:article_custom section=’<txp:section />’ wraptag=“ul” break=“li”> <txp:if_article_id>›</txp:if_article_id> <txp:permlink><txp:title /></txp:permlink> </txp:article_custom> </txp:if_section> </txp:section_list> <txp:search_input wraptag=“p” />
</div>
but it shows me the list on the left menu (as submenu) and the plain articles on the content.
i want the menu remains the same (only higlight with active class) and on the content the list
Last edited by alarius (2009-06-26 23:20:52)
Offline
#21 2009-06-26 23:18:04
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Go to Category section from wherever
In your last example you won’t need both sections and categories, so let’s use sections. Using the default Txp installation you can follow these steps:
First create your sections (classical, punk, etcetera), and a section ‘provenience’. Let’s keep it simple and have all your sections use page ‘default’.
Write your articles (don’t put articles in section ‘provenience’).
You can use the existing forms ‘single’ and ‘article_listing’, but if you don’t want to display the posted date with the articles, remove · <span class="published"><txp:posted format="%Y-%m-%d" /></span>
in ‘article_listing’ and <p class="published"><txp:posted /></p>
in ‘single’.
On page template ‘default’, replace the entire <txp:section_list>...</txp:section_list>
part (in sidebar-1
) with this:
<ul>
<txp:section_list exclude="provenience" wraptag="" break="li" />
<li><txp:section name="provenience" title="1" link="1" /></li>
</ul>
In the ‘content’ part of the page, replace <txp:article listform="article_listing" limit="5" />
with:
<txp:if_section>
<txp:if_section name="provenience">
<txp:section_list sort="title" break="">
<h3><txp:section title="1" /></h3>
<txp:article_custom section='<txp:section />' sort="Title asc" limit="999" wraptag="ul" break="li">
<txp:permlink><txp:title /></txp:permlink>
</txp:article_custom>
</txp:section_list>
<txp:else />
<txp:article form="single" listform="article_listing" sort="Title asc" limit="999" />
</txp:if_section>
<txp:else />
This is your front page. I don't know what you want to display here.
</txp:if_section>
Offline
#22 2009-06-26 23:39:49
- alarius
- Member
- Registered: 2009-05-28
- Posts: 45
Re: Go to Category section from wherever
ok,-this seems to work at the moment.
but i have still the submenu in the menu, and I want the same menu everywhere in the site.
after this, how to configure “provenience” to set the article as I told before?
too late for me now, I’m tired and not sure what I’m dooing…
I’l try it better tomorrow.
thankyou for the moment!
Last edited by alarius (2009-06-26 23:43:37)
Offline
#23 2009-06-29 11:03:30
- alarius
- Member
- Registered: 2009-05-28
- Posts: 45
Re: Go to Category section from wherever
there is something doesn’t work as I want…
i made some changes, and I have now this code:
<div id="sidebar-1">
<txp:section_list sort="title asc" default_title='<txp:text item="home" />' include_default="1" exclude="provenience"
wraptag="ul" break="li">
<txp:if_section name='<txp:section />'>»</txp:if_section>
<txp:section link="1" title="1" />
<txp:if_section name='<txp:section />'>
<txp:article_custom section='<txp:section />' wraptag="ul" break="li">
<txp:if_article_id>›</txp:if_article_id>
</p>
</txp:article_custom>
</txp:if_section>
</txp:section_list>
</div>
<!-- right -->
<div id="sidebar-2">
<txp:category_list label="Categories" sort="title asc" this_section="0" type="article" />
</ul>
<!-- center -->
<div id="content">
<txp:if_article_list><h1><txp:section title="1" /></h1></txp:if_article_list>
<div class="hfeed">
<txp:article listform="article_listing" limit="5" />
</div>
<txp:if_individual_article>
<div class="divider"><img src="<txp:site_url />images/1.gif" width="400" height="1" alt="---" title="" /></div>
<p><txp:link_to_prev>« <txp:prev_title /></txp:link_to_prev>
<txp:link_to_next><txp:next_title /> »</txp:link_to_next></p>
<txp:else />
<p><txp:older>« <txp:text item="older" /></txp:older>
<txp:newer><txp:text item="newer" /> »</txp:newer></p>
</txp:if_individual_article>
</div>
the problem is that now I have my menu on the left, working but not at all (it outputs the “list” of the section on the central part, but the menu takes one white “space” after the current section and the next for every one article, so if section 2 has 3 articles the menu became like this:
section1
section2
__________(white space)
__________(white space)
__________(white space)
section3
and this is no good,I’d like the menu remain the same every time.
on the right menu I have the list of category but it seems not work at the time…
if i put
this_section="0"
it goes on home page any “category” i select.
if I put
this_section="1"
it outputs that category in the current section.
so if it’s possible, id like to view all articles of all sections about one category.
if it’s no possible, I’ll keep with the value “1”, but I’d like at least have both the “current“section and the “current” category higlighted, for example with a yellow background.
at this time only the current section is evident with the symbol “>>”, but I’m searching the way to remove that simbol (I thing is ») and have the yellow background…
(edit: How do I post tags and code on the forum? -Els)
(edit: sorry Els, it seemed to me it was correctly viewed -alarius)
Last edited by alarius (2009-06-30 08:36:48)
Offline
#24 2009-06-30 10:40:43
- alarius
- Member
- Registered: 2009-05-28
- Posts: 45
Re: Go to Category section from wherever
I think my “musical” example was in fact not what I need,
probably I was really tired that night, so please clear about it and let’s try to find a solution for the last post…
there is something wron on my code, or probably I have not understood well how txp works.
if I have three articles on section 2, when I select section 2,
it outputs the list with links of the three articols in the content part of the page
(and this IS what I want)
but the menu seems to be influenced by the number of articles, and in fact the menu expands out of three lines
(and thi is NOT good for me, I need the menu “compact”)
some help? (and sorry again)
Offline