Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-03-20 20:44:01

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

txp:article Tag Ignoring Form Attribute

I’m making some revisions to my business site, and I’ve run into a problem with the tpx:article tag. I’m trying to duplicate the instructions from this tutorial for creating custom metadata for the head element of a page. Instead of using the form I’ve specified in the tag, however, Txp is displaying the entire article in the head.

Here’s the article form I’m using for the metadata on individual articles. I’ve called this form “meta_about-indiv”:

<txp:if_custom_field name="article_page_title">
    <title><txp:custom_field name="article_page_title" /> (Zenscope Studio)</title>
  <txp:else />
    <title><txp:title /> (Zenscope Studio)</title>
</txp:if_custom_field>
<txp:if_excerpt>
  <meta name="description" content="<txp:excerpt />" />
</txp:if_excerpt>

And here’s how I’m calling for that block of code within the page’s head element:

<txp:if_section name="about">

  <txp:if_individual_article>
    <txp:article form="meta_about-indiv"></txp:article>
  <txp:else />
    <title><txp:sitename />: <txp:section title="1" /></title>
    <meta name="description" content="Information about Zenscope Studio, a Kansas web development and graphic design consultancy." />
  </txp:if_individual_article>

</txp:if_section>

You can download a text file with the tag trace. The trouble seems to be happening in the second pass, if I’m reading this correctly. I’m still not sure why, however. The page’s head is itself a Textpattern form, included with the txp:output_form tag. Could this have something to do with it?

Thanks in advance for your help.

NOTE: Now that the problem has been resolved (see Mary’s message, below) I’ve removed the tag trace files from my server.

Last edited by Logoleptic (2007-03-23 23:16:45)

Offline

#2 2007-03-20 22:16:46

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

Re: txp:article Tag Ignoring Form Attribute

You didn’t set an override form for the article?

Offline

#3 2007-03-20 23:23:43

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: txp:article Tag Ignoring Form Attribute

If you did, just remember to add allowoverride="0" to your article tag.

Offline

#4 2007-03-21 21:20:40

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: txp:article Tag Ignoring Form Attribute

Mary wrote:

If you did, just remember to add allowoverride="0" to your article tag.

I tried allowoverride="0", and it stopped the inclusion of the complete article. Thanks! Not sure why it worked, because I didn’t have any overrides in effect. Now, however, I have a new problem.

When I tested the new form-based metadata approach, I commented out my old method using the anc_hide plugin like so:

<txp:if_section name="about">

  <txp:if_individual_article>
    <txp:article form="meta_about-indiv" allowoverride="0"></txp:article>
    <txp:anc_hide><title><txp:ob1_title order="%article,%sitename" separator=" (" />)</title></txp:anc_hide>
  <txp:else />
    <title><txp:sitename />: <txp:section title="1" /></title>
    <meta name="description" content="Information about Zenscope Studio, a Kansas web development and graphic design consultancy." />
  </txp:if_individual_article>

</txp:if_section>

I’ve had no problems with this plugin in the past. It always works exactly as advertised, completely obscuring whatever it contains. This time, however, I got this output:

<title>The Website Audit Service (Zenscope Studio)</title>

<meta name="description" content="Zenscope's website audit service gives you insight both into the areas where your website excels and the ways in which it could be improved." />
)</title></txp:anc_hide>

The result is invalid XHTML and a stray parenthesis at the top of my page (tag trace of this result). I tried to get around this by completely removing the old code (the anc_hide tag and everything within it), but something even weirder happened: one of my site’s three stylesheets completely disappeared from the resulting output. I should be getting this:

<title>The Website Audit Service (Zenscope Studio)</title>

<meta name="description" content="Zenscope's website audit service gives you insight both into the areas where your website excels and the ways in which it could be improved." />

<!-- 'position.css' controls page layout and strips some browser-default styles; it is for screen rendering -->
<link rel="stylesheet" href="http://localhost/zenscope/assets/css/position.css" type="text/css" media="screen" />

<!-- 'default.css' controls text styles, margins, and padding; suitable for printed copies and projection -->
<link rel="stylesheet" href="http://localhost/zenscope/assets/css/default.css" type="text/css" media="screen,print,projection" />

<!-- 'print.css' is used for printing and projection; it eliminates certain web-only UI elements and resizes text, margins with print units -->
<link rel="stylesheet" href="http://localhost/zenscope/assets/css/print.css" type="text/css" media="print,projection" />

But instead, I’m getting this (tag trace of this result):

<title>The Website Audit Service (Zenscope Studio)</title>

<meta name="description" content="Zenscope's website audit service gives you insight both into the areas where your website excels and the ways in which it could be improved." />

<!-- 'default.css' controls text styles, margins, and padding; suitable for printed copies and projection -->
<link rel="stylesheet" href="http://localhost/zenscope/assets/css/default.css" type="text/css" media="screen,print,projection" />

<!-- 'print.css' is used for printing and projection; it eliminates certain web-only UI elements and resizes text, margins with print units -->
<link rel="stylesheet" href="http://localhost/zenscope/assets/css/print.css" type="text/css" media="print,projection" />

As I said in my earlier post, the <head> is a form (of type “misc”). It’s output into my page templates using <txp:output_form form="include_html-head" />. I use this same form on every page template to cut down on duplication, so there are a lot of conditional statements in there. The stylesheet links are outside any conditional tags, however, so I can’t imagine why they’re getting gobbled up. If I’m reading the trace correctly, Txp is treating the position.css link as if it’s part of the meta_about-indiv form. It isn’t, and I’m at a loss for any explanation of what’s going on.

I could do what I’m attempting pretty easily with the use of two plugins, but I’m trying to move away from using plugins when built-in tags will do. I appreciate the help you’ve given so far. Hopefully this last mystery issue can be resolved, and I can strike another plugin or two from my installation. :)

In case it might be helpful, I’ve uploaded a copy of my include_html-head form. If the problem is with my template code, I’m sure it must be somewhere in there.

NOTE: Now that the problem has been resolved (see Mary’s message, below) I’ve removed the tag trace files from my server. I’ve left the ‘include_html-head’ form in place, however, in case anyone wants an example of how to use one form for the <head> element of every page. If you want to use the example form as a learning tool, keep in mind that it relies on two plugins (ob1_title and anc_hide) and has one bug (revealed by Mary in the next post).

Last edited by Logoleptic (2007-03-23 23:15:53)

Offline

#5 2007-03-22 23:24:32

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: txp:article Tag Ignoring Form Attribute

 <txp:article form="meta_about-indiv"></txp:article>

That is not correct. It should be:

 <txp:article form="meta_about-indiv" />

Offline

#6 2007-03-23 21:56:45

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: txp:article Tag Ignoring Form Attribute

Mary wrote:

<txp:article form=“meta_about-indiv”></txp:article>

That is not correct. It should be:

<txp:article form=“meta_about-indiv” />

Doh! You’d think that after looking through that code a dozen times, making trips back and forth to the TextBook tag reference, and working on a different page template that used the proper <txp:article /> tag format I would’ve caught something that simple! With the tag format fixed, final output is now exactly what you’d expect. No more mysteriously disappearing stylesheet.

Thanks for being my backup pair of eyes, Mary. I think I must’ve gotten to the point where looking hard enough for a bug just makes it more invisible.

Offline

#7 2007-03-23 22:11:39

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: txp:article Tag Ignoring Form Attribute

Aaaaaaaaah!
I have been looking at the code when you posted it and didn’t notice that error.
Mary’s eyes can see invisible things for mortals as us.

BTW: thanks for posting, Adam!
I was looking for that nice site I have seen few days ago and I couldn’t remember which one it was. Until now, when you posted again.

Nice site! I like the how you structured the portfolio. I also enjoyed reading the content (case studies and the About page).
Definitely, if you don’t mind, I will took your site as a source of ideas and inspiration the day I decide to built my own site.
Congratulations!


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#8 2007-03-23 22:59:06

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: txp:article Tag Ignoring Form Attribute

maniqui wrote:

Nice site! I like the how you structured the portfolio. I also enjoyed reading the content (case studies and the About page). Definitely, if you don’t mind, I will took your site as a source of ideas and inspiration the day I decide to built my own site. Congratulations!

Thanks for the kind words! I definitely put a lot of thought into the portfolio section, and it’s nice to hear that someone appreciates it and finds it useful. :-) Once I get a few more tweaks done on localhost, the site will see some updates: new portfolio entries (including the addition of a “Coming Soon” category of projects), details on my philosophy for pricing projects, and a new service offering. A weblog and some adjustments to the design are also in the works, and are coming Real Soon Now™.

I’m also flattered that you would consider my work as a source of inspiration for your own website plans. I have no problem with you using my design, site organization, and copy as a springboard for your own material — I did the same when creating the site. Outright duplication of my design or content, of course, is another matter. Things like that are sure to make me very cross.

Cameron Moll wrote a great article about inspiration, copying, and stealing back in 2003: Good Designers Copy, Great Designers Steal. When it first appeared, the article provoked a lot of discussion. The whole point of Moll’s article is that there’s a right way to “steal” in the design world: by transforming the original source so much that it becomes something uniquely yours.

Also keep in mind that there are design inspirations to be found everywhere, not just online. I’ve recently started recording these when I find them, like this crossword puzzle done in tile on the side of a liquor store. I’m also recording examples of bad design, like this Wendy’s cup. The cup was too large for their entire advertising message to be visible at once, and the part you could see was open to… interesting interpretations. Keeping your own personal library of design inspiration can help you generate fresh ideas when the time comes to create something for yourself or a client.

Thanks again, Julián, and best of luck on your future site. :-)

Last edited by Logoleptic (2007-03-23 22:59:40)

Offline

Board footer

Powered by FluxBB