Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-12-31 19:25:54

dressedinvalue
Member
From: Louisville, KY
Registered: 2008-12-31
Posts: 21

Output URL of any article, anywhere

Is there a way to dynamically output the URL (or maybe just the “URL-only title”) of an article?

I don’t need to get the URL of the current page, I need to dynamically get the URL for a variable article that is being output.

Specifically, I’m working on this website, and when I set an article to a certain category (‘featured work’) the Featured Work image on the homepage will display the newest article in the ‘featured work’ category, and I’m hoping that I can automatically set it to fill in the link to the article.

Does that make sense?

Offline

#2 2008-12-31 19:43:44

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Output URL of any article, anywhere

If I understand your question correctly, I’d do something like:

on the default page (i.e., the template for the home page):

<div id="featured">
<h3>Featured Work</h3>
<txp:article_custom limit="1" category="featured-work" form="featured_link" />
</div>

then create an article form called “featured_link”:

<txp:permlink><txp:article_image /></txp:permlink>

Assign the image to the article as an article image (Content->Write->Advanced Options) and you’re set.

Last edited by jsoo (2008-12-31 19:48:41)


Code is topiary

Offline

#3 2009-01-01 01:29:52

dressedinvalue
Member
From: Louisville, KY
Registered: 2008-12-31
Posts: 21

Re: Output URL of any article, anywhere

This is perfect, and a lot less complicated than I figured it’d be, thanks!

Only thing I need to do from here is edit the default folder of which txp:article_image pulls from (it defaults to the main/root folder). I’d like to organize it a bit more and put it in /images/featured/ or something. Is there a way to change that?

Offline

#4 2009-01-01 02:15:47

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Output URL of any article, anywhere

You can change the name and/or location of the images directory, but I don’t know that TXP can handle a nested image directory or multiple image directories. I don’t know of any plugins that allow this either, but there might well be one. You can at least browse images by category (or various other fields) in the Content->Images tab.


Code is topiary

Offline

#5 2009-02-18 19:30:47

dressedinvalue
Member
From: Louisville, KY
Registered: 2008-12-31
Posts: 21

Re: Output URL of any article, anywhere

For what it’s worth, I ended up not using the Article Image for what I was trying to do. I just made another custom field called FeaturedWorkImage and am pulling that in.

Offline

Board footer

Powered by FluxBB