Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-12-22 14:08:55

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Refing my TXP site to just 1 template (2 or 3 at the most)

My site currently has 7 templates. I know for a fact I only should need a max of 3. I know how to get it down to this many but there are a few things I don’t know.

  1. Is there a plug-in to set an a.current status of a link depending which page you’re on, using PHP or something.
  2. Will having one template with lots of “form output” request and if_section tags make pages a lot slower to load?

Thanks

Offline

#2 2005-12-22 15:54:25

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

Re: Refing my TXP site to just 1 template (2 or 3 at the most)

You can set an active state for links using the <code><txp:if_section></code> tags like so:-

<code>
<txp:if_section name=“sectionName”>
<li class=“active”><a href=“blahblah.com”>BlahBlah</a></li>
<txp:else />
<li class=“normal”><a href=“blahblah.com”>BlahBlah</a></li>
</txp:if_section></code>
<br />

I’ve used “li” tags there but you get the drift. You can also use <code><txp:if_category></code> tags where appropriate.

Calling forms and using TXP’s own conditional tags won’t slow you down any noticeable amount and will still be quicker than using plug-ins.


Stuart

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

Offline

#3 2005-12-22 16:05:44

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Refing my TXP site to just 1 template (2 or 3 at the most)

FireFusion wrote:

Will having one template with lots of “form output” request and if_section tags make pages a lot slower to load?

I did a quick count. I have 14 sections and one template. On my page are 33 if_section tags, 6 if_category tags, some if_search and if_individual_article tags, used in the body as well as in the head (title and meta tags). Lots of them nested, too. I don’t think my pages are slow to load. The page template is quite long though…

Offline

#4 2005-12-22 16:13:56

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

Re: Refing my TXP site to just 1 template (2 or 3 at the most)

Yes it’s likely to be the size of the page that’s loading rather than the calls and conditionals that will slow things down if anything.


Stuart

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

Offline

#5 2005-12-22 17:17:32

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Re: Refing my TXP site to just 1 template (2 or 3 at the most)

Thanks

Offline

#6 2005-12-22 17:36:08

marknumberm
Member
From: Minneapolis
Registered: 2005-11-29
Posts: 46

Re: Refing my TXP site to just 1 template (2 or 3 at the most)

Are there any disadvantages to having lots of templates? Does that slow things down somehow, or is it just a matter of what the webmaster finds easier to manage?

To me, jamming 14 sections and all those conditional tags into one template sounds like a recipe for confusion; I’d rather just create a couple of different templates. But is there something I’m missing?

Offline

#7 2005-12-22 17:41:47

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

Re: Refing my TXP site to just 1 template (2 or 3 at the most)

No. Not missing anything. It’s down to preference. I have about a dozen templates but they are each used for several different sections (I do have a lot) with 2 exceptions – my front-page (default) does exactly that as does my search page and nothing else. As you suggest it can be confusing to use loads of conditionals but give it another 12 months and you will wonder why you said that. :grin:


Stuart

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

Offline

#8 2005-12-22 20:02:43

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: Refing my TXP site to just 1 template (2 or 3 at the most)

I redid CMS Styles and cut it down from 5 pages to this single default:

<code><txp:output_form form=“header” />
<txp:if_individual_article>
<txp:output_form form=“body individual_article” />
<txp:else />
<txp:if_section name=”“>
<txp:output_form form=“body default” />
</txp:if_section>
<txp:if_section name=“archives”>
<txp:output_form form=“body archives” />
</txp:if_section>
<txp:if_section name=“search”>
<txp:output_form form=“body search” />
</txp:if_section>
<txp:if_section name=“b2evo,blogger,drupal,ee,generic,joomla,manila,mt,pivot,site,symphony,txp,typepad,wp”>
<txp:output_form form=“body article_list” />
</txp:if_section>
</txp:if_individual_article>
<txp:output_form form=“footer” /></code>

It still loads plenty fast, but maintains the kind of modularity I love. There are still some if_section conditionals in some of the forms, but this keeps everything readable for me. Now, if we only had support for notname aka notsection

Last edited by michaelkpate (2005-12-22 20:43:38)

Offline

#9 2005-12-22 22:36:55

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Re: Refing my TXP site to just 1 template (2 or 3 at the most)

Okay, I’ve converted to the new method. Could you guys test my litemedia site and see if you think the speed is okay. I think Dreamhost might have been having some speed issues today, so that could explain the slowness.

Offline

#10 2005-12-22 22:42:17

marknumberm
Member
From: Minneapolis
Registered: 2005-11-29
Posts: 46

Re: Refing my TXP site to just 1 template (2 or 3 at the most)

Seemed good to me. And she’s real purty, too.

Offline

#11 2005-12-22 22:45:34

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: Refing my TXP site to just 1 template (2 or 3 at the most)

also don’t forget the form override for articles, which means you don’t have to use conditionals when say you’ve only got one or a few articles that require slightly different formatting…

Offline

#12 2005-12-22 22:52:09

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Refing my TXP site to just 1 template (2 or 3 at the most)

marknumberm wrote:

To me, jamming 14 sections and all those conditional tags into one template sounds like a recipe for confusion; I’d rather just create a couple of different templates. But is there something I’m missing?

Well, I didn’t start with 14 ;) It just grew. I’m used to it, and though the page template is rather large, I can find what I need pretty quick. And as long as I don’t need different styles for different sections, I started using it for other sites too. But it’s not from conviction that I’m doing it this way, just habit ;) As Stuart says, I think you should use whatever works best for you.

Offline

Board footer

Powered by FluxBB