Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
link an image to an article
This is what I’m trying to do:
I have a form that calls an article image to be output here and there throughout the site with the <txp:image id="XX" />
tag.
What I want is to make this image a link to the full article. I have tried:
<txp:article_custom id="XX"><txp:article_image /></txp:article_custom>
,
but this does not work (it was to be expected, since article_custom is a single tag), and after reading all that I’ve found I can’t find an answer.
How could I go about it?
Edit: the FAQ says to post tags in the forum like this: bc..<p>hello</p>
but probably I’m not doing it right since the tags disappear all the same, so I’ve used parentheses instead.
(Edit: updated to properly display code. :) -Mary)
Last edited by Mary (2005-10-31 18:09:28)
Offline
#2 2005-10-31 17:41:09
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: link an image to an article
I haven`t tried it, but you might look at:
<code><txp:permlink><txp:image id=“yourimage” /></txp:permlink></code>
This, in an article form, should link your image to each instance in the list called by your article tags.
Use < code > tags.
Offline
#3 2005-10-31 18:09:36
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: link an image to an article
In your article form: <txp:permlink /><txp:article_image /></txp:permlink>
.
Offline
Re: link an image to an article
Thank you, rsilletti, mary, but none of these works for me.
<code><txp:permlink><txp:image id=“yourimage” /></txp:permlink></code> does not output anything, while
<code><txp:permlink /><txp:article_image /></txp:permlink></code> would require some way to identify which image article to display.
I probably have not made myself clear. The article form as it is now is just 2 lines:
<code> <h4>Recommended</h4> <txp:image id=“52” /></code>.
It is called from a sidebar and displays the image OK. The idea behind this is that the publishers can choose any individual article to display according to the needs of the moment.
Perhaps if I wrap the <code><txp:image id=“52” /></code> with a <code><a href=”here the link to the corresponding article”></code>? … I’m going to try this. It would make the form slightly more difficult to edit for a non-technical publisher, but if it works…
Yes, yes, it works… so that’s it. Easy or what?
Thank you for your interest, and please bear with me, as I’m sure to come back for more. I’m new to Textpattern, but the software is great, the docs are more than good and the help here in the boards rocks!
Last edited by jordi (2005-10-31 19:13:21)
Offline
#5 2005-10-31 19:22:51
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: link an image to an article
If you use an article image, you need to use the article image field (under Advanced Options). From there it’s automatic. Edit: more info
Last edited by Mary (2005-10-31 19:24:21)
Offline
Re: link an image to an article
Yes, this much I understand: if you have the article, you have the article image. What I could not see is how can you select the individual article to display in the sidebar. I think now that the answer is you can’t. If the article depends on the publisher’s whim, the only way I can think is to hardcode the link.
It would be different if I could use <code><txp:permlink id=“here the article ID”></code>, but it does not work like this, does it?
Anyway, now it’s working (you can see it at http://www.poliedro.com/dev/catalogo, the img is the mean looking fellow on the right), and I feel bad about making you spend more time with this. You’re a star.
Last edited by jordi (2005-10-31 19:38:44)
Offline
#7 2005-10-31 20:11:02
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: link an image to an article
The <code><txp:permlink></code> tag, and most article related tags are tied to the currently displayed articles and article lists. If you are linking out from a page, article, or column to a specific article, then the method you are using is probably going to be your best option.
The idea of adding an ID attribute to <code><txp:permlink></code> for that purpose is interesting, you might want to drop a note on Feature Requests for that.
Offline
#8 2005-10-31 20:49:15
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: link an image to an article
“…how can you select the individual article to display in the sidebar. I think now that the answer is you can’t. If the article depends on the publisher’s whim, the only way I can think is to hardcode the link.
It would be different if I could use <txp:permlink id="here the article ID">
”
Uh… <txp:article id="here the article id" />
?
Once append comments is fixed properly (I think it should be in svn, with the if_preview, but I haven’t test that yet), you’ll be able to just use <txp:article />
and it will work, if you turned off auto-append.
Last edited by Mary (2005-10-31 20:49:40)
Offline
#9 2005-10-31 21:39:32
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: link an image to an article
Hmm..
Column
<code><txp:article id=“2” form=“someform” /></code>
Article form “someform”
<code><txp:permlink> content </permlink></code>
would pretty much boil down to <code><txp:permlink id=“2”> content </txp:permlink></code> functionally, wouldn’t it.
Offline
Re: link an image to an article
Well, if anybody else is reading this thread and wants to know the outcome…
I’ve done it as you suggested, using two forms:
1) <code><h4>Recommended</h4><txp:article id=“18” form=“recommended” /></code>, and
2) <code><txp:permlink><txp:article_image /></txp:permlink>
<p><txp:permlink><txp:title /></txp:permlink><br />
by <txp:custom_field name=“author” /></p></code>
It works perfectly, and is so much better than hardcoding the link.
Anyway, I still think that <code><txp:permlink id=“XX”> here any text or img </txp:permlink></code>would be a very intuitive way to place a link anywhere in the body of an article, in a sidebar…
Thank you both. The community spirit here in the boards is priceless.
Last edited by jordi (2005-11-02 16:30:55)
Offline
Pages: 1