Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Using TXP as a CMS!
driz wrote:
Okay so I have PAGE as the template and then I create an article called HOME
How do I set this to be the first that the user sees?
Multiple ways. You can post it to some section and then choose that the section appear on frontpage. One other way is to show the article by it’s ID. Like <txp:article_custom id="x" />
by placing the article id as the id’s value. Other ways is to use section
attribute, and show that section on frontpage.
Also you can use conditionals. <txp:if_section name=""><txp:article_custom section="home" /></txp:section>
that you place your page template that you use for all sections.
One way is use the page template / form as home page. <txp:if_section name=""><!-- my homepage content --></txp:if_section>
. In example then your page template could look like:
<txp:output_form form="head" />
<txp:if_section name="">
<!-- my frontpage content -->
</txp:if_section>
<txp:if_section name="about">
<!-- my about content -->
</txp:if_section>
<txp:if_section name="blog">
<!-- my blog content -->
<txp:article />
</txp:if_section>
</body>
</html>
Then in your head
-form:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><txp:if_individual_article><txp:title /> | </txp:if_individual_article><txp:if_section name=""><txp:else /><txp:section title="1" /> | </txp:section><txp:site_name /></title>
</head>
<body>
You can also use forms as content. And then output is with <txp:output_form form="form-name" />
Last edited by Gocom (2008-03-19 02:28:44)
Offline
Re: Using TXP as a CMS!
Hmm you know it would seem better to just enter the RAW content straight inside the pages templates instead of creating articles for them! Because that way I can just set Default to display the home page, About section to display the About page etc.
But then say I wanted to do this: domain.com/about/team/
How would I do that? WordPress would let you create a page inside parent page, how does TXP deal with this?
Last edited by driz (2008-03-19 02:52:35)
~ Cameron
Offline
Offline
Re: Using TXP as a CMS!
Okay so I have created all my sections now!
They all link to this page template with the following code:
<txp:output_form form=“header” />
<txp:article />
<txp:output_form form=“footer” />
So now I need to create the articles for each of these sections correct? So say for instance, the about section has the about article, team article, and faq article. How do I get it to display ONLY the about article inside the about section be default, and then say i choose the team article next, it will display ONLY that article and not the other two! So that it works like a page within a page!!!
Last edited by driz (2008-03-19 03:34:24)
~ Cameron
Offline
Re: Using TXP as a CMS!
Well you can’t have subsections, but pseudo-subsections.
example.com/about/team
| |
| article
section
- Section: “about”
- Page: “about”
Toss this in your about page template:
<txp:article/>
Last edited by jm (2008-03-19 03:37:39)
Offline
Re: Using TXP as a CMS!
driz wrote:
the about section has the about article, team article, and faq article. How do I get it to display ONLY the about article inside the about section be default,
Try the limit="1"
attribute on the txp:article tag. That’ll pick the most recent article and show it. Change which one it picks by either adjusting the timestamp of the article (under the ‘More’ link in the bottom-right of the Article page) or using the sort
attribute in txp:article to change the order of the articles.
When you visit site.com/about it’s an ‘article_list’ page so will show (by default) up to 10 articles from that section. If you visit site.com/about/team, that’s an ‘individual_article’ page so will only show that article. The limit="1"
just makes the list have 1 item in it! Look at the conditional tags for if_article_list
and if_individual_article
as well on Textbook because they can allow you to take action depending on if a user is at the ‘/about/’ level or the ‘about/some-article’ level.
and then say i choose the team article next, it will display ONLY that article and not the other two!
The same page/form will work for this too. BTW, there are tags to display other articles in the section. older / newer / link_to_next / link_to_prev will show next/prev style tags; article/article_custom with a suitable form will allow you to list other articles in the section; related_articles does what it says on the tin; or there are a multitude of plugins that can make lists of articles.
That’s the daunting thing about TXP at first: there are so many ways to do something you might feel like you’re not sure of the best way to go at it (I know I did, and I didn’t have the luxury of coming from another CMS – TXP was my first). Takes a bit of trial and error with tags to work out their power. As Gocom says, once you’ve got the basics and you start messing with conditional tags to do stuff on pages you can condense your pages and forms down to just a few key elements, picking and choosing what is displayed based on the section the user is in.
Last edited by Bloke (2008-03-19 09:13:16)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Using TXP as a CMS!
Hmm, I much prefer the way WordPress handles this, by having posts or pages, and allowing the pages to sub-sectioned inside each other. Seems a little silly having simple posts like news, and whole about pages classed as articles!
I think im gonna go with using a page template for each page! Seems more logical, than using articles for content, when they arn’t really articles but static-pages. xxx
~ Cameron
Offline
Re: Using TXP as a CMS!
I think im gonna go with using a page template for each page! Seems more logical, than using articles for content, when they arn’t really articles but static-pages.
Don’t think »articles are articles«. Think »articles are editorial content«! No matter what kind. The rest are more or less static elements. I think it’s a better approach.
Digital nomad, sailing the world on a sailboat: 32fthome.com
Offline