Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Image in Link
Hi, I’m planning on using TXP’s link manager to create a list of games and a list of music!
How can I get an image inside a link?
~ Cameron
Offline
#2 2009-02-11 18:11:17
- candyman
- Member
- From: Italy
- Registered: 2006-08-08
- Posts: 684
Re: Image in Link
I think that you may find useful this tutorial.
Offline
Re: Image in Link
I think you mean attach an image of a product or music to your link? Some ideas:
- Use upm_textile to parse the link description and link to your image manually using textile in the description.
- place the ID-number of a previously-uploaded image in the link description and use one of the search and replace plugins like rah_replace or pax_grep to replace it with an image link.
- Abuse the sort-order field for storing the image-ID number to create a link as above (using wet_linkinfo).
- If you want to show the target website, you can use a service like snap shot.
Last edited by jakob (2009-02-11 20:26:17)
TXP Builders – finely-crafted code, design and txp
Offline
Re: Image in Link
Just use any of link fields to store image id. After this you can get image with, for example, smd_gallery…
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
#5 2009-02-11 20:29:58
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Image in Link
Or just put the html tag for the image in the description field (<img src="blah" />
) and use <txp:link_descripion escape="" />
to display it.
Offline
Re: Image in Link
Okies so I’ve gone with Els one, because it seemed the most simple and powerful of the lot!
Here is my code for the actual link form:
<li><a title="<txp:link_name />" href=""><txp:link_description escape="" /></a></li>
How do I get it so that my images have a link on them, I don't want any titles appearing, just the image?
~ Cameron
Offline
Re: Image in Link
driz wrote:
How do I get it so that my images have a link on them, I don't want any titles appearing, just the image?
You want to associate an image to a link you’ve entered in the links tab right? You could put the image id in description field or even the name field and then update your form with something like this.
<li><a title="<txp:link_name />" href="<txp:link_url />">
<txp:image id='<txp:link_description escape="" />'/>
</a></li>
Or are you just missing <txp:link_url />
from your code?
Last edited by MattD (2009-02-12 22:52:48)
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
Re: Image in Link
Ah! The link_url isn’t in the Tag Creator for TXP, thats why I didnt see it :)
That code above is fucking rad, works a charm :) Thanks. x
Last edited by driz (2009-02-12 23:11:50)
~ Cameron
Offline
Re: Image in Link
I used textbook as my reference.
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
Re: Image in Link
I come with this idea (not tested, may fail), that may look like a hack:
In in any link field:
For example, in the link title field:
Textpattern.com <txp:variable name="link_image" value="XX" />
where XX is a valid ID for an image upload on TXP interface.
Or in the link description field:
<txp:variable name="link_image" value="XX" /> <!-- where XX is a valid ID for an image upload on TXP interface -->
... and here you can put a description text + HTML...
Then, if you used the txp:variable
inside the title (aka link_name
) in the linklist form (or inside a wrapping linklist):
<txp:link_name />
<a href="<txp:link_url />"><txp:image id='<txp:variable name="image_link" />' /></a>
When txp:link_name
is parsed, the variable should be created, and then used immediately right below, as an attribute for txp:image
…
Can someone test this, please? Thanks.
Then, when you
Last edited by maniqui (2009-02-13 00:10:03)
Offline
Re: Image in Link
You want to associate an image to a link you’ve entered in the links tab right? You could put the image id in description field or even the name field and then update your form with something like this.
<li><a title="<txp:link_name />" href="<txp:link_url />"> <txp:image id='<txp:link_description escape="" />'/> </a></li>
This is the same as what Ghost or I suggested above, but sacrifices the ability to have a description.
Not tried maniqui’s solution. It will depend on whether the title/name is actually parsed.
TXP Builders – finely-crafted code, design and txp
Offline
Pages: 1