Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-08-18 03:30:40

WebmistressM
Member
Registered: 2011-08-12
Posts: 61

Article Image Thumbnail Hyperlink -- Why Not To Itself?

Wondering how one miight use the article image as a thumbnail link.

I know this code below IS NOT correct as it just links to the article, (like say, from article listing view vs a single article view)

<txp:permlink><txp:article_image thumbnail=“1” /><txp:permlink>

Offline

#2 2011-08-18 04:57:17

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: Article Image Thumbnail Hyperlink -- Why Not To Itself?

You want to link to the image or to the article associated with the image? Your question is unclear.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#3 2011-08-18 05:53:16

WebmistressM
Member
Registered: 2011-08-12
Posts: 61

Re: Article Image Thumbnail Hyperlink -- Why Not To Itself?

I want to link to the article image’s “large” version from a thumbnail.

Offline

#4 2011-08-18 07:57:05

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,001
Website GitHub

Re: Article Image Thumbnail Hyperlink -- Why Not To Itself?

how about?

<a href="<txp:images><txp:image_url /></txp:images>"><txp:article_image thumbnail="1" /></a>

TXP Builders – finely-crafted code, design and txp

Offline

#5 2011-08-18 15:12:10

WebmistressM
Member
Registered: 2011-08-12
Posts: 61

Re: Article Image Thumbnail Hyperlink -- Why Not To Itself?

jakob wrote:

how about?

<a href="<txp:images><txp:image_url /></txp:images>"><txp:article_image thumbnail="1" /></a>

That seems to have worked. Earlier, I had tried to use the txp:images tag but it was producing strange results. I wasnt sure I could put that long bit of txp:images code inside the ahref’s value. Thanks so much for giving me a better clue on how to do this in the future.

Incidentally, my other admin is not as code savvy so I know I could of probably installed hak_tinymce (if it had been working) to make this easier in the future.

Offline

#6 2011-08-18 20:21:44

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,001
Website GitHub

Re: Article Image Thumbnail Hyperlink -- Why Not To Itself?

Wherever possible I try and avoid any site editors from having to insert or even think about code like that. All of the above I put into a page template or form and design the page template so that it respond to whatever is entered in the article_image field (or custom_field, or category and so on). You need to use lots of txp:if… conditionals tags but you end up with a more robust site…

I wasnt sure I could put that long bit of txp:images code inside the a href’s value.

You can use lots of txp:tags in an html tag attribute such as the href in the example above. If you want to use the output of a txp:tag inside an attribute of another txp:tag, you have to place it in single quotes (like in the variable tag in the other thread). You can also use a whole series of tags in that situation (provided you nest them properly) but sometimes it is more readable (= easier to follow when you revisit it at a later date) to put the long details in a variable first, and then insert the variable as the tag in tag, particularly if you need to insert that code more than once.


TXP Builders – finely-crafted code, design and txp

Offline

#7 2011-08-18 21:05:17

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: Article Image Thumbnail Hyperlink -- Why Not To Itself?

If you absolutly HAVE to put code in an article or have site editors do so them smd_macros may help.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

Board footer

Powered by FluxBB