Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Is there a way I can do this with txp?
Is there a way of comparing the content of custom fields and according to that, to output a list of ‘related articles’?
To be more precise: Currently we use the search function to list the articles by author1 using "author name":http://neme.org/main/?q=by+author+name
I find this to be semantically wrong and what I am trying to achieve is the following 2 listings.
- An automatically generated “related articles” listing on a per article page linking to the other texts we have by the same author
- A listing2 of all the authors, currently manually created and found on the about page.
1 Note that by author I mean the article author and not the person with privileges in the db. The site only has 3 registered authors and the material is gathered through an online submission form.
2 Not a site-map but more of an ‘author-map’ which when an author’s name is clicked a list of articles by that author is returned. That is, all articles which have the same name typed in a particular custom field.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Offline
Re: Is there a way I can do this with txp?
Hi Wet,
thanks for your answer. That’s what i thought and started to do some work on it but I’m yet to produce any results.
This is where I’m at
I have a custom field called “sortauthor” and a form called “authorsmap” with this inside:
<dt><txp:if_different><txp:custom_field name="sortauthor"></txp:if_different></dt>
<dd><txp:if_custom_field name="sortauthor"><txp:custom_field name="sortauthor" /></txp:if_custom_field></dd>
I am calling the form in a page template using <txp:article_custom sort="sortauthor" form="authorsmap" />
… I am yet to put the site in debug mode but currently I get nothing returned.
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: Is there a way I can do this with txp?
At first glance, this looks usable. A tag trace would definitely help.
Offline
Re: Is there a way I can do this with txp?
Ok this kind of works but not the way I intend it
page template: <ul><txp:article_custom sort="custom_6" form="authorsmap" limit="999" /></ul>
form: authorsmap
<txp:if_custom_field name="sortauthor">
<txp:if_different>
<txp:custom_field name="sortauthor">
</txp:if_different>
<li><txp:permlink>
<txp:custom_field name="sortauthor"></txp:permlink></li>
</txp:if_custom_field>
current problems
<txp:custom_field name="sortauthor">
is not parsed so what i am getting is something like<li><a rel="bookmark" href="http://neme.org/main/57/millenium-museum-journal"> <txp:custom_field name="sortauthor"></a></li>
- As per the behaviour, it outputs all articles which use that custom field whereas what I am looking for is a linked name pointing towards a list of articles by that name
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#6 2008-01-31 18:33:44
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Is there a way I can do this with txp?
colak wrote:
Not a site-map but more of an ‘author-map’ which when an author’s name is clicked a list of articles by that author is returned. That is, all articles which have the same name typed in a particular custom field.
I’m thinking of chs_if_urlvar and asy_wondertag here. I sort of tested it and it seems to work.
Form ‘authorsmap’:
<txp:if_custom_field name="sortauthor">
<txp:if_different>
<li><a href="/?a=<txp:custom_field name="sortauthor" />"><txp:custom_field name="sortauthor" /></a></li>
</txp:if_different>
</txp:if_custom_field>
On the page:
<txp:chs_urlvar_default var="a">
<ul><txp:article_custom limit="9999" form="authorsmap" sort="custom_6" /></ul>
</txp:chs_urlvar_default>
<txp:chs_urlvar_exists var="a">
<txp:asy_wondertag><txp:chs_if_urlvar var="a" value="<txp:chs_urlvar_echo var="a" />"></txp:asy_wondertag>
<txp:asy_wondertag><txp:article_custom sortauthor="<txp:chs_urlvar_echo var="a" />" form="authorlist" /></txp:asy_wondertag>
</txp:chs_if_urlvar>
</txp:chs_urlvar_exists>
A downside could be that you can’t set the limit exactly. It has to be a high number because it counts and searches all articles, not only the ones that match. I also don’t know what that means for performance.
Last edited by els (2008-01-31 18:35:41)
Offline
Offline
Re: Is there a way I can do this with txp?
Gocom… good catch. I always forget those:)
Els… I think that your suggestion might work. Will make time over the weekend to test it and i’ll be posting the results here.
thanks for all the help.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline