Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2010-12-01 16:10:11
- pictura
- Member
- Registered: 2010-10-31
- Posts: 12
Linking an image to an article
Hi all,
This is an elementary question, but I cannot find the answer, neither here nor in “Textpattern Solutions” book I have. I found similar queries, tried to piece together different solutions based on them, but after hours of trying have come up with nothing.
I have an image on my default Page:
<div><txp:image id=“176” /></div>
I want this image to be linked to an article:
<txp:article id=195 />
How do I do this? (I am trying to do this from a PAGE not from an ARTICLE). The txp:image tag does not have a hyperlink attribute.
I tried using <a href=”<txp:article id=195 />” etc. but could not get it to work. Any help will be greatly appreciated. This surely is a common requirement – yet I cannot find direct documentation. Have I missed something?
thanks in advance
Pictura
Offline
#2 2010-12-01 16:31:12
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: Linking an image to an article
<div><txp:permlink id="195"><txp:image id=“176” /></txp:permlink></div>
Offline
#3 2010-12-01 16:39:46
- pictura
- Member
- Registered: 2010-10-31
- Posts: 12
Re: Linking an image to an article
Redbot,
Thanks a million!
rgds
Pictura
Offline
#4 2010-12-01 20:05:11
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Linking an image to an article
Offline
#5 2010-12-06 13:02:15
- pictura
- Member
- Registered: 2010-10-31
- Posts: 12
Re: Linking an image to an article
Hi, again,
A new problem has arisen. I successfully used the suggested:
<div><txp:permlink id=“195”><txp:image id=“176” /></txp:permlink></div> to link an image on home page to a static article I created
It worked fine – until I posted a new article – now when you click on the image it goes to article id=196 (the latest article) even though the permlink id=“195”.
The SECTION selected for article 195 is misc_links
The page text pattern is instructed to use for misk_links is static_page
The static_page template has the following code:
<txp:article_custom form=“static_text” limit=“1” />
The form in question (where the problem surely must lie) has the following:
<div>
<h1><txp:title /></h1>
<txp:body />
</div>
There is obviously something basic wrong here even though I followed the guidelines in Textpattern Solutions book for creating static articles.
What surprised me the most was the fact that the image relinked to an article belonging to a different section altogether.
To summarise what I think I was doing when I put the above together:
The link is being told to source ARTICLE 195 which TextPattern knows must be opened with STATIC PAGE template. And the STATIC PAGE template has the instruction to display the title and body of the selected article (which txp:permlink has already identified as article no 195).
Could someone kindly tell me what my mistake is?
regards
pictura
Offline
#6 2010-12-06 15:17:08
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,315
Re: Linking an image to an article
Are you sure the permlink’s ID is set at all? From Textbook:
Default: unset (current article).
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Linking an image to an article
Basic question, but did you use straight quote marks? I.e.,
<div><txp:permlink id="195"><txp:image id="176" /></txp:permlink></div>
and not
<div><txp:permlink id=“195”><txp:image id=“176” /></txp:permlink></div>
I ask only because your example code uses curly quotes. I realize this could simply be Textile in the forum converting your straight quotes to curly ones.
Code is topiary
Offline
#8 2010-12-06 15:35:36
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: Linking an image to an article
Does changing
<txp:article_custom form=“static_text” limit=“1” />
with:
<txp:article form=“static_text” limit=“1” />
change something?
Offline
#9 2010-12-06 15:56:36
- pictura
- Member
- Registered: 2010-10-31
- Posts: 12
Re: Linking an image to an article
Thank you all for you input!
redbot you are right, it has worked to change txp:article_custom to txp:article. So thanks! But why? I am intrigued to know why.
best wishes
pictura
Last edited by pictura (2010-12-06 15:57:11)
Offline
#10 2010-12-06 16:02:50
- pictura
- Member
- Registered: 2010-10-31
- Posts: 12
Re: Linking an image to an article
Redbot, I think I understand now, you need not answer the question, thanks.
Offline
Pages: 1