Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-03-05 13:32:29

antonhor
New Member
Registered: 2009-03-05
Posts: 7

section list issue - passing article id to a section link?

Hello

i’m trying to figure out a way out of this problem:

my articles display information about artists, so i use title field for the artist name, body for the artist presentation, and excerpt field for the artist bio. I’ve created a page that diplays a list of all the artists. I also created some sections named: work, presentation, bio – and assigned them the pages that have respective tags to display the info. for example: a page with <txp:title/> <txp:body/> to display the presentation text and a name of the artist.

If i add the tag section list to those pages, they all display links to all the sections. But the link goes to the general page (for example presentation) and the page displays the presentation 8body field) of the last added article. Is there any way to pass the id of the article to another section page, in the way that the linked page displays the info of that article, and not any article in the database.

Maybe it’s a simple thing to do but i’m a newbie…

Thnx a lot

Offline

#2 2009-03-05 14:04:44

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

Re: section list issue - passing article id to a section link?

I don’t think you can do this in combination with section_list, but you could manually assemble the links, something like this (for the default /section/id/title URL scheme):

<a href='<txp:link_to_home />work/<txp:article_id />/<txp:article_url_title />'>Work</a>

Code is topiary

Offline

#3 2009-03-05 19:35:46

antonhor
New Member
Registered: 2009-03-05
Posts: 7

Re: section list issue - passing article id to a section link?

thanx for a reply.
that works only in the case that i duplicate the artist article and assign it to another section.(for example bio). articles assigned to a section don’t really appear if you call them by name in another section. At least it seams so..
I could actualy do diffrent articles for biography presentation and works, but i hoped that there is a way of asigning an article to different sections. Otherways i have 6 articles for an artist (2 languages) the thing that i wanted to avoid :)

any other ideas?
anyway thanx a lot

Offline

#4 2009-03-05 21:44:13

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

Re: section list issue - passing article id to a section link?

Sorry, I didn’t think that through very well. You’re quite right that an article will only appear in its assigned section.

What exactly are you trying to achieve? I gather you want to have a list of artists by name, with the ability to link to various pages for each artist: work, presentation, and bio.

One approach is to make a category for each artist. It’s kind of an abuse of categories, and has definite limitations, but has certainly been done. Then you make separate articles for work, bio, and presentation for each artist, and link them all by category.

Another approach is to arbitrarily assign related articles. I have done this using a custom field in conjunction with the sed_pcf_for_each_value plugin.


Code is topiary

Offline

#5 2009-03-05 23:08:45

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: section list issue - passing article id to a section link?

antonhor wrote:

The traditional way would be to separate the information into different articles and sections.

However, maybe you could have all the articles in one section only but present links to those individual articles requesting different information in other sections.

Maybe adi_link & adi_gps would help?

For example, on the main page:

<txp:article>
  <txp:title/>
  <txp:adi_link section="presentation" urlvars='artist_id=<txp:article_id />' link_text="Presentation" />
  <txp:adi_link section="bio" urlvars='artist_id=<txp:article_id />' link_text="Bio" />
</txp:article>

Above, the link to Presentation becomes …/presentation/?artist_id=xx, where xx is the id of the artist’s article.

Then on the Presentation page, retrieve the article id from the URL and output it’s body:


<txp:adi_gps name="artist_id" quiet="1" />
<txp:article_custom id='<txp:variable name="artist_id">
  <txp:title />
  <txp:body />
</txp:article>

And on the Bio page, retrieve the article id from the URL and output it’s excerpt:


<txp:adi_gps name="artist_id" quiet="1" />
<txp:article_custom id='<txp:variable name="artist_id">
  <txp:title />
  <txp:excerpt />
</txp:article>

Offline

#6 2009-03-06 15:34:22

antonhor
New Member
Registered: 2009-03-05
Posts: 7

Re: section list issue - passing article id to a section link?

wow!
THANX a LOT to both of you, this will surely help!
actually the thing that i was looking for is similar to the gomedia’s solution.
I thought that there should be some kind of plugin that defines a section for a archive that you’re linking.

well hope this thread will help someone else if searching for the similar solution. :)

PS.
is there any tag that checks the actual language. I’m doing a french/english site with MLP plugin.
So if i use adi_link i have to write link text=“something”
all the other links that i have change with the actual language.
the only way that i could think of now is that i retrieve link text from an article that has its french version – writing for exemple biographie in the body of the article.
maybe there is some plugin or tag that has a if_lang statement. i saw something similar in MLP but i still don’t know how to use it.

Offline

#7 2009-03-06 22:18:06

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: section list issue - passing article id to a section link?

antonhor wrote:

So if i use adi_link i have to write link text=“something”
all the other links that i have change with the actual language.
the only way that i could think of now is that i retrieve link text from an article that has its french version – writing for exemple biographie in the body of the article.
maybe there is some plugin or tag that has a if_lang statement. i saw something similar in MLP but i still don’t know how to use it.

I don’t know MLP at all but from what you say, there’s some cleverness that automatically changes the language? So, would <txp:section name=“bio”/> output the section name in different langauges? If so, you could use that in the link_text attribute.

Offline

#8 2009-03-06 22:58:57

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: section list issue - passing article id to a section link?

antonhor wrote:

is there any tag that checks the actual language. I’m doing a french/english site with MLP plugin.
So if i use adi_link i have to write link text=“something”
all the other links that i have change with the actual language.

If you are using MLP you can write link_text='<txp:section name="bio" title="1" />'. The section name is not changed with the language, but the title is.

Offline

#9 2009-03-06 22:59:45

antonhor
New Member
Registered: 2009-03-05
Posts: 7

Re: section list issue - passing article id to a section link?

The section name remains the same for both, but the section title is in different languages, if i write link text in two languages as an article it will do the same. So i think i’ll use that, i was just wandering if there is some other way to check language :)

Offline

#10 2009-03-07 00:11:53

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: section list issue - passing article id to a section link?

antonhor wrote:

i was just wandering if there is some other way to check language :)

You can use <txp:l10n_if_lang> to check the language, but I don’t think you need it, because MLP already checks for the current language. If you don’t want to use the section title, you can also use a snippet:
link_text="##bio##".

But if you need to know more about how MLP works, we’d better continue this conversation in the MLP thread ;)

Offline

Board footer

Powered by FluxBB