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
Uncategorized

Comment Spam … I feel sick

Not that I expected the world to sit up and take notice of “MM.net”:http://michaelmontgomery.net/, one of 10,000 blogs that are started _every day_, but I was ill-prepared for the disgusting phenomenon called “Comment Spam”:http://en.wikipedia.org/wiki/Blog_spam.

Thankfully, “Textpattern”:http://www.textpattern.com/ easily allows all proposed comments to be moderated, before they’re posted on your site. And thankfully, I clicked the box under the ??Admin>Preferences?? tab that says “moderate comments.”

So I checked the ??Content>Comments?? tab for any comments that were awaiting approval, and … well, _ick_. All of the comments were spam, except for the default one that’s created when you install TxP.

Not just advertisements or links to products or services, I’m talking about — just gross stuff.

As “Adam”:http://kalsey.com/2003/11/comment_spam_manifesto/ says, “*Spammers are hereby put on notice. Your comments are not welcome.*”

In response to this problem, “Six Apart”:http://www.sixapart.com/ has a “guide”:http://www.sixapart.com/pronet/comment_spam for combatting it.

And “WordPress”:http://wordpress.org/ has a bunch of “plugins”:http://codex.wordpress.org/Plugins/Spam_Tools.

The ever-reliable “Zem”:http://thresholdstate.com/ (administrator on the TxP support site) has produced the “zem_prblock”:http://thresholdstate.com/articles/3741/pr-block-documentation plugin, and “Matthew Pennell”:http://www.thewatchmakerproject.com/journal/141/killing-comment-spam-in-textpattern and “John See”:http://www.johnsee.net/journal/265/ have apparently done great work to defeat this problem. I will try some of their techniques and describe the results.

Too bad all this has become necessary.

Standard