Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#13 2011-06-10 06:12:41
- kekskerl
- New Member
- Registered: 2011-06-09
- Posts: 8
Re: problem: articles dont show up
this is what it says in home_links:
<h1>Nächste Veranstaltung</h1>
<txp:chh_if_data>
<txp:article_custom section="termine" sortby="Posted" sortdir="asc" limit="2" form="a_termin" time="future" allowoverride="1" />
<txp:else />
<txp:article_custom status="hidden" form="a_termin" limit="1" sortdir="asc" />
</txp:chh_if_data>
<br />
<h1>Neues aus der Wortstatt</h1>
<txp:article_custom category="startseite" section="info" sortby="Posted" sortdir="desc" limit="1" form="a_home_links" allowoverride="1" />
now as far as i understand, we use the chh_if_date-plugin to be able to sort the events, so we can show a different time and date for the event than the one used by txp. if the event expires, it shows a default article until there is a new event coming up. but somewhat we have lost this functionality :-/
Offline
Re: problem: articles dont show up
Quite a few things have changed since the version you were using and I think they are the cause of the problem:
- Check your syntax for txp:article_custom. The sortby and sortdir has been replaced by a single attribute
sort="Posted asc"
. - I don’t think you can use
status="hidden"
any more (unfortunately). If you are not using sticky articles elsewhere in that particular context, set that article to sticky instead of “hidden” (which also takes it out of the normal “live”-article flow) and you can then refer to it directly withtxp:article_custom id="123" status="sticky" ...
. - You’re confusing if_date with if_data (easily done): the plugin
chh_if_data
checks to see if there is any output, executing the else part if there is none. There are also new ways of doing that now too using txp’s in-builttxp:variable
/txp:if_variable
combo – see below.
Try this:
<h1>Nächste Veranstaltung</h1>
<txp:variable name="future_events" value='<txp:article_custom section="termine" sort="Posted asc" time="future" limit="1">---</txp:article_custom>' />
<txp:if_variable name="future_events" value="">
<txp:article_custom id="123" status="sticky" form="a_termin" />
<txp:else />
<txp:article_custom section="termine" sort="Posted asc" limit="2" form="a_termin" time="future" allowoverride="1" />
</txp:if_variable>
<br />
<h1>Neues aus der Wortstatt</h1>
<txp:article_custom category="startseite" section="info" sort="Posted asc" limit="1" form="a_home_links" allowoverride="1" />
… replacing 123 with the ID for your “no events”-article.
Note the use of single quotes where the article_custom tag is used inside the variable tag (which effectively says “put the result of the contained tag here”). Note too that with if_variable it has become common practice to test for the empty case first (because one doesn’t always know what will be output), which is why the if … else is constructed around the other way here.
The above tests to see if there is at least 1 article in the future. If for some reason you wanted it to test if there are at least 2 future articles, replace limit="1"
with limit="1" offset="1"
in the txp:variable
tag.
Further up you wrote:
this is the complete links-section…
<txp:if_section name=",home">
<txp:output_form form="home_links" />
</txp:if_section>
<txp:if_section name="termine">
<txp:output_form form="termine_links" />
</txp:if_section>
<txp:if_section name="autorInnen">
<txp:output_form form="autorInnen_links" />
</txp:if_section>
...
BTW: you can replace all those if_section tags with a simpler syntax now. Two options:
1) If you have a form for each of those sections you can do this.
<txp:if_section name=",home,termine,autorInnen,info,kontakt,blog,english,presse">
<div id="links_breit">
<txp:output_form form='<txp:section />_links' />
</div>
</txp:if_section>
(Again, note the use of single quotes where the section tag is used inside the output_form tag)
2) Another option is to use rah_output_section_form, except that you will need to change how you name your forms, e.g. links_<section_name> or alternatively patch the plugin to use suffix instead of prefix.
<txp:rah_output_section_form prefix="links_" default="links_default" />
Last edited by jakob (2011-06-10 06:57:33)
TXP Builders – finely-crafted code, design and txp
Online
#15 2011-06-10 07:15:43
- kekskerl
- New Member
- Registered: 2011-06-09
- Posts: 8
Re: problem: articles dont show up
wow, thank you very much! now the sticky finally shows up where it should, that’s already very good.
but i’m still having trouble on getting new events on the homepage. could there be a hick-up with forms, as we seem to have a_termine and termine_links.
a_termin:
<h3><txp:title /></h3>
<h4><txp:custom_field name="Termindatum" /></h4>
<txp:stb_if_article_image_category name="sans-rand">
<div class="artikelbild-sans"><txp:article_image /></div>
<txp:else />
<div class="artikelbild"><txp:article_image /></div>
</txp:stb_if_article_image_category><txp:body />
<txp:if_last_article><txp:else /><hr /></txp:if_last_article>
termine_links:
<txp:chh_if_data>
<txp:article limit="3" form="a_termin" time="future" sortdir="asc" />
<txp:else />
<txp:article_custom status="hidden" form="a_termin" limit="1" sortdir="asc" />
</txp:chh_if_data>
Offline
Re: problem: articles dont show up
I’m not sure how your whole site fits together but my guess is that you’ll need to transfer the same principle I showed above with home_links
to these (any maybe other) forms too.
In the new forms you posted, a_termin
and termine_links
, I can, for example, see status="hidden"
and sortdir="..."
and chh_if_data
… You can change those all in the same way as I did above.
TXP Builders – finely-crafted code, design and txp
Online