Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-03-30 06:08:41

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,071
Website Mastodon

linking to an image custom field along with another Text custom field

I am trying to create a url link to a custom field along with an image.

So far this code outputs the image with a link. I have tried a number of different code to also output TEXT from another custom field with it’s link. So far i can only output the second custom field as plain text … Objective is to show both pieces of information together and both be links back to the article.

Anyone have any ideas?

<txp:article_custom section="galleries">
<txp:if_custom_field name="pixie">
<li><div class="tab-item-thumbnail"> 
<txp:images id='<txp:custom_field name="pixie" />' form="pixie_form" /> 
<txp:thumbnail link="1" /></div> 
<!-- outout custom cat names -->
<div class="inner">
<txp:custom_field name="pixiecat" />   
</div>
<!-- //outout custom cat names -->
</li></txp:images>  
</txp:if_custom_field>  
</txp:article_custom>

my pixie_form

<txp:permlink><img src="<txp:image_url thumbnail="1" />" /></txp:permlink>

…. texted postive

Offline

#2 2015-03-30 09:15:13

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: linking to an image custom field along with another Text custom field

Hi bici

Try

<txp:article_custom section="galleries">
<txp:if_custom_field name="pixie">
<ul>
<li><div class="tab-item-thumbnail"> 
<txp:images id='<txp:custom_field name="pixie" />'> 
<txp:permlink><img src="<txp:image_url thumbnail="1" />" /></txp:permlink></div> 
<!-- outout custom cat names -->
<div class="inner">
<txp:custom_field name="pixiecat" />   
</div>
<!-- //outout custom cat names -->
</li></txp:images>  
</ul>
</txp:if_custom_field>  
</txp:article_custom>

but I’m not certain if you can have a div element in a li… Also you need a ul which I added.. Having said that, the code seems very messy. What exactly are you trying to achieve?

Last edited by colak (2015-03-30 09:19:39)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2015-03-30 18:34:39

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,071
Website Mastodon

Re: linking to an image custom field along with another Text custom field

colak wrote #289574:

Hi bici

Try

<txp:article_custom section="galleries">...

but I’m not certain if you can have a div element in a li… Also you need a ul which I added.. Having said that, the code seems very messy. What exactly are you trying to achieve?

What i wish to do is to output one thumb-nail image from a series of images that i upload to an image category. I choose the image to output the thumbnail of by inputing the id number into a custom field called pixie. I then output the other custom field from pixiecat

I place the output into the footer of my website.

The output i get is fine as I get this :

 
|—————|
|     |
| image|      TEXT
|     |
|—————|

all is fine – the image is a link but the TEXT is not a link.

If there is another way, for example making the category title a link that would be fine as well


…. texted postive

Offline

#4 2015-03-30 20:33:31

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: linking to an image custom field along with another Text custom field

I don’t understand the context. Is this image in the footer for all articles the same? Or is it for each individual article always another one with its own image category?

Offline

#5 2015-03-31 03:06:28

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,071
Website Mastodon

Re: linking to an image custom field along with another Text custom field

GugUser wrote #289586:

I don’t understand the context. Is this image in the footer for all articles the same? Or is it for each individual article always another one with its own image category?

a footer that is common to all pages. Like i said

colak wrote #289574:

Hi bici

Try

<txp:article_custom section="galleries">...

but I’m not certain if you can have a div element in a li… Also you need a ul which I added.. Having said that, the code seems very messy. What exactly are you trying to achieve?

thanks. your version does what mine did. outputs the image as a link and the text custom field as plain text… i.e. no link.

Last edited by bici (2015-03-31 03:08:07)


…. texted postive

Offline

#6 2015-03-31 03:13:28

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,071
Website Mastodon

Re: linking to an image custom field along with another Text custom field

GugUser wrote #289586:

I don’t understand the context. Is this image in the footer for all articles the same? Or is it for each individual article always another one with its own image category?

The footer is common to all sections i.e. the whole website.
A custom field with an image and a custom field with a TEXT string that i wish to have both rendered as an link. So far the image is a link but the text string is not.

I would settle with having the title of the child category be outputted as a link. So far i haven’t managed to find how to do that.


…. texted postive

Offline

#7 2015-03-31 04:19:20

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: linking to an image custom field along with another Text custom field

So you have an article with his two custom fields only for the footer? If I understand this right, so you can begin your code with the article ID, not with a section name:

<txp:article_custom id="article ID" />

Offline

#8 2015-03-31 04:28:33

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: linking to an image custom field along with another Text custom field

bici wrote #289588:

A custom field with an image and a custom field with a TEXT string that i wish to have both rendered as an link. So far the image is a link but the text string is not.

That seems to be contradictory to me … “both rendered as an link” … “the image is a link but the text string is not”.

I would settle with having the title of the child category be outputted as a link.

Hardcoded in the footer or defined by another custom field?

Offline

#9 2015-03-31 04:43:47

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,071
Website Mastodon

Re: linking to an image custom field along with another Text custom field

GugUser wrote #289590:

That seems to be contradictory to me … “both rendered as an link” … “the image is a link but the text string is not”.

Hardcoded in the footer or defined by another custom field?

by some fluke i have this working as i wish using this code ( I am developing on localhost using MAMP so using my .net local site):

<txp:article_custom section="galleries">
<txp:if_custom_field name="pixie">
<ul>
<li><div class="tab-item-thumbnail"> 
<txp:images id='<txp:custom_field name="pixie" />'> 
<txp:permlink><img src="<txp:image_url thumbnail="1" />" /></txp:permlink></div> 
<!-- outout custom cat names -->
<div class="inner">
<a href="http://bicilogic.net/galleries/<txp:custom_field name="pixiecat" />"><txp:custom_field name="pixiecat" /></a> 
</div>
<!-- //outout custom cat names -->
</li></txp:images>  
</ul>
</txp:if_custom_field>  
</txp:article_custom>

this outputs a column of three (currently) thumbnail images. and in the next column beside each thumbnail a TEXT string (which is the title of the gallery or whatever i choose) and BOTH the image and the text string URL link to the proper article, which is a gallery page of 10 images or more.
And this is dynamic – as i add more thumbs and text they get loaded correctly.

example:

Last edited by bici (2015-03-31 05:21:10)


…. texted postive

Offline

#10 2015-03-31 17:17:24

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: linking to an image custom field along with another Text custom field

Now this is a bit different. In the footer we have an article list with articles from the galleries section. Each link should lead to his individual articles that shows the image gallery. So the thumbnail can be a simple article image and the TEXT an excerpt or a body field content.

Offline

#11 2015-03-31 18:18:39

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,071
Website Mastodon

Re: linking to an image custom field along with another Text custom field

Actually i use the Body of Galleries Articles to input a form:

<txp:images category="wheels " thumbnail="1" form="image-grid" wraptag=""  break=""/>  

and in image-grid I have:

<a href="<txp:image_url />" rel="lightbox"><img src="<txp:image_url thumbnail="1" />" /></a>

Then In order to output a thumbnail of ONE of the images from the gallery category I used the custom field for an image_id and then a custom field for a keyword. which i then populate the footer with as indicated in my code above in my first post.

I am sure there might have been an easier way to have accomplished all this ;-)


…. texted postive

Offline

Board footer

Powered by FluxBB