Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
How to have Category Images thumbnails link to article post
I was wanting to have a list of category of category images be able to link to the article post.
I used this to output ONE thumbnails from each of my categories and have the thumbnails appear in the footer area of my site.. i.e. the footer applies to all pages/sections.
<txp:category_list type="image" exclude="site-design,ArtHeader,articles,Midbar," wraptag="" break="li" class="image_categories">
<div class="tab-item-thumbnail">
<txp:category section="">
<txp:images category='<txp:category />' limit="1">
<img src="<txp:image_url thumbnail="1" />" alt="" title="<txp:category title="1" />" />
</div>
</txp:images>
</txp:category>
<div class="tab-item-inner group">
<txp:category title="1" link="1" wraptag="p" class="tab-item-category" />
</div>
</txp:category_list>
So far that is working fine.
I then use a form to pull all the images by category to my mine Galleries Section and to its categories: Galleries, Demo, Foot, Hand, Arms etc,
But the above code doesn’t actually link back to the Section/category… i.e. mystite.net/galleries/foot
instead IF i am currently on the Galleries sections i get a URL of the form http://mysite.net/galleries/?c=demo&context=image which links to my category Demo and shows the image in full size …not what i want.
If i click on the category image while on any other section the url is of the form: http://mysite.net/category/image/demo/ and i get a blank page.
So how can one have category images appear across the site and be able to click on the image and or category title and to go to the page that tconatins all the image from demo the category?
Does this make sense? Doable ?
…. texted postive
Offline
Re: How to have Category Images thumbnails link to article post
That is because the categories are section sensitive. I am wondering if it could be “fixed” if you replaced
<txp:category title="1" link="1" wraptag="p" class="tab-item-category" />
with the following <txp:category title="1" section="" link="1" wraptag="p" class="tab-item-category" />
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: How to have Category Images thumbnails link to article post
colak wrote #288771:
That is because the categories are section sensitive. I am wondering if it could be “fixed” with this:
<txp:category title="1" section="" link="1" wraptag="p" class="tab-item-category" />
thanks for the suggestion. but that code renders this URL: http://mysite.net/category//demo/ rather than http://mysite.net/galleries/demo/
Wonder why the double slashes?
…. texted postive
Offline
Re: How to have Category Images thumbnails link to article post
Hi bici, what if you use an htaccess rule. Something like
Redirect 301 /galleries/?c=demo&context=image /category/image/demo/
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: How to have Category Images thumbnails link to article post
the .htaccess rule doesn’t do it either. The more i think about it there should be some way of going from a category image to the Article in which that image is placed in. But there doesn’t seem to be an easy intuitive way to do it. Is this something for the tag folks to add?
also why doesn’t this URL work: http://mysite.net/galleries/?c=demos
it fails to go to http://bicilogic.net/galleries/demos
does ?c=demos not mean the category demos under the parent galleries?
…. texted postive
Offline
Re: How to have Category Images thumbnails link to article post
While i have never figured out why the form of the URL with a “?c=” never worked. i did find a solution to what i wanted to do …. I decided to use a custom_field to hold an image
And thanks to MattD i have it working as i had intended….w00t!!
…. texted postive
Offline
Re: How to have Category Images thumbnails link to article post
As you’ve noticed, you need some way of informing txp that there is a link between an article and image category. That can be by placing an identifier in the article like you’ve done in the other thread, e.g. the category name or an image_id in a custom field, or by making the names of your category match the link that you want to go.
For example, if you name your image category name the same as your section name (or your article url title depending on what you want), then you can you do almost what you did but you’ll need to manually make your own links, i.e. not using the link="1"
attribute:
<txp:category_list type="image" exclude="site-design,ArtHeader,articles,Midbar," wraptag="ul" break="li" class="image_categories">
<div class="tab-item-thumbnail">
<txp:images category='<txp:category />' limit="1">
<img src="<txp:image_url thumbnail="1" />" alt="<txp:category title="1" />" />
</txp:images>
</div>
<div class="tab-item-inner group">
<p class="tab-item-category">
<a href="<txp:site_url /><txp:category />">
<txp:category title="1" />
</a>
</p>
</div>
</txp:category_list>
This example maps the image category name to the section. You may need to adapt the a href="{your url structure}"
to match your site design, e.g. <txp:site_url />fruit/<txp:category />
if you want the image categories apples
, pears
and oranges
to map to the articles with url title apples
, pears
and oranges
…
TXP Builders – finely-crafted code, design and txp
Offline
Re: How to have Category Images thumbnails link to article post
Thank-you Jakob! this is very usefull and i can apply this to another area of my site. I had tried t avoid any manual intervention but for this case it will do.
…. texted postive
Offline