Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-04-10 17:28:45

photonomad
Member
Registered: 2005-09-10
Posts: 290
Website

txp:if_first_image error

I’m use Textpattern version: 4.5.5 (r5575) and keep getting the following errors with txp:if_first_image:

Tag error: <txp:if_first_image> ->  Textpattern Warning: tag does not exist while parsing form hc_product on page shop
textpattern/lib/txplib_publish.php:440 trigger_error()
textpattern/lib/txplib_publish.php:339 processTags()
textpattern/publish/taghandlers.php:3076 parse()
textpattern/lib/txplib_publish.php:426 images()
textpattern/lib/txplib_publish.php:339 processTags()
textpattern/lib/txplib_misc.php:1974 parse()
textpattern/publish.php:947 parse_form()
textpattern/publish.php:974 doArticle()
textpattern/publish.php:608 parseArticles()
textpattern/lib/txplib_publish.php:426 article()

This is my code (it is used in an article form):

<ul class="clearing-thumbs clearing-feature" data-clearing>
<txp:images break="">
	<li<txp:if_first_image> class="clearing-featured-img"</txp:if_first_image>>
<a class="th" href="<txp:image_url />"><img data-caption="<txp:image_info />" src="<txp:site_url />images/<txp:image_info type="id" />t<txp:image_info type="ext" />" /></a></li>
</txp:images>
</ul>

I’ve also tried in wrapped in <txp:article> tags in the page template and have used just the image tags in a form for <txp:images.. Same errors each time.

Has anyone else had this problem? What am I doing wrong? Help!

Offline

#2 2014-04-10 17:38:03

sacripant
Plugin Author
From: Rhône — France
Registered: 2008-06-01
Posts: 479
Website

Re: txp:if_first_image error

txp:if_first_image has been categorized in “future tag” and is available from Textpattern 4.6

Offline

#3 2014-04-10 17:40:07

photonomad
Member
Registered: 2005-09-10
Posts: 290
Website

Re: txp:if_first_image error

Oh! Thank you, sacripant. I look forward to utilizing it in the future, then. :)

Offline

#4 2014-04-10 18:16:51

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: txp:if_first_image error

Try if this works:

<txp:variable name="first_image" value="" />
<ul class="clearing-thumbs clearing-feature" data-clearing>
<txp:images break="">
	<li<txp:if_variable name="first_image" value=""> class="clearing-featured-img"</txp:if_variable>
<a class="th" href="<txp:image_url />"><img data-caption="<txp:image_info />" src="<txp:site_url />images/<txp:image_info type="id" />t<txp:image_info type="ext" />" /></a></li>
<txp:variable name="first_image" value="•" />
</txp:images>
</ul>

In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#5 2014-04-10 22:33:10

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: txp:if_first_image error

I’m wrong or should be the following …

<ul class="clearing-thumbs clearing-feature" data-clearing>

… better …

<ul class="clearing-thumbs clearing-feature data-clearing">

… and the following …

src="<txp:site_url />images/<txp:image_info type="id" />t<txp:image_info type="ext" />"

… better …

src="<txp:image_url />"

Offline

#6 2014-04-11 11:33:13

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: txp:if_first_image error

Ah, I totally didn’t look at the code, you’re right.

GugUser wrote #280183:

src="<txp:image_url />"

Or src="<txp:image_url thumbnail="1" />" because of the “t”.

Looking at the tags I assume photonomad might have thought to be restricted to the range of image_info tags and actually liked to use something like <txp:image_info type="thumb_url" />, at least I intuitively dashed against that in the past ;)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#7 2014-04-11 13:25:59

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: txp:if_first_image error

uli wrote #280187:

Or src="<txp:image_url thumbnail="1" />" because of the “t”.

Oh, yes, the “t” I had not noticed.

Offline

#8 2014-04-11 13:29:08

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: txp:if_first_image error

Furthermore, it would be interesting to know by photonomad if your interesting proposal with the variables works in practice.

On the other hand, if that’s just for styling, it would be also possible via CSS with :first-child or one of the new CSS3 pseudo-classes selectors.

Last edited by GugUser (2014-04-11 13:34:39)

