Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
how do i display my portfolio items in different ways?
I’m very new to textpattern (just started this week), but I feel I’m learning pretty quickly and I really need some help trying to figure this out…
I’m making a portfolio site for myself, I have on the portfolio page/section of the site a list of all my projects, there is a category links list at the top so someone can choose different project disciplines. I want to display a searchable list, a categoried list (if a specific category link has been clicked) and a single article. The single article needs to look quite different to the listing – more content and more images. My confusion starts, I think, with the default article template that comes installed with textpattern that I have been “learning” from, as you can see below:
@<txp:if_category> <h2><txp:category title=“1” /></h2>
<div class=“hfeed”>
<txp:article form=“article_listing” limit=“5” />
</div>
<txp:else />
<txp:if_search>
<h2><txp:text item=“search_results” />: <txp:page_url type=“q” /></h2>
<div class=“divider”><img src=”<txp:site_url />images/1.gif” width=“400” height=“1” alt=”—-” title=”“ /></div> </txp:if_search>
<div class=“hfeed”>
<txp:article limit=“5” />
</div>
</txp:if_category>
<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>@
I think I should be using something like this on my portfolio page/section, this is what I have:
@<txp:if_category>
<h2><txp:category title=“1” /></h2>
<div class=“hfeed”>
<h3>Below are all my web projects</h3>
<txp:article form=“portfolio_listing” limit=“3” pageby=“3” pgonly=“0” searchall=“0” searchsticky=“1” sort=“Posted desc” status=“4” time=“any” />
</div>
<txp:else />
<txp:if_search>
<h3><txp:text item=“Search results” />: <txp:page_url type=“q” /></h3>
<txp:article form=“portfolio_listing” limit=“10” pageby=“10” pgonly=“0” searchall=“0” searchsticky=“1” sort=“Posted desc” status=“4” time=“any” />
</txp:if_search>
<div class=“hfeed”>
</div>
</txp:if_category>
<txp:if_individual_article>
<ul class=“prev_next”><li class=“left”>« Previous project: <txp:link_to_prev><txp:prev_title /></txp:link_to_prev></li>
<li class=“right”>Next project: <txp:link_to_next><txp:next_title /> »</txp:link_to_next></li></ul>
<txp:else />
<ul class=“prev_next”><li class=“left”><txp:older>« <txp:text item=“Older projects” /></txp:older></li>
<li class=“right”><txp:newer><txp:text item=“Newer projects” /> »</txp:newer></li></ul>
</txp:if_individual_article>@
Obviously I have added in my own code, namely article_custom in a couple of places. Have I done it correctly? more importantly, is there a better way to display category results, search results and I think, two different article types, one a list and one single?
I hope it’s not too much information to digest, please ask me if you can’t understand my explanation / questions?
Many thanks in advance
Admin Themes Prometheus | Stung | <txp:coder/
My Portfolio | ɹǝpuɐz.com | @MrMartineau
<txp:coder /> – Convert your designs into Textpattern-based websites
jQuery Style | @jquerystyle
Offline
Re: how do i display my portfolio items in different ways?
If you need to use different forms for lists or individual articles use the same <txp:if_individual_article></txp:if_individual_article>
that you are using elsewhere to do something like:-
<txp:if_individual_article>
<txp:article form="individualForm" />
<txp:else />
<txp:article form="listForm" limit="5" />
</txp:if_individual_article>
and create 2 forms with the information that you want to display.
Apart from that you might want to consider giving “Search” it’s own section and thus page template which would reduce some of the confusion with “if” and “else”. Here’s an article about doing that.
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline