Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2011-11-02 21:04:02
- elwins
- Member
- From: Latvia
- Registered: 2011-08-29
- Posts: 80
if_category
Maybe someone can help me with if_category function?
Problem description:
I have category, with 50 subcategories, all of them are under one section, that works fine….
Section: Offer
Category: CatOffer
Subcategories: Cat1, Cat2, Cat3, …., Cat50
When I open SectionOffer (and automatically opening CatOffer category) I can see all my 50 categories in right side, in center I have article block, where I Just need a list off articles from subcategories, but there are only full articles, but when I open Subcategory, then all are Okey.
<div id="content_wrap">
<txp:if_category>
<txp:article form="pak_rakstu_saraksts" limit="25" />
<txp:else />
<txp:if_search>
<h4><txp:text item="search_results" />: <txp:page_url type="q" /></h4>
</txp:if_search>
<txp:if_category name="pakalpojumi">
<txp:article form="pak_rakstu_saraksts" limit="25" />
</txp:if_category>
<txp:article limit="5" />
</txp:if_category>
</div>
FORM pak_rakstu_saraksts
<div id="content">
<h4><txp:title /></h4>
<div class="textbox">
<table id="noborder">
<tr>
<td class="tab">Adrese:</td>
<td><txp:custom_field name="Adrese" /></td>
</tr>
<tr>
<td class="tab">Telefona numurs:</td>
<td>
<table><tr>
<td><txp:custom_field name="Telefona numurs" /></td>
<td><txp:custom_field name="Telefona numurs 2" /></td>
<td><txp:custom_field name="Telefona numurs 3" /></td>
</tr></table>
</td>
</tr>
<tr>
<td class="tab">E-pasts:</td>
<td><a href="mailto:<txp:custom_field name="E-pasts" />"><txp:custom_field name="E-pasts" /></a></td>
</tr>
<tr>
<td class="tab">WEB adrese:</td>
<td><a href="http://<txp:custom_field name="WEB lapa" />"><txp:custom_field name="WEB lapa" /></a></td>
</tr>
</table>
<table>
<tr>
<td><b>Darba laiks:</b></td>
<td><span class="dl"><txp:custom_field name="Pirmdiena" /></span>
<span class="dl"><txp:custom_field name="Otrdiena" /></span>
<span class="dl"><txp:custom_field name="Trešdiena" /></span>
<span class="dl"><txp:custom_field name="Ceturtdiena" /></span>
<span class="dl"><txp:custom_field name="Ceturtdiena" /></span>
<span class="dl"><txp:custom_field name="Piektdiena" /></span>
<span class="dl"><txp:custom_field name="Sestdiena" /></span>
<span class="dl"><txp:custom_field name="Svētdiena" /></span></td>
</tr>
</table>
</div></div>
<div id="content">
<h4>Pakalpojuma apraksts</h4>
<div class="textbox">
<div id="social">
<iframe allowtransparency="true" frameborder="0" scrolling="no"
src="//platform.twitter.com/widgets/follow_button.html?screen_name=<txp:custom_field name="Twitter.com" />&lang=lv"
style="width:62px; height:20px;"></iframe>
</div>
<div id="social">
<iframe src="//www.facebook.com/plugins/like.php?href=<txp:custom_field name="WEB lapa" />&send=false&layout=button_count&width=450&show_faces=false&action=like&colorscheme=light&font&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:73px; height:21px;" allowTransparency="true"></iframe>
</div>
<div id="social">
<iframe height="20" width="84" frameborder="0" src="http://www.draugiem.lv/say/ext/like.php?title=<txp:title />&url=http://<txp:custom_field name="WEB lapa" />&titlePrefix=<txp:title />"></iframe>
</div>
<txp:custom_field name="Plus.google.com" />
<txp:body />
</div></div>
<div id="content">
<h4>Īpašie piedāvājumi</h4>
<div class="textbox">
<txp:excerpt />
</div>
</div>
<div id="content">
<h4>Fotogalerija</h4>
<div class="textbox">
<txp:images category='<txp:custom_field name="Fotogalerijas nosaukums" />' class="thumbs noscript" wraptag="ul" break="li">
<a class="thumb" name="<txp:image_info type="name"/>" href="<txp:image_url/>"><txp:thumbnail/></a>
</txp:images>
</div>
</div>
<div id="content">
<h4>Karte</h4>
<div class="textbox">
<txp:custom_field name="Maps.google.lv" escape="" />
</div>
</div>
(added bc..
’s for better code display. -Els)
Last edited by els (2011-11-02 22:25:39)
Offline
#2 2011-11-02 22:38:24
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: if_category
Is this what you need? Not sure I understand exactly what it is you are after.
<txp:if_category>
<!-- (sub)category page -->
<txp:article form="pak_rakstu_saraksts" limit="25" />
<txp:else />
<txp:if_search>
<!-- search results page -->
<h4><txp:text item="search_results" />: <txp:page_url type="q" /></h4>
<txp:article />
<txp:else />
<!-- section landing page or individual article page -->
<txp:article limit="5" />
</txp:if_search>
</txp:if_category>
I left out the <txp:if_category name="pakalpojumi">
part, because the article tag in there is the same as the first article tag. Not sure what it’s meant to do different.
Last edited by els (2011-11-02 22:39:50)
Offline
#3 2011-11-03 12:41:11
- elwins
- Member
- From: Latvia
- Registered: 2011-08-29
- Posts: 80
Re: if_category
I wanted to use <txp:if_category exclude=“pakalpojumi”> wat should be perfect, but if_category command dont support exclude function.
All what I want to get is a list of articles, in main page of section, but I get only full articles.
Corections, I think, should be made in this code:
<!-- section landing page or individual article page -->
<txp:article limit="5" />
because it showing articles, when I delete it and copy in list code, all working, exept, I cant open full article, because article code isn’t, so need some IF functions to get list, when it need(in opened section main page), and full article, when I press on some title in list.
edit:
one of if_article function maybe usable…
Last edited by elwins (2011-11-03 12:58:08)
Offline
#4 2011-11-03 20:09:36
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: if_category
elwins wrote:
I wanted to use <txp:if_category exclude=“pakalpojumi”> wat should be perfect, but if_category command dont support exclude function.
<txp:if_category name='<txp:category_list break="," exclude="pakalpojumi"><txp:category /></txp:category_list>'>
your code here
</txp:if_category>
or
<txp:if_category name="pakalpojumi">
<!-- do nothing -->
<txp:else />
your code here
</txp:if_category>
when I delete it and copy in list code, all working, exept, I cant open full article, because article code isn’t, so need some IF functions to get list, when it need(in opened section main page), and full article, when I press on some title in list.
You can do this:
<txp:article form="pak_rakstu_saraksts" listform="form-with-list-code" limit="5" />
It will use the form
for individual article pages and listform
for article lists.
Last edited by els (2011-11-03 20:11:59)
Offline
#5 2011-11-03 20:29:20
- elwins
- Member
- From: Latvia
- Registered: 2011-08-29
- Posts: 80
Re: if_category
<txp:article form="pak_rakstu_saraksts" listform="form-with-list-code" limit="5" />
This works perfectly! Big thanks! :)
Offline
Pages: 1