Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: New to TXP 4.54 - Making a Frontpage
Hi
can you remove txp:an7_filter and change txp:article_custom into code like that:
<txp:article sort="posted desc" limit="3">
<h3><txp:title /></h3>
<txp:excerpt />
</txp:article>
and see if that works?
Offline
#26 2013-03-04 13:45:47
- gour
- Member
- From: Hlapičina, Croatia
- Registered: 2013-01-17
- Posts: 124
Re: New to TXP 4.54 - Making a Frontpage
Dragondz wrote:
and see if that works?
Putting that snippet into my ‘homepage’ page results in no article displayed. :-/
Offline
Re: New to TXP 4.54 - Making a Frontpage
Article are set to use wich section?
Offline
#28 2013-03-04 20:38:23
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: New to TXP 4.54 - Making a Frontpage
Hi gour, are you aware of the tag trace? It will very likely give you some pointers. If you find it difficult to read, you can post it here and we can have a look.
Offline
#29 2013-03-04 22:16:16
- gour
- Member
- From: Hlapičina, Croatia
- Registered: 2013-01-17
- Posts: 124
Re: New to TXP 4.54 - Making a Frontpage
Els wrote:
Hi gour, are you aware of the tag trace? It will very likely give you some pointers.
Not at all. This is something new for me. Thank you for mentioning it!!
If you find it difficult to read, you can post it here and we can have a look.
Probably I do atm…Here is the pastebin link which is generated for this URL which is empty although there should be several articles listed.
Any clue?
p.s. I’m using pastebin instead of cluttering forums with longer code-blocks, is it OK?
Offline
#30 2013-03-04 23:47:01
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: New to TXP 4.54 - Making a Frontpage
gour wrote:
Any clue?
It appears that the section your articles are in (blog) is not set to be displayed on the front page (see section settings). Though it might not seem apparent at first sight, category pages use the front page by default (URL like /category/category-name).
If the articles are displayed on their own section page (/section-name/?c=category-name), the articles will be displayed. See http://atmarama.sites.djangohosting.ch/blog/?c=novosti.
You can create links like that by using the section
attribute in the category links.
Either that, or set section ‘blog’ to be displayed on the front page. Whichever you prefer.
p.s. I’m using pastebin instead of cluttering forums with longer code-blocks, is it OK?
Personally I prefer seeing the code in the forum posts. It saves me some clicking around, so I don’t see it as ‘cluttering’ the forum :) Also, I don’t think code on pastebin can live there forever. If someone reads this thread a year from now, it won’t be very helpful anymore without the code.
P.S. For your information, here is the part of the tag trace that shows it’s only looking for articles in sections that are set to be displayed on the front page:
[SQL (0.0011441707611084): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('novosti') or Category2 IN ('novosti')) and Section != 'blog' and Section != 'default' and Section != 'o-nama' and Section != 'arhiva' and Section != 'kontakt' order by Posted desc limit 0, 5]
Last edited by els (2013-03-04 23:54:55)
Offline
#31 2013-03-05 07:42:39
- gour
- Member
- From: Hlapičina, Croatia
- Registered: 2013-01-17
- Posts: 124
Re: New to TXP 4.54 - Making a Frontpage
Els wrote:
It appears that the section your articles are in (blog) is not set to be displayed on the front page (see section settings).
That’s correct ‘cause I assumed it would clutter my front page…(I still have to put together some pieces how Txp works.).
Though it might not seem apparent at first sight, category pages use the front page by default (URL like /category/category-name).
It’s definitely not obvious and I do not recall reading about it somewhere. Thank you!
If the articles are displayed on their own section page (/section-name/?c=category-name), the articles will be displayed. See http://atmarama.sites.djangohosting.ch/blog/?c=novosti.
But in this case I get all the articles displayed, not just those belonging to ‘novosti’ category?
Either that, or set section ‘blog’ to be displayed on the front page. Whichever you prefer.
For now I set ‘blog’ to be displayed on the front page, but the only missing thing is that I do not get all the articles (from certain category) listed because I rm-ed breadcrumb navigation links from the ‘homepage’ section.
Any idea how to get ‘em when I display articles as category-listing since I do not need them on the homepage otherwise?
p.s. I’m using pastebin instead of cluttering forums with longer code-blocks, is it OK?
Personally I prefer seeing the code in the forum posts. It saves me some clicking around, so I don’t see it as ‘cluttering’ the forum :) Also, I don’t think code on pastebin can live there forever. If someone reads this thread a year from now, it won’t be very helpful anymore without the code.
Good points. I’ll use forum next time…
P.S. For your information, here is the part of the tag trace that shows it’s only looking for articles in sections that are set to be displayed on the front page:
I’ve to brush my SQL skills a bit, it seems. :-)
...desc limit 0, 5
So, the above says to display at most 5 entries, so we’d need navigation links for more. Any easy trick to get it?
Last edited by gour (2013-03-05 08:48:30)
Offline
#32 2013-03-05 14:26:06
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,315
Re: New to TXP 4.54 - Making a Frontpage
But in this case I get all the articles displayed, not just those belonging to ‘novosti’ category?
Inside your article form, use the if_article_category
tag to filter for “novosti”.
Any easy trick to get it?
Not a trick but easy enough: limit="your-value-here"
.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#33 2013-03-05 15:51:37
- gour
- Member
- From: Hlapičina, Croatia
- Registered: 2013-01-17
- Posts: 124
Re: New to TXP 4.54 - Making a Frontpage
uli wrote:
Inside your article form, use the
if_article_category
tag to filter for “novosti”.
Hmm, the point is that if I click certain category on the right sidebar, I’d like to see only the articles belonging to the appropriate category?
Not a trick but easy enough:
limit="your-value-here"
.
Heh, I’m happy with having limit=5, but wonder how to get navigational links if there are more articles?
Of course, I’d like to have links only for the URLs showing category inside like this one?
Iow, for the normal homepage showing just the last 3 excerpts I do not want navigational links and for the homepage showing articles from certain category I want them.
Els wrote:
Though it might not seem apparent at first sight, category pages use the front page by default (URL like /category/category-name)
so I wonder how to detect that we deal with category page?
I was researching a bit and the best what I’ve found is the following:
<txp:if_category name="xyz">
<!-- display articles belonging to the xyz category *and* show navigation links -->
<txp:else />
<!-- we're on regular homepage, so just display 3 recent excerpts and show *no* navigation links -->
</txp:if_category>
Of course, we’d need some kind of switch/case statement to check for all the categories from our list and/or store the value of all categories in txp:variable and then somehow check its value.
Anyone can help fill the missing logic?
Edit: I solved the navigation-links problem with this post, iow. by adding the following block:
<!-- add pagination links to foot of article/article listings/category listings if there are more articles available,
this method is more flexibile than using simple txp:link_to_prev/txp:link_to_next or txp:older/txp:newer tags -->
<p id="paginator">
<txp:variable name="prev" value='<txp:older />' />
<txp:variable name="next" value='<txp:newer />' />
<txp:if_variable name="prev" value="">
<span id="paginator-l" class="button disabled">← <txp:text item="older" /></span>
<txp:else />
<a id="paginator-l" href="<txp:older />"
title="<txp:text item='older' />"
class="button">←
<txp:text item="older" /></a>
</txp:if_variable>
<txp:if_variable name="next" value="">
<span id="paginator-r" class="button disabled"><txp:text item="newer" /> →</span>
<txp:else />
<a id="paginator-r" href="<txp:newer />"
title="<txp:text item='newer' />" class="button">
<txp:text item="newer" /> →</a>
</txp:if_variable>
</p>
to the:
<!-- else is this an article category list? -->
<txp:if_category>
tag.
Last edited by gour (2013-03-05 21:02:02)
Offline