Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2005-11-11 06:36:06

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Ah! I'm finally getting it! But...

If it’s any help I wrote an article about the front-page.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#14 2005-11-11 09:54:15

boblet
Member
Registered: 2005-08-08
Posts: 53

Re: Ah! I'm finally getting it! But...

Hey again,

I’ve found it’s taken me a while to understand (somewhat) how TxP works, and I haven’t been explaining clearly, so don’t worry.

The Default section (presentation > sections > default) is to collect all the articles from sections with “on front page?” checked (in presentation > sections) and display them as a list (at least, until we start to modify it’s templates :-). It’s not like a normal section in that you can’t assign articles to it, and the “Default” section name doesn’t show up in the url = it’s your site’s home page.

If we want to put static content on the site’s homepage, we’ll need to modify the Default page template (presentation > pages > default) (assuming the Default section has “uses page: Default”). Since you’ve made a Home section, let’s use use it to store our static articles for the homepage.

  1. Make sure the Default section has “uses page: default” (presentation > sections > default)
  2. Write an article (or three) with Section = Home (pull-down menu on content > write) and Status = Live (same screen). We will only use this section to store the homepage’s static content, so we don’t have to worry about changing the status.
  3. Go to the Default page template (presentation > pages > default). Where you want the static content to go, type <txp:article_custom section="home" form="homepage-static" /> (or whatever you want to call the form we’re about to make). Save.
  4. Now go to the Form tempates (presentation > forms) and choose “Create new form” (top right). Name it “fomepage-static” (or watever you called it in the last step), set the Form Type to “article” (don’t know if this is necessary or not), and type some code used to display each article. For example, <txp:title /><txp:body /> would display each static article’s Title and Body text in turn. Save.
  5. View your site’s homepage. Hopefully you will now see the static articles appear wherever you added that <txp:article_custom section="home" form="homepage-static" /> tag in your Default page template, each one displaying the article title then the article body text.
  6. style away to move things into the right place (maybe by wrapping the <txp:article_custom /> tag from step 3 in a <div id="homepage-static"> etc).

To explain the code in step 3, <txp:article_custom section="home" form="homepage-static" /> means ‘make an article list of articles from the section “home” and display them the way the form “homepage-static” says’.

Once we’ve got all of that working, we need to change the link to your site’s homepage. At the moment I guess your navigation menu is an unordered list with something like <a href="/home">Home</a>, <a href="/about">About</a> etc. You want to go to the Default page template (or wherever this navlist is) and change the Home link to <txp:link_to_home>Home</txp:link_to_home>, or in a more HTML stylee <a href="/">Home</a>. The reason is that we’re only using the Home section to store your homepage’s static articles, we don’t want to display the Home section itself (that’s the job of the Default section).

Clear as mud? great! ;-) Hopefully that makes some sense, and if there are any bits you can’t understand, search for them in the TextPattern TextBook. It has information about the admin interface, a reference guide to all the <txp:> tags, and should give you a good background on how to customise TextPattern.

HTH

peace – boblet

Last edited by boblet (2005-11-11 10:01:18)

Offline

#15 2005-11-20 03:45:10

deronsizemore
Member
From: Kentucky
Registered: 2005-11-02
Posts: 324

Re: Ah! I'm finally getting it! But...

Sorry it’s taken me so long to reply here. I appreciate all of the help everyone has gave and the time put into the answers to my question!

My site is slowly but surely coming along. I’m to the point where I actually am understanding a lot of the basics! :)

There is one thing I’m not quite getting. I had someone on another forum see a post of mine about having trouble with txp a while back and they also offered help. I have a txp tag that looks like this: <txp:article form="news" id="11" limit="1" />

I’m not understanding the “id”. Can anyone explain or point me to a link that explains? I’ve search though the forums and the tutorials and can’t seem to find anything pertaining to an “id”.

Thanks again,
Deron

Offline

#16 2005-11-20 04:31:56

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Ah! I'm finally getting it! But...

“ID” is able to specify an article using it’s assigned id. All articles have a numeric id assigned to them when they are created. If you go to the “articles” tab in TXP and hover on an article’s title you should see it’s id in your browser’s status bar at the bottom of the screen.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#17 2005-11-20 20:31:44

deronsizemore
Member
From: Kentucky
Registered: 2005-11-02
Posts: 324

Re: Ah! I'm finally getting it! But...

Ah I see it now.

thanks!

Offline

Board footer

Powered by FluxBB