Uncategorized

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

Done!

Standard
Uncategorized

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._

Standard