Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
bos_author - author url customization...
This is my first attempt to make a plugin, so it is a veeeeery, veeeeery simple one.
I have an authors section in one of my sites called “autori”, and every article in that section is the bio of an author, with the title being the author’s name.
So I needed the possibility to change the url of the author’link when I’m using txp:author link=“1”. By default, that link is to a section called “author” (localized…) and the name of the author come with a ‘+’ sign in between, whereas txp uses ‘-’ for the spaces in article url.
So this plugin does basically two things:
- allows to define a section to which the link with author name point to, using the “section” attribute.
- change the ‘+’ in ‘-’, and lowercase author name, so the url comes good for me out of the box.
‘section’ is the only attribute – you set the name of the section you defined for your authors’ section. When missing, the author name without a link will be displayed. No ‘link’ attribute here.
Usage:
<code><txp:bos_author section=“sectionname” /></code>
(obviously the ‘sectionname’ must match the name of the section you created for your authors…).
Download: bos_author 1.0 (Updated on 6/4/2006 to support accented and non-ascii chars).
Information url: missing… maybe in the future. Refer to this thread.
Please report here any bug, comment, insult and whatever.
Zanza
Last edited by Zanza (2008-04-28 09:36:39)
Offline
Re: bos_author - author url customization...
Seems very nice, I’ll give it a try.
Offline
Re: bos_author - author url customization...
I like this plugin, it does away with some of my foolish trickery. Could this be made to work with categories and/or sections? So I could have an “about” section with a category of “authors” and then thier bios assigned to that category.
Update: Never mind it works perfectly as is.
Last edited by tinyfly (2005-11-17 19:38:15)
Refresh Dallas and other Refreshing Cities.
Offline
Re: bos_author - author url customization...
Glad to hear it. I never tried that way…
Bye
Z-
Offline
Re: bos_author - author url customization...
Your download doesn’t work anymore. You may have to install the latest rss_suparchive previous versions caused problems with downloads in txp 4.0.3
Refresh Dallas and other Refreshing Cities.
Offline
Re: bos_author - author url customization...
Thank you tinyfly.
Updated and working now! :)
Z-
Offline
#7 2006-03-05 09:33:51
- M_i
- Member
- Registered: 2006-03-05
- Posts: 122
Re: bos_author - author url customization...
Hi-
I’m looking into moving my site to Textpattern, and what I’d like to do is create a page listing all the authors, linking to pages for each individual author (got that far).
Then on these pages for each author I’d like some space for bio info and what not (achieved that thanks to your lovely plugin) and below that a list of all his/her articles, like on the regular author page that is generated by Textpattern. And that’s the part I’m having trouble with.
Basically, what I want to do is generate a list of articles (all articles by one author), within an article (the author’s bio article in the authors section used by this plugin). Of course I’d like to do this in the Page (something with a article_custom where the author attribute equals the article’s title) rather than in each individual article, but I haven’t managed to achieve either.
Is this at all possible?
- Iris
Last edited by M_i (2006-03-05 09:35:10)
Offline
Re: bos_author - author url customization...
In one of my site I use chh_related_articles plugin (that require also chh_article_lib).
I put this in my page template:
<txp:chh_related_articles relation="author" limit="100" break="li" wraptag="ul" label="From this author:" labeltag="h4" section="section1,section2" />
It’s handy also because it allows you to restrict to some section(s).
Remember that the page must be by the same author (not by admin: you can modify the author of the article in which you have the bio with ajw_admin_workflow plugin, very useful in multi-author sites).
For the section with the listing of author you may use my plugin bos_author.
Search the plugin names on textpattern.org for links.
I hope this may help. Bye!
Z-
Last edited by Zanza (2006-03-05 11:44:03)
Offline
#9 2006-03-06 10:31:46
- M_i
- Member
- Registered: 2006-03-05
- Posts: 122
Re: bos_author - author url customization...
Excellent! I’ll give that a try.
Thank you for your help, and your great plugin.
- Iris
Offline
#10 2006-04-05 16:58:01
- M_i
- Member
- Registered: 2006-03-05
- Posts: 122
Re: bos_author - author url customization...
Found a little bug in this plugin.. or maybe I’m just doing something wrong.
One of my authors has an accent in her name: Stéphanie. I have an article called ‘Stéphanie’ in my authors section along with an article each for all my other authors, and there’s one page where I list all articles in this section. There, the article is listed as ‘Stéphanie’, but it links to the page /authors/Stephanie – note there’s no accent in the url, i.e. this is normal Txp behaviour.
However, the links created by the bos_author tag that I use in my forms links to /authors/Stéphanie – with accent. This of course gives a 404 not found error.
It’s just one author out of nearly 100 for me, so not a big problem, but perhaps sites in other languages will feel this more. Perhaps something to look at for the next version?
- Iris
Offline
Re: bos_author - author url customization...
Thank you Iris. I suspected the problem (I tried only with apostrophes in the name, not with accented).
Now it should work (v.1.0, same download url), but there’s a potential pitfall: I have to use the txp function dumbDown to strip all special characters (non basic ascii) from url. It’s the same function used to attach a sanitarized version of article name in the url. The problem is that regarding the url the function is called once, when saving article. In the plugin it is called at every page call, which could slow down the rendering.
I haven’t made a benchmark: so please let me know if you (or someone) find that it is too slow comparing to the previous version.
There would be no easy solution, but I could insert a conditional with an attribute, and call the function only on sites that need it, not slowing down the most of them.
Thank you again for trying and debugging the plug!
Bye
Z-
Offline
#12 2006-04-10 08:27:05
- M_i
- Member
- Registered: 2006-03-05
- Posts: 122
Re: bos_author - author url customization...
Thanks for the update – works great. I don’t notice any slowing down.
For those who do, of course there’s another, very simple, solution to this problem: change the URL-only title of the article bos_author is linking to (the article about the author with the accent in his name), so you undo txp’s automatic cleanup. Your URL looks a bit funny, but it works fine.
- Iris
Offline