Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-02-03 10:28:19

Gallex
Member
Registered: 2006-10-08
Posts: 1,315

is this correct code?

this is a article album with captions under thumbnails code. it’s working correctly, but i would like to be sure there is no ‘bugs’.

form:

<h1><txp:title /></h1>
<txp:body />
<txp:if_article_image><txp:images auto_detect="article" form="article_album" wraptag="ul" break="li" class="article-album" /><txp:else /></txp:if_article_image>

form ‘article_album’:

<a class="fancybox" href="<txp:image_url />" rel="<txp:custom_field name="images" />" width="<txp:image_info type="w" />" height="<txp:image_info type="h" />" title="<txp:image_info type="caption" />"><txp:thumbnail /></a>

<txp:image_info type="alt" wraptag="div" class="thumb-alt" />

Offline

#2 2013-02-03 12:36:41

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,549
Website GitHub Twitter

Re: is this correct code?

Hi

in the first code why there is txp:else statement that you dont use??

Offline

#3 2013-02-03 13:42:27

Gallex
Member
Registered: 2006-10-08
Posts: 1,315

Re: is this correct code?

Dragondz wrote:

in the first code why there is txp:else statement that you dont use??

otherwise it outputs all the images from the database if there is no images in a article image field

Offline

#4 2013-02-03 14:43:23

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

Re: is this correct code?

Gallex wrote:

otherwise it outputs all the images from the database if there is no images in a article image field

That’s what the if_article_image tag itself does, not the else tag, Dragondz is right.

But if it’s working: why do you ask? Do you have a potential flaw case in mind?


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

Offline

#5 2013-02-04 08:32:09

Gallex
Member
Registered: 2006-10-08
Posts: 1,315

Re: is this correct code?

uli wrote:

That’s what the if_article_image tag itself does, not the else tag, Dragondz is right.
But if it’s working: why do you ask? Do you have a potential flaw case in mind?

clear. no-no, just wanna use as correct and ‘lightweight’ code as possible. thank’s for checking

Offline

#6 2013-02-05 08:47:09

Gallex
Member
Registered: 2006-10-08
Posts: 1,315

Re: is this correct code?

actually, the width="<txp:image_info type="w" />" and height="<txp:image_info type="h" />" are unnessecary there and they don’t validate for html5 as well. removed.

final article_album form code

<a class="fancybox" href="<txp:image_url />" rel="<txp:custom_field name="images" />"  title="<txp:image_info type="caption" />"><txp:thumbnail /></a>
<txp:image_info type="alt" wraptag="span" class="thumb-alt" />

Last edited by Gallex (2013-02-05 08:48:20)

Offline

Board footer

Powered by FluxBB