Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Article Image
I have the following code in my port_list form:
<txp:custom_field name="portfolio_filter" escape="" />
<txp:article_image wraptag="p" class="img-fluid" alt=""/>
<div class="portfolio-info">
<h4><txp:title /></h4>
<p><strong>Role: </strong> <txp:excerpt /></p>
<a href="./images/2.png" title="<txp:title />" data-gallery="portfolio-gallery-app" class="glightbox preview-link"><i class="bi bi-zoom-in"></i></a>
every thing is working as expected but I cannot manage to add Txp tag code to replace the string ./images/2.png
I have tried various combo Txp tags but either the href link is malformed or it fails to correctly display the image.
I was thinking of using a custom form and manually type in the “./images/##.png” so that can I use <a href=”<txp:custom_field name=“image _link/>” title=”<txp:title />” etc. But perhaps there is a simpler option.
PS: The article image is always the same id as what I wish to add to the href area. i.e. image id 2 in this example and is displayed in a larger format when link is clicked (I don’t create thumbnails).
Last edited by bici (Today 00:16:18)
…. texted postive
Offline
Re: Article Image
UPDATE.
I am trying out using a custom form as it seems like a good easy solution.
But I wonder why I am getting the actual string output as well as the directory is correctly output:
<a href=”<txp:custom_field name=“image _link/>” title=”<txp:title />”
in my custom field I have ./images/2.png
and the url / link is correctly rendered and I can click on the image link and it renders the image. But i also get the string ./images/2.png rendered on the page? How can I avoid that from happening?
this is the output
./images/2.png
<a href="./images/2.png" title="Sample Logo" data-gallery="portfolio-gallery-app" class="glightbox preview-link">
Last edited by bici (Today 00:17:56)
…. texted postive
Offline
Re: Article Image
Hi bici,
I guess you are would like to add a lightbox to your site. Your list form appears to be incomplete as there are no closing tags for custom_field and article_image tags.
You can try
<txp:hide>add one or more comma separated ids in your article image</txp:hide>
<txp:variable name="image" value='<txp:custom_field name="article_image" />' />
<txp:images id='<txp:variable name="image" />'><a href=">/images/<txp:image_info type="id" /><txp:image_info type="ext" />title="<txp:title />" data-gallery="portfolio-gallery-app" class="glightbox preview-link"><txp:thumbnail />' /></a></txp:images>
if you actually wish to use the lightbox I linked abobe use
<txp:hide>add one or more comma separated ids in your article image</txp:hide>
<txp:variable name="image" value='<txp:custom_field name="article_image" />' />
<ul class="box-container three-col">
<txp:images id='<txp:variable name="image" />'><li class="box"><div class="inner"><a href=">/images/<txp:image_info type="id" /><txp:image_info type="ext" />title="<txp:title />" data-gallery="portfolio-gallery-app" class="glightbox preview-link"><txp:thumbnail /></a></div></li></txp:images>
</ul>
Edited to add that instead of <txp:title /> I would use <txp:image_info type="alt" /> as it will provide the images their own distinct alt tags.
Last edited by colak (Today 03:27:06)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Pages: 1