Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-02-11 16:59:28

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

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

#3 2009-02-11 20:23:32

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,729
Website

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

#4 2009-02-11 20:29:21

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

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

#6 2009-02-12 22:41:48

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

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

#7 2009-02-12 22:51:19

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

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)


My Plugins

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

Offline

#8 2009-02-12 23:05:57

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

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

#9 2009-02-12 23:12:03

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

Re: Image in Link

I used textbook as my reference.


My Plugins

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

Offline

#10 2009-02-13 00:09:31

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#11 2009-02-13 12:30:54

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,729
Website

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

Board footer

Powered by FluxBB