Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Why txp:author links to frontpage only?
Bloke wrote:
When you click an author’s link it creates a URL like this:
site.com/author/AuthorName
. The ‘author’ section (for want of a better word) is not a real section in your site, it just tells TXP that we are in an author list; the same way that the ‘category’ insite.com/category/nuts-and-bolts
is not a real section. Both of those examples actually run the Page template assigned to your default page, also called the front page (and again, as jsoo says, this is perhaps somewhat misleading).TXP’s front page acts differently to all other pages: any articles that are being displayed using
<txp:article />
will only be displayed if the article’s section has show on front page selected. So, if your authors have contributed to more than one section, you must ensure that all those sections have show on front page selected in order to see them in the author list on the front page. It’s just the way TXP works.
Exactly. So that’s why I used my conditional plugin to control the author list in the default template as if it were in a different page template than home. It’s a bit strange, but used to work. A pity that it needed a plugin (I thought a native txp:if_author_article_list had been cooked, after that, but maybe I’m wrong).
I always liked bos_author.
Too kind of you, sir, for a really silly piece of code.
Incidentally, even though it’s probably overkill in this situation, smd_bio is on its way and that can list author articles from any page… *mystery mode on* :-)
Definitely needed! :)
Offline
Re: Why txp:author links to frontpage only?
It’s just the way TXP works.
I was very impressed by TxP architecture, far beyond Drupal (which is excellent). In practice not every tag works as documented, though. But I still believe there are right ways in TxP itself.
It would perhaps be better if one could redirect the
<txp:author />
tag to an arbitrary section that is not the default Page because then this feature goes away. Not sure if that’s possible, though.
Perhaps by adding the form=""
atribute to the <txp:author />
tag, as it is in <txp:category_list />
. O better by setting sections named author, category, cover with customizing page templates?
why you want to set some sections not to show on the front page.
OMG, what a rag would stand from many sections. Are Perl.org, CPAN.org not suitable for Textpattern? I am willing to design quite complex, although still clear, serious publication. It is possible to set articles of the section to a front page and limit="0"
, but these articles disappear from their section list, of course.
There are two ways this discussion might continue
Both are very interesting, but will not fit the subject of this topic. Thank you very much!
Last edited by Vienuolis (2009-07-21 23:50:37)
Offline
Re: Why txp:author links to frontpage only?
Vienuolis wrote:
In practice not every tag works as documented, though.
OT: In that case, please consider getting yourself a Wiki account and making any necessary amendments. Or highlight them in the Textbook forum and someone will tend to them when they have time.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Why txp:author links to frontpage only?
Vienuolis wrote:
will not fit the subject of this topic. Thank you very much!
Well then, trying to get back to your original question (as I understand it), you can use the article_custom
tag to output posts from all sections, regardless of the “On front page” settings. You lose pagination, however.
Edit: On second thought, probably not a good solution — I was thinking it would be easy enough to grab the author name from a global variable, but forgot that you would need to convert from author real name to author login name. So back to a plugin to meet your exact requirements. On third thought: maybe it would work — see below.
Last edited by jsoo (2009-07-23 00:31:57)
Code is topiary
Offline
Re: Why txp:author links to frontpage only?
Perhaps <txp:article />
should have an attribute that allows overriding section “On front page” settings.
Code is topiary
Offline
Re: Why txp:author links to frontpage only?
you can use the
article_custom
tag
How the link could look like? <a href="?"><txp:author /></a>
instead of <txp:author link="1" />
. I have made a trial section ‘authors’ for one article per author, made its page template, form, and listform. Although first and last names are separated by %20
instead of -
or +
signs, the link <a rel="author" href="<txp:site_url />authors/<txp:author />"><txp:author /></a>
is valid and would work. But not <txp:article_custom author='<txp:author />' />
, probably because the tag article_custom
is not context-sensitive in an article form.
I am curious, what is the problem to output author’s articles — an author’s name is assigned with his article in the database tightly, isn’t?
Offline
Re: Why txp:author links to frontpage only?
Vienoulis: this is a totally different solution than having the default template list authors articles, but should work. Just use txp:related_articles (instead of article_custom) in individual page template for author section to list the articles (after the txp:article tag to display the individual article for the “authors” section), and set the sections (all but “authors”, I suppose) that you want via the section attribute. That should do the trick.
Oh: and for this to work, the authors section articles have to be written by the author corrisponding to the title, each one. You can change author for the articles in the “articles” panel.
Last edited by Zanza (2009-07-23 00:29:19)
Offline
Re: Why txp:author links to frontpage only?
I had in mind something like this, in the default Page:
<txp:if_author>
<txp:article_custom author='<txp:php>echo $GLOBALS['pretext']['author'];</txp:php>' />
</txp:if_author>
Awkward, but it works. Again, you don’t get pagination, because article_custom
doesn’t offer that.
Code is topiary
Offline
Re: Why txp:author links to frontpage only?
JSoo, your txp:php
fits perfectly, thank you! I can also set <txp:article_custom form="authors" />
to render suitable list output. I have also set /authors/Name+Surname
section articles as expired, thus they serves as convenient presentation intros (if_expired
). Of course, made by its authors username, as advised Zanza. JSoo, you could publish this stunning trick on Txptips.com, o even on Textbook.
you don’t get pagination, because article_custom doesn’t offer that.
And why? I see, no sense for next and previous articles, although pagination of a list could look naturally, both for user and programmer.
Hope the lack of pagination would not impact painfully, though. I think good design should avoid pagination. On possible fail, I will install suggested bos_author plugin.
Bloke, I will try to take Textbook account on some occasion, hope you will rectify my mistakes.
Thanks folks, TxP community is brilliant!
Offline