Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2015-05-12 20:19:22
- pierlu
- Member
- Registered: 2014-08-12
- Posts: 153
link ad articoli
Come si fa a creare un link ad un determinato articolo.
Nella ho 6 foto e ognuna di quelle foto deve puntare un articolo. Se mi potete aiutare vi ringrazio tanto!
Offline
Re: link ad articoli
I’m not sure where you want to create your links. If you just want to add a link to an image in your body field, you can do this:
"!/img/image-name.jpg!":/section/page-name
where !/path-to/image-name.jpg!
shows the image and "…":/section/article-name
is the textile link to the article url.
Reference:
If you want to make those links to articles appear in a page template or form, you can do:
<txp:permlink id="123"><txp:image id="456" /></txp:permlink>
where 123
is the id of the article, and 456
is the id of the image in the image pane.
If you want this in a form that is called using txp:article or txp:article_custom, the id will be handled automatically, so you could have:
<txp:article_custom section="my-section" wraptag="ul" break="li">
<txp:permlink>
<txp:image id='<txp:custom_field name="article_image" />' />
</txp:permlink>
</txp:article_custom>
which displays a list of linked images to articles in the my-section
section using the image-id number you put in the article-image field of your article. If you want just the thumbnail, then use txp:thumbnail
instead of txp:image.
I hope that helps!
Reference:
TXP Builders – finely-crafted code, design and txp
Offline
#3 2015-05-13 15:57:18
- pierlu
- Member
- Registered: 2014-08-12
- Posts: 153
Re: link ad articoli
Il modulo che ho è il seguente, ciascuna immagine che sono nella div .paeseimg ,devono puntare i rispettivi articoli (sezione paesi e categori frazioni.+
Es l’immagine di “molazzana.jpg” deve puntare l’articolo id=“2” sezione=“paesi” categoria=“frazioni”
Come si può scrivere?
Il seg codice è quello che scritto io ma non funzionaù
Grazie
<txp:article_custom limit="1" section="paesi" category="capoluogo">
<h1><txp:title /></h2>
</txp:article_custom>
<div class="fotoPaesi">
<txp:article_custom limit="3" section="paesi" category="frazioni">
<div class="paese">
<div class="paeseImg">
<img src="images/molazzana.jpg">
</div><!-- paeseImg -->
<div class="paeseNome">
<h2><txp:title /></h2>
</div><!-- paeseNome -->
</div> <!--paese-->
</txp:article_custom>
<txp:article_custom limit="3" offset="3" section="paesi" category="frazioni">
<div class="paese lastRow">
<div class="paeseImg">
<img src="images/cascio.jpg">
</div><!-- paeseImg -->
<div class="paeseNome">
<h2><txp:title /></h2>
</div><!-- paeseNome -->
</div> <!--paese-->
</txp:article_custom>
Offline
Re: link ad articoli
Given that you uploaded the images via ftp and not the txp interface try:
<txp:article_custom limit="1" section="paesi" category="capoluogo">
<h1><txp:title /></h1>
</txp:article_custom>
<div class="fotoPaesi">
<txp:article_custom limit="3" section="paesi" category="frazioni">
<div class="paese">
<div class="paeseImg">
<img src="/images/molazzana.jpg">
</div><!-- paeseImg -->
<div class="paeseNome">
<h2><txp:title /></h2>
</div><!-- paeseNome -->
</div> <!--paese-->
</txp:article_custom>
<txp:article_custom limit="3" offset="3" section="paesi" category="frazioni">
<div class="paese lastRow">
<div class="paeseImg">
<img src="/images/cascio.jpg">
</div><!-- paeseImg -->
<div class="paeseNome">
<h2><txp:title /></h2>
</div><!-- paeseNome -->
</div> <!--paese-->
</txp:article_custom>
But maybe I misunderstood what you need.
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: link ad articoli
If you meant the image molazzana.jpg
must be associated with article id number 2 (and so on for other articles), the easiest way to associate an image with an article is to use the article_image field.
Example:
1) Edit your article id #2 in top’s admin area and put /images/molazzana.jpg
in the field and save.
2) Then to include the image in your form, do:
<div class="paeseImg">
<txp:article_image />
</div><!-- paeseImg -->
I think that tag will accept both an id number or the url, so it should work. And if you need the thumbnail, then use (EDIT: that won’t work with own urls) <txp:article_image thumbnail="1" />
.
But if you find it’s not working, try:
<div class="paeseImg">
<img src="<txp:custom_field name="article_image" />">
</div><!-- paeseImg -->
Does that help?
TXP Builders – finely-crafted code, design and txp
Offline
#6 2015-05-13 20:55:55
- GugUser
- Member
- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,473
Re: link ad articoli
jakob wrote #290748:
(…) and if you need the thumbnail, then use
<txp:article_image thumbnail="1" />
.
And from where comes the thumbnail in this context?
Offline
Re: link ad articoli
And from where comes the thumbnail in this context?
You’re right: with an own url that can’t work (I’ll edit my post).
TXP Builders – finely-crafted code, design and txp
Offline
#8 2015-05-13 21:03:15
- GugUser
- Member
- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,473
Re: link ad articoli
;-)
Offline
Pages: 1