Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-11-18 18:23:02
- element
- Member
- Registered: 2009-11-18
- Posts: 99
Static pages
Hello,
I’m in the process of building a website with txp, obviously. It’s a plain website with several sections, so it’s made up of all static pages
Question:
How can I make a link in an article in a static page from a certain section to another article, also static and part of that same section?
Offline
Re: Static pages
If you have this in your page template for your section:
<txp:if_individual_article>
<txp:article />
</txp:if_individual_article>
Because you specified, the <txp:article />
tag will display an individual article.
When editing an article notice the view link near the title field. That will tell you the link you can use to that article. Under Admin > Preferences you can set the way URLs are built which can help you get pretty urls if you like.
You can use textile to make a link to that article from another article. Write the following in your article you have the link in: "link text":http://yoursite.com/yoursection/name-of-article
See the Textile Help under the Write tab.
If you need to display more articles then one then the default template TXP came with should be doing that for you already and so "link text":http://yoursite.com/yoursection/name-of-article
is all you’ll need to know. The default template will also handle displaying a single article at a time.
Last edited by whaleen (2009-11-19 02:01:49)
txtstrap (Textpattern + Twitter Bootstrap + etc…)
Offline
#3 2009-11-18 20:44:39
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Static pages
You can also link to another article like this:
<txp:permlink id="123">link text</txp:permlink>
Offline
#4 2009-11-18 21:13:55
- gerhard01
- Plugin Author
- Registered: 2006-12-07
- Posts: 108
Re: Static pages
And wet_quicklink might speed up this process in case you would need internal linking on a frequent basis.
Offline
#5 2009-11-18 23:18:32
- element
- Member
- Registered: 2009-11-18
- Posts: 99
Re: Static pages
Whaleen:
With this solution the page is empty. Don’t see any article.
Last edited by element (2009-11-18 23:38:03)
Offline
#6 2009-11-19 00:42:58
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,315
Re: Static pages
Just add a slash and thus make the last line a closing tag.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Static pages
uli wrote:
Just add a slash and thus make the last line a closing tag.
<txp:if_individual_article>
to </txp:if_individual_article>
on the closing tag. Sorry I left that out.
txtstrap (Textpattern + Twitter Bootstrap + etc…)
Offline
#8 2009-11-19 09:45:38
- element
- Member
- Registered: 2009-11-18
- Posts: 99
Re: Static pages
I already saw that one. I have this:
<div id="content">
<txp:if_individual_article>
<txp:article />
</txp:if_individual_article>
</div>
But no article is shown on the page, completely empty.
A tag trace shows <txp:if_individual_article>
returning a false. Why?
Last edited by element (2009-11-19 10:50:29)
Offline
#9 2009-11-19 11:08:41
- element
- Member
- Registered: 2009-11-18
- Posts: 99
Re: Static pages
This seems to work (or at least do what I want):
<txp:if_individual_article>
<txp:article />
<txp:else />
<txp:article limit="1" sort="Posted asc" />
</txp:if_individual_article>
Maybe there’s a better way to become the same result?
Offline
#10 2009-11-19 17:23:05
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Static pages
element wrote:
A tag trace shows
<txp:if_individual_article>
returning a false. Why?
Then it can’t be an individual article page. If you are linking to a section page (/site.com/section-name/) and you only want to show one article, you don’t need the if_individual_article tags, just use <txp:article limit="1" sort="Posted asc" />
.
Offline
#11 2009-11-19 21:08:21
- element
- Member
- Registered: 2009-11-18
- Posts: 99
Re: Static pages
What is an individual article page exactly? How does it differ from a section page?
Offline
#12 2009-11-19 23:38:02
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Static pages
An individual article page has the article id and/or title (depending on your permanent link mode) in the URL. A section page has only the section name in the URL, and is by definition an article list (even if you choose to display only one article).
Offline