Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-04-23 19:58:01
- wchung
- Member
- Registered: 2009-04-23
- Posts: 29
Automating Images Hyperlinked to Most Recent Article on Home Page
I have just installed Textpattern.
I would like to have about 6 images on my home page, each of different dimensions, each with a caption and each hyperlinked to the most recent article of each section on our site.
So I guess I have 2 basic questions:
1) What is the tag for automatically calling the most recent image of a designated section to appear on a non-article page with the caption associated with it?
2) How can I get that image to be automatically linked to the article of my choice?
I don’t see anything in the Images upload dialogue that allows me to hyperlink an article to it.
Incidentally, I seem to have somehow caused the Image upload box to automatically generate a thumbnail which I do not want. Is there a way to prevent that?
I know these are probably very basic questions, but I have been wasting a lot of time unsuccessfully searching for the answers without success! So any suggestions would be greatly appreciated!
Offline
#2 2009-04-23 21:40:51
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Automating Images Hyperlinked to Most Recent Article on Home Page
To display the image caption you need a plugin: upm_image.
To answer your questions it’s important to know if an image will always be linked to the same article? Or if you say ‘link the most recent image to the most recent article in a section’ is it possible that the most recent image will remain the same while articles are being added?
Regarding the thumbnail creation: the values for width and/or height used for the most recently created image thumbnail are remembered, that’s why for every image you add afterwards a thumbnail is created. This is a way (not very intuitive, but I don’t know a better one) to get rid of it:
- go to the latest image
- clear the values in the width and height fields
- delete the thumbnail (there is a small delete button next to it)
- save the image
For the next image you upload no thumbnail will be created. You’ll have to delete manually the other already existing ones though.
Offline
#3 2009-04-23 22:11:05
- wchung
- Member
- Registered: 2009-04-23
- Posts: 29
Re: Automating Images Hyperlinked to Most Recent Article on Home Page
Els, thanks for your response.
Each image will always be linked to the same article. We just want to be able to have each home page image/link updated automatically for each section as we add a new article. Currently we are having to manually ftp up each image, then manually hyperlink it to each article.
Your help is greatly appreciated!
Offline
#4 2009-04-23 23:05:19
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Automating Images Hyperlinked to Most Recent Article on Home Page
In that case, use the article image field. Get the upm_image plugin (read the plugin help!) and use something like this on your default page template:
<txp:article_custom limit="1" section="yoursection1" form="article_img" />
<txp:article_custom limit="1" section="yoursection2" form="article_img" />
<txp:article_custom limit="1" section="yoursection3" form="article_img" />
...etcetera
Articles are sorted by date posted descending by default, so this will always display the latest article for each section. In the article form ‘article_img’ you determine which parts of the article will be displayed, in this case that is just the article image, linked to the full article, and it’s caption.
Article form ‘article_img’:
<txp:permlink>
<txp:article_image />
</txp:permlink>
<txp:upm_article_image>
<p><txp:upm_img_caption /></p>
</txp:upm_article_image>
Last edited by els (2009-04-23 23:07:51)
Offline
#5 2009-04-23 23:26:30
- wchung
- Member
- Registered: 2009-04-23
- Posts: 29
Re: Automating Images Hyperlinked to Most Recent Article on Home Page
Els,
Wow, that’s exactly what I needed!
Thanks, dude. You’ve saved me untold anguish and self-doubt!
Offline
#6 2009-04-23 23:58:47
- wchung
- Member
- Registered: 2009-04-23
- Posts: 29
Re: Automating Images Hyperlinked to Most Recent Article on Home Page
Els, I tested your suggestion but don’t see either the image or the caption.
I also noticed that I was not able to see a caption on just the image entry itself.
The page I am testing is at http://goldsea.com/Test/
Thanks…
Offline
#7 2009-04-24 00:05:50
- wchung
- Member
- Registered: 2009-04-23
- Posts: 29
Re: Automating Images Hyperlinked to Most Recent Article on Home Page
Wait… I take that back. It does work when I put the image number into the Images blank, but not when I place the image id tag into the body of the article input blank.
Offline
#8 2009-04-24 00:17:45
- wchung
- Member
- Registered: 2009-04-23
- Posts: 29
Re: Automating Images Hyperlinked to Most Recent Article on Home Page
Is there any way to have the image on the home page be a different size than the image in the article itself, e.g. by calling a slightly smaller “thumbnail” of the image? I’m not sure if that’s possible, or if it is, what the call tag would be. Or maybe there’s some way to specify a size for the version displayed on the home page?
What about where the article has more than 1 picture? Is there a way to specify the first of a series of pictures?
Also, is there some way to have the caption on the home page be a different one from the caption in the actual article, since the actual article has a longer caption than I would want to place on the home page.
And finally, to avoid the problem of having a special section, is it possible to use the category tag instead?
Offline
Re: Automating Images Hyperlinked to Most Recent Article on Home Page
Is there any way to have the image on the home page be a different size than the image in the article itself, e.g. by calling a slightly smaller “thumbnail” of the image?
Yes, use the thumbnail of the image in the image tab for your other sized image. As you’re using upm_image, then use upm_article_image
with the attribute type="thumbnail"
to display the thumbnail version.
What about where the article has more than 1 picture? Is there a way to specify the first of a series of pictures?
You can enter a comma-separated list of images into the article image field in the write tab, e.g. 1,3,4,8
. If you’re using upm_image, you can use upm_article_image
with the attribute limit="1"
to display only the first image in the series.
Also, is there some way to have the caption on the home page be a different one from the caption in the actual article, since the actual article has a longer caption than I would want to place on the home page.
I guess the easiest way for this would be to enter different text in the alt-text field and the caption-field for each of your images (in the images tab), then use <txp:upm_img_alt />
for one situation and <txp:upm_img_caption />
as Els showed above for the other.
And finally, to avoid the problem of having a special section, is it possible to use the category tag instead?
Yes, in Els’ example above substitute section="yoursection"
for category="yourcategory"
in the txp:article_custom tag (see the article_custom help for more details). You’ll need to assign an appropriate category to your articles and if you don’t want them to appear in a particular section, assign them to your default section.
TXP Builders – finely-crafted code, design and txp
Offline
#10 2009-04-24 12:33:31
- wchung
- Member
- Registered: 2009-04-23
- Posts: 29
Re: Automating Images Hyperlinked to Most Recent Article on Home Page
Wow! My prayers answered!
Thanks, Jakob, you’ve ended my suffering.
Offline