Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-12-30 10:46:26

brazhko
New Member
From: Stakhanov, Ukraine
Registered: 2010-12-30
Posts: 7
Website

[textile] txp:image_url in article body dont work

Hi!

The code in article body:

<txp:images category="portfolio">
<a href="<txp:image_url />" rel="lightbox-smd"><txp:thumbnail /></a>
</txp:images>

and as a result

<a href="http://www.example.com/images/8.png&#8220; rel=&#8220;lightbox-smd&#8221;&gt;<img src="http://www.example.com/images/8t.png" alt="" width="500" height="375" /></a>

The code

<txp:images category="portfolio">
<txp:image_url><txp:thumbnail /></txp:image_url>
</txp:images>

work perfect, but I need rel=“lightbox-smd” in link tag.

Help me to solve problem, please!

Offline

#2 2010-12-30 10:59:32

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: [textile] txp:image_url in article body dont work

Disable Textile for that block:

notextile. <txp:images category="portfolio">
<a href="<txp:image_url />" rel="lightbox-smd"><txp:thumbnail /></a>
</txp:images>

I’ll send a report to net-carver.


Code is topiary

Offline

#3 2010-12-30 11:06:11

brazhko
New Member
From: Stakhanov, Ukraine
Registered: 2010-12-30
Posts: 7
Website

Re: [textile] txp:image_url in article body dont work

Thanks!!!

Offline

#4 2010-12-30 14:07:29

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,454
Website GitHub

Re: [textile] txp:image_url in article body dont work

It’s not a bug, as such. Nested tags are notorious for confusing Textile1.

Since this is a simple example you only got some badly encoded quotes in the result. For more complicated blocks of <txp:> tags you can get all manner of weird results including error messages about missing tags or hunks of content disappearing further down the page.

The quick answer, as Jeff says, is to disable Textile piecemeal. Jeff’s shown one way. You can also use notextile.. to start a multi-line block of code (perhaps your code has blank lines in it which may otherwise turn the parser on and off during the block and cause odd results). You can escape back out of the block when your paragraphs resume with the usual p. some text here....

The other way is to start the line on which the troublesome tags start with a couple of spaces. I often do this kind of thing:

Some paragraph text.

  <txp:images category="portfolio">
    <a href="<txp:image_url />" rel="lightbox-smd"><txp:thumbnail /></a>
  </txp:images>

Some more text ...

(note the spaces at the start of each line of code)

You can also surround the entire block with double-equals signs:

==<txp:images category="portfolio">
<a href="<txp:image_url />" rel="lightbox-smd"><txp:thumbnail /></a>
</txp:images>==

If your article contains a lot of TXP tags another option is to turn off Textile entirely for that article (twist open the Advanced Options on the left to reveal the alternatives available) and just manually put HTML tags in where you need them.

The final option is to relegate the block(s) of code to a Form, which means they will not be Textiled at all:

Some paragraph text.

==<txp:output_form form="gallery" />==

Some more text ...

Hope some of that helps.

1 Note to self: write some of this post up as documentation somewhere: is this a Troubleshooting article or should it go in the official Textile documentation (wherever that ends up), or perhaps even in the Write panel prose?

Last edited by Bloke (2010-12-30 14:08:01)


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 2010-12-30 18:44:43

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: [textile] txp:image_url in article body dont work

The lazy man’s guide to turning off textile in an article is right here – maybe this helps too.

Offline

Board footer

Powered by FluxBB