Offline

#9 2014-04-11 15:06:10

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: txp:if_first_image error

GugUser wrote #280183:

I’m wrong or should be the following …

<ul class="clearing-thumbs clearing-feature" data-clearing>...

… better …

<ul class="clearing-thumbs clearing-feature data-clearing">...

Probably not. It’s a data attribute and perfectly valid HTML. Its likely part of Foundation as its lightbox component is named ‘Clearing’ and uses exactly those same selectors.

On the other hand, if that’s just for styling, it would be also possible via CSS with :first-child or one of the new CSS3 pseudo-classes selectors.

The selector is part of Foundation. Fortunately it doesn’t anything else than sets the element’s display to block, so you can live without it. If it did do something more complicated you would have to hack Foundation’s Sass source to get rid of it. If Foundation was written in LESS you could just apply the classes’ styles to any other element (as LESS allows calling any defined selectors as mixins).

Offline

#10 2014-06-02 20:03:41

madzzoni
Member
From: Grünberg/Hessen/DE
Registered: 2013-01-22
Posts: 38

Re: txp:if_first_image error

GugUser wrote #280190:

Furthermore, it would be interesting to know by photonomad if your interesting proposal with the variables works in practice.

On the other hand, if that’s just for styling, it would be also possible via CSS with :first-child or one of the new CSS3 pseudo-classes selectors.

Hello there! I also use Foundation(5) as framework for a new TXP project and tried the TXP code above from:

uli wrote #280181:

Try if this works:

<txp:variable name="first_image" value="" />...

The ‘F’5 Clearing-Lightbox’ works for me with this setup:

<txp:variable name="first_image" value="" />
<ul class="clearing-thumbs clearing-feature" data-clearing> 
<txp:images category="hende" break="">
<li<txp:if_variable name="first_image" value=""> class="clearing-featured-img th"</txp:if_variable>
<a class="th" href="<txp:image_url />"><img data-caption="<txp:image_info />" src="<txp:image_url thumbnail="1" />"><txp:image_info type="alt" /></a></li>
<txp:variable name="first_image" value="•" />
</txp:images>
</ul>

But the <txp:variable.../> tag doesn’t work! – I renamed the featured image ‘first_image’ (images/6t.jpg) but I can’t figure out how to show this particular image. It shows all the time the first image in category!
Has anyone an idea?

Thx in advance, Madzzoni

{Edited to add Textile’s bc. for better code formatting. – Uli}


<TXP:n00b />

Offline

#11 2014-06-03 12:50:36

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: txp:if_first_image error

Hi madzzoni,

the variable construct is only used to put some class names into the li around the first image. It’s not responsible for the selection of images.
If you peel off some of the unnecessary things from the code you will remark that the opening li lacks a closing >. (Not your fault, you copied photonomad’s code that I didn’t proofread.) Close that one: If it doesn’t confuse the tag parser it might make some browser stumble.

Have you made sure that the image category “hende” has more than one image?

madzzoni wrote #281199:

I renamed the featured image ‘first_image’ (images/6t.jpg)

Probably a misunderstanding, you don’t need to rename your images in order to make this work.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#12 2014-06-03 14:51:12

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: txp:if_first_image error

Back to the OP, you can easily target and transform the first (second, last…) node with etc_query:

<txp:etc_query data='<txp:images wraptag="ul" break="li">
		<a class="th" href="<txp:image_url />"><txp:thumbnail /></a>
	</txp:images>'
	replace="ul/li[1]@@class=clearing-featured-img;
	ul@@class=clearing-thumbs clearing-feature@data-clearing=" />

Edit: Moreover, you can replace the first thumbnail if needed:

<txp:etc_query data='<txp:images wraptag="ul" break="li">
		<a class="th" href="<txp:image_url />"><txp:thumbnail /></a>
	</txp:images>'
	replace='ul/li[1]@@class=clearing-featured-img;
	ul@@class=clearing-thumbs clearing-feature@data-clearing=;
	ul/li[1]/a=<txp:thumbnail id="6" />' />

Last edited by etc (2014-06-03 15:17:17)

Offline

Board footer

Powered by FluxBB