Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#21 2020-04-11 08:09:23

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,810
Website

Re: Display single image from an article

code365 wrote #322572:

This what I did: I went to content->categories->Images; created an image categories name adirondack-chair-set. I uploaded five images into adirondack-chair-set categories.

Thanks for that! We are talking at cross purposes. The code I mentioned / colak provided above assumes article categories, not image categories as it’s the default setting for the type attribute. See the docs for txp:category.

Do you get what you want with

<txp:image name='<txp:category type="image" />' />.jpg" />

To be honest, I’m not sure that will work. You might also need to add type="image" to the category_list tag further up in your code but that may change your menu as well.

If that is the case, you may need to go back and look at how you have organised your site. You can always test these things yourself by outputting txp:category /> on its own (i.e. not as a tag-in-tag) to see what it is giving you.

… It will not display the first image from the article out of the five.

That is a different thing. The discussion we have been having on most of this thread has been about outputting an image ‘linked’ (by name) to the current category (of type article).
In a typical situation, you’d have articles assigned to that category. If you want the image of the first article assigned to that (article) category, go back to colak’s first post. Note: you may need to change the sort order (or date) of your articles to get them to show in the desired order.


TXP Builders – finely-crafted code, design and txp

Offline

#22 2020-04-12 03:50:34

code365
Member
From: California
Registered: 2009-08-16
Posts: 69

Re: Display single image from an article

@jakob and colak thank you so much for your help and time. I understand you guys have been long time txp experts. I will make a donation to txp. If their anyway I can promote txp let me know, it would be my pleasure. Who do I make donation to because I don’t see you guys names.

I am still a txp student :)

Last edited by code365 (2020-04-12 03:52:45)

Offline

#23 2020-04-12 09:21:46

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,810
Website

Re: Display single image from an article

No donation necessary for me personally, but if you want to donate to TXP development, you can find Textpattern’s Donate page on the textpattern homepage (there’s a “Donate” button at the bottom of the main homepage).


TXP Builders – finely-crafted code, design and txp

Offline

#24 2020-04-12 09:48:30

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,905
Website

Re: Display single image from an article

jakob wrote #322583:

No donation necessary for me personally, but if you want to donate to TXP development, you can find Textpattern’s Donate page on the textpattern homepage (there’s a “Donate” button at the bottom of the main homepage).

+1


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB