Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2012-07-19 09:31:23
- beetlejuice
- New Member
- Registered: 2012-07-13
- Posts: 2
Noobie Question - just taken over a Textpattern site
Hi,
I’ve just taken over management of a textpattern site and is essentially my first dabble into CMS and am a little overwhelmed initially. I’ve spent some time going through tutorials etc but most seem to assist in publishing articles etc which I’m comfortable with.
It’s more the setup that the previous designer has done that I’m scratching my head with.
Much of the tuts I have been able to understand seem to have sites with multiple pages to display the various content.
This designer (obviously quite experienced) has used basically a single page with heaps of if/else statements.
As I’ve been given the task to redesign some of the site, am I best off keeping with the “one page” or going the multi page way? Are there pros and cons either way?
Thanks in advance
Offline
Re: Noobie Question - just taken over a Textpattern site
Really depends on the size and complexity of the site.
Breaking the page into multiple pages, and using forms (snippets) appropriately will make developing and management a lot easier than wrapping a single page in a load of confusing if/else statements.
The minor drawbacks that you may be repeating sections of code here and there in multiple page templates, but that is an acceptable drawback in my opinion.
The theme that ships with upcoming Textpattern 4.5 has commented examples within it, which may help your understanding of the system. You can grab a preview of it here (purely for reference at the moment, it requires 4.5 to work but will give you an idea of correct workflows).
Offline
Re: Noobie Question - just taken over a Textpattern site
Hi and welcome to txp
Multiple pages (templates) are usually easier for demanding newbies as each template can correspond to a section which can have its own layout, content (articles, links etc) and style (css).
I found that keeping templates to the minimum though, can be better in the general maintenance of the site as well as its future layout updates but it can need a lot of if/else statements which can be confusing for those who are not in command of the system.
As Phil mentioned you can use forms which can contain common code snippets across all pages.
The choice is up to each individual.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Noobie Question - just taken over a Textpattern site
My rule of thumb is to only use a different Page template if the content differs significantly from another Page. If it’s broadly similar then I’ll tend to use a single Page for the similar parts of the site and use occasional if/else branches to pull in content where the pages need to differ.
If one section starts to differ wildly then I’ll try and refactor the design into a couple of pages to keep the number of if/else statements down. This sounds like the situation you are faced with and unfortunately the only thing for it is to audit the content to find out which bits go where, and whether it’s beneficial to split any of it into a different template for easier long term management.
In the Page templates, I do make heavy use of <txp:output_form> to draw in parts that are always the same. For example, my pages tend to like this:
<txp:output_form form="head" />
<body>
<txp:output_form form="navigation" />
<div class="container">
...
<txp:article> tags and article flow here
...
</div>
</body>
</html>
and in Form head
:
<!DOCTYPE html>
<head>
<txp:output_form form="head_meta" />
<txp:output_form form="head_css" />
<txp:output_form form="head_js" />
<title><txp:page_title /></title>
</head>
Again, sub-dividing the content into little chunks so if I need to change anything in the ‘head’ all the Forms are listed together in a block in the Forms panel and each does a single task so it’s easy to find the one I need to edit if, say, I want to add another stylesheet. I probably wouldn’t go much deeper than 3 ‘levels’ of <txp:output_form>
nesting though as it gets more awkward to manage.
One other tip: if you have inherited a design then consider installing the adi_form_links and smd_where_used plugins. Both are really helpful to locate stuff and navigate around the admin side from Page to Page and Form to Form quickly.
Hope that helps.
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
#5 2012-07-19 11:54:33
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,303
Re: Noobie Question - just taken over a Textpattern site
Bloke wrote:
adi_form_links and smd_where_used plugins
Just to provide the links: see my signature.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Noobie Question - just taken over a Textpattern site
I like working with forms more than Pages, because I feel like forms are more flexible. So I use the “default” page for just about every section.
Then I use one main branch: soo_if_frontpage
to detect if we’re on the front page, and then if not, rah_output_section_form
plugin to call a specific form depending on the section we’re in. For example, I might have forms called section_music, section_news, section_downloads, which the rah- plugin will automatically load for me.
Here’s a working example with those two plugins installed:
<txp:soo_if_frontpage>
Any special frontpage stuff (could be in a form, too)
<txp:else/>
<txp:rah_output_section_form prefix="section_" default="section__default" />
</txp:soo_if_frontpage>
(Note that I use section__default to set up a default form for new sections that don’t have their own special form yet)
And like Stef says, inside of those section forms, I call other forms like the header and footer. I usually try to call a main menu form, social media tags, and special title tags forms from within the header
form, and any sidebar content in addition to the footer from within a footer
form. My ideal for page output is to keep close to this:
<txp:output_form form="header" />
<txp:article />
</txp:output_form form="footer" />
…and hopefully I don’t have to deviate far from that, other than setting variables for special sections, etc..
This is the most efficient and easy-to-maintain method I’ve found so far. I really don’t like duplicating code in different places.
Last edited by maruchan (2012-07-19 18:48:11)
Offline
#7 2012-07-20 05:31:30
- beetlejuice
- New Member
- Registered: 2012-07-13
- Posts: 2
Re: Noobie Question - just taken over a Textpattern site
Hey guys
Thanks all for your quick replies. I may take up Blokes <txp:output_form> and the additional plugins option in the short term as I don’t want to redesign the whole site just some gallery changes etc.
And I’ll take a look at your options that you use maruchan.
Thank you all again for your help and welcome.
beetlejuice
Offline