Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-12-30 20:49:41

mstark71
New Member
Registered: 2005-12-30
Posts: 5

static home page

I can’t figure this out.

I got so far as to create a section for the home page, but the article is rendering wrong.

I added <code><txp:if_section name=“home”> <txp:article form=“Single” />” </code> to the default template.

http://www.waltermyronlevy.com/ – the article should appear like the about page, as a single. I am sure it has something to do with the section setting “on frontpage”.

Help, please.

m

Offline

#2 2005-12-30 21:55:39

Elenita
Member
From: Falls Church, VA
Registered: 2004-05-16
Posts: 407
Website

Re: static home page

mstark, welcome to Textpattern; I’m glad you’ve joined us. If you haven’t done so already, I highly recommend spending time reading up at <a href=“http://textpattern.net”>Textbook</a> and <a href=“http://www.textpattern.com/faq/”>the FAQ</a>.

First, the home page (aka “front page”) is always, <strong>always</strong> the section “default”. Because of this, the default section also has some quirks that make it unusual. For one thing, it can never be deleted. For another, it is never called specifically by its name in tags; the name attribute is left blank. If you need to refer to it, you call it like this: <code><txp:if_section name=”“></txp:if_section></code>.

Second, as you can see in the example above, conditional tags (that is <code><txp:if_something></code>) are <a href=“http://textpattern.net/wiki/index.php?title=Glossary#Container_Tag”>container tags</a>. To work properly, they need to be closed. Thus, if you start a code block with a container tag, it needs to be closed with a container tag. Don’t do that, and your page won’t render right.

Third, the <code><txp:article /></code> tag is context sensitive. If used on the front page, it’ll only display articles set to display on the front page (set in Presentation > Sections); if all sections are set to no, it’ll presumably display nothing. Your best bet is to use the <a href=“http://textpattern.net/wiki/index.php?title=Txp:article_custom_/”>txp:article_custom /</a> tag. For more information, see <a href=“http://textpattern.net/wiki/index.php?title=Txp:article_custom_/”>this comparison</a>.

For a static home page, the easiest way to probably do it is to create an article with all the appropriate text, and then call it from your template using <code><txp:article_custom id=“3” form=“Single” /></code>, changing the id number to whatever is appropriate. That’s more or less what I do, anyway.

I hope all this helps, and you’re not too overwhelmed. Good luck.

Offline

#3 2006-01-01 18:48:31

mstark71
New Member
Registered: 2005-12-30
Posts: 5

Re: static home page

Elenita wrote:

For a static home page, the easiest way to probably do it is to create an article with all the appropriate text, and then call it from your template using <code><txp:article_custom id=“3” form=“Single” /></code>, changing the id number to whatever is appropriate. That’s more or less what I do, anyway.

Elenita,

Thanks so much for your considered reply. I found the last tip you gave to be a very simple way to solve my problem.

Thanks!

m

Last edited by mstark71 (2006-01-01 18:49:38)

Offline

Board footer

Powered by FluxBB