Textpattern: Conditional Page Titles

You may have seen that some talented web builders serve up customized tags, so the very top of the browser shows a different title, depending on the current page/section.

Thinking that was pretty cool, I looked at the default title line:
<txp :page_title />
This serves the same title of your site to every page in your site.

Nathan described the wonders of the “section” tab, so I tried editing it this way:
<txp :page_title /> - <txp :s />
which does successfully customize the title depending on the current section. And I think that if you use in the of your page, TxP is smart enough not to output “default” on the home page.

However, since goes in the , the code above produced this on the home page:

Michael Montgomery.net – default

Definitely not cool.

So, what about conditional tags? has the answer:

<txp :page_title />

<txp :page_title /> || <txp :s />

The first line tests whether you’re currently on the home page, because name=”” refers to the default section. As a result, this is the home page’s title:

Michael Montgomery.net

and this is the “About” page’s title:

Michael Montgomery.net || About



Textpattern Web Design

*CMS, or HTML/CSS Editor?*

Many programs for building websites, as in markup and stylesheet editors, enable multiple windows for simultaneously working on the content and presentation of a page. For example, ??index.html?? and ??style.css?? in two tiled windows. They also usually have a button or menu for viewing the current page in a browser or two.

At least for me, this ability to view/edit both the XHTML and the CSS at the same time is helpful. And I would even prefer a more-or-less real-time browser view, showing the page as it changes.

The default “Textpattern”:http://textpattern.com/ interface can also be considered a website builder, in addition to being a content management system. Wisely, for the sake of avoiding great complexity, it is by default a “one-window” editor. However, always reloading the page is inefficient, for example:

bq. Open “Presentation > Pages,” and edit the markup. Click “Save.” Open “Presentation > Style” (thus closing the markup page), and edit the CSS. Click “Save.” Remember you need to edit the Form, ….

*Enter tabbed browsing:*

When using “Firefox”:http://firefox.com/, or any browser that supports multiple windows, I find an effective technique is to open several instances of the “TxP”:http://textpattern.com/ interface *for the same site* that I’m building, in browser tabs.

For example, I usually open these tabs in this order: +Presentation > Pages+, +Presentation > Style+, and +View Site+. This way, I can almost simultaneously edit the XHTML and the CSS, and see the edited page.

Sometimes, I also open additional pages in some more tabs, including: +Presentation > Forms+ and/or +Content > Write+ or +Content > Articles+.

Initially, I was surprised this works, but TxP is smart enough to know that this computer is logged in, and each tab interacts with the database separately, and you can’t click inside two tabs at once. Whatever, it seem to work.

As a result, though I’ve downloaded and bought several HTML editors, I find them mostly unnecessary. Especially when the excellent Firefox “Web Developer plugin”:http://chrispederick.com/work/webdeveloper/ by “Chris Pederick”:http://chrispederick.com/ is installed. The only exception is when I’m bug-hunting, and the validators haven’t helped me pinpoint the bug, then the code-coloring feature of a dedicated editor program is helpful.

*One tip:* if you’re working on multiple sites, or you like to keep your own blog open, start a new instance of the browser for each site. Otherwise, mixing multiple tabs from multiple sites is at least confusing, and at worst dangerous.

*One caveat:* Don’t open the _same_ TxP page more than once. For example, don’t load +Presentation > Pages+ for the same site twice in two tabs. I haven’t tried it, and don’t want to.

_Textpattern in multiple tabs. It’s a beautiful thing._


Textpattern Upgrade Mystery

Upgraded this site to TxP 4.0.2 (or thought I did).

*First mystery:*
When I told my usual FTP client to upload the updated files, *seventeen* of thirty-six simply failed to do so. I knew something was wrong when the main TxP page for writing articles was obviously broken. The old files were still there on the server (you can check the revision numbers right there in each text file).
Sencer and Zem at the “TxP support forum”:http://forum.textpattern.com/ were great, and uploaded the current list of revision numbers to the “TxP FAQ”:http://textpattern.com/faq/ on the _same day._ Great support for a free product.

Eventually, I had individually re-upload the correct files, and most things started working.

Personally, I think this was an FTP problem, either my client or the server let me down. More on this later.

*Second mystery:*
The images were _still_ not showing on the site.

This one was totally my fault. I was supposed to manually upload the site-design images to /images, rather than loading them into TxP. I choose this arrangement so that the markup can be more semantic. For example, background: url(/images/background.gif); rather than background: url(/images/4.gif);

*Third mystery:*
Creating thumbnails of images still throws errors. I’m sure the experts at the forum will help me fix this one too.

So the site is working. On to the content!