Authors List
-
codetwists
- Regular
- Posts: 44
- Joined: Sat Dec 20, 2008 5:46 pm
Authors List
I'm using the Authors 2.01 Plug-in but it's really not doing what I'd hope it would do.
What I'd like is to have a list of the authors that when clicked on would present a list of that author's entries. From there the reader could click on one of the entries listed to go to the entry itself.
Is there a plug-in that will do this?
Thanks for your help,
Myron
What I'd like is to have a list of the authors that when clicked on would present a list of that author's entries. From there the reader could click on one of the entries listed to go to the entry itself.
Is there a plug-in that will do this?
Thanks for your help,
Myron
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Authors List
Hi!
But that is what the plugin should do. What's your URL? When clicking on an author link, it should go to something like http://yourblog/authors/1-authorOne and this should only show blog entries by that author.
Regards,
Garvin
But that is what the plugin should do. What's your URL? When clicking on an author link, it should go to something like http://yourblog/authors/1-authorOne and this should only show blog entries by that author.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
If I may get myself into this topic:
The author-link doesn't work on my blog (just as here http://blog.s9y.org/authors/3-Garvin-Hicking doesn't work at all).
In fact, my blog behaves the same way, using the link to an author shows the mainpage of my blog.
My permalink-setting for the authors is "autor/%id%-%realname%". I just found out a few days ago, didn't had a look at it before.
The author-link doesn't work on my blog (just as here http://blog.s9y.org/authors/3-Garvin-Hicking doesn't work at all).
In fact, my blog behaves the same way, using the link to an author shows the mainpage of my blog.
My permalink-setting for the authors is "autor/%id%-%realname%". I just found out a few days ago, didn't had a look at it before.
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
http://blog.s9y.org/authors/3-Garvin-Hicking works! That's exactly how it's supposed to work.
It shows all entries written by me.
http://blog.s9y.org/authors/2-Jannis shows all entries by Jannis.
Regards,
Garvin
http://blog.s9y.org/authors/3-Garvin-Hicking works! That's exactly how it's supposed to work.
It shows all entries written by me.
http://blog.s9y.org/authors/2-Jannis shows all entries by Jannis.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
If you want to see a profile, you can install the userprofiles plugin, this will then add a box to the top of author views with their info.
Regards,
Garvin
If you want to see a profile, you can install the userprofiles plugin, this will then add a box to the top of author views with their info.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
codetwists
- Regular
- Posts: 44
- Joined: Sat Dec 20, 2008 5:46 pm
Re: Authors List
Yep, that's exactly what it does in the default setup. I want it to do something slightly different so I've been trying to follow the code and I'm a little stuck.garvinhicking wrote:But that is what the plugin should do. What's your URL? When clicking on an author link, it should go to something like http://yourblog/authors/1-authorOne and this should only show blog entries by that author.
My link would look like: "http://codetwists/Blog/authors/1-Myron-Barrett". Since there's actually no directory called "authors" it seems that something is then re-directing this to the index.php, which then calls the content.php, which then calls the entries.php, which then figures out that you're looking for an author named Myron Barret with an ID of 1.
At this point, I can't figure out where in entries.php that's happening. I'm guessing at this point, from reading the definition of the function serendipity_hookPlugin, that the parameter hook="entries_header" picks up authors from the URL and the parameter addData="$entry_id" picks up the 1 from the URL. Am I close?
It looks like entries.php then loops through the serendipty superglobal's entries array. I'm having trouble figuring out where the entries are filtered on the author id.
My goal in figuring this out is to add some code to my custom page called info.php that will allow me to access that same list.
Can you help with this?
Thanks,
Myron
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Authors List
Hi!
Sadly you're not so close.
It goes like this; the URLs are virtually created, this is achieved through mod_rewrite in the .htaccess file. Effectively, this simply forwards every URL that does not "really" exist to the index.php file of Serendipity.
This index.php file loads the actual s9y framework and then has one enormous IF/ELSE branch that checks multiple regular expressions on the URL to see what matches.
For the authors "view" this is an IF-Statement that looks like:
This evaluates to TRUE because $uri contains a pattern like PAT_PERMALINK_AUTHORS.
then, the code sets up some variables and includes the include/genpage.inc.php file. This file is responsible for firing up the Smarty API and loading the entries.
It loads serendipity_fetchEntries() and serendipity_printEntries functions. Those parse and set all smarty variables and route and finally parse the entries.tpl template to assign them to {$ENTRIES}. The end of genpage.inc.php kicks in and renders the template content.tpl to {$CONTENT}. Then the code flow returns to index.php which finally renders index.tpl.
The plugin hooks are completely unrelated. This is for the event plugin API.
Have a look at serendipity_event_userprofiles. it does something very similar.
Regards,
Garvin
Sadly you're not so close.
There is no content.php and no entries.php.My link would look like: "http://codetwists/Blog/authors/1-Myron-Barrett". Since there's actually no directory called "authors" it seems that something is then re-directing this to the index.php, which then calls the content.php, which then calls the entries.php, which then figures out that you're looking for an author named Myron Barret with an ID of 1.
It goes like this; the URLs are virtually created, this is achieved through mod_rewrite in the .htaccess file. Effectively, this simply forwards every URL that does not "really" exist to the index.php file of Serendipity.
This index.php file loads the actual s9y framework and then has one enormous IF/ELSE branch that checks multiple regular expressions on the URL to see what matches.
For the authors "view" this is an IF-Statement that looks like:
Code: Select all
else if ($is_multiauth || preg_match(PAT_PERMALINK_AUTHORS, $uri, $matches)) {
then, the code sets up some variables and includes the include/genpage.inc.php file. This file is responsible for firing up the Smarty API and loading the entries.
It loads serendipity_fetchEntries() and serendipity_printEntries functions. Those parse and set all smarty variables and route and finally parse the entries.tpl template to assign them to {$ENTRIES}. The end of genpage.inc.php kicks in and renders the template content.tpl to {$CONTENT}. Then the code flow returns to index.php which finally renders index.tpl.
The plugin hooks are completely unrelated. This is for the event plugin API.
This is done inside the central serendipity_fetchEntries() function.It looks like entries.php then loops through the serendipty superglobal's entries array. I'm having trouble figuring out where the entries are filtered on the author id.
For that, you would need to create a new event plugin that listens on the event hook you already created.My goal in figuring this out is to add some code to my custom page called info.php that will allow me to access that same list.
Have a look at serendipity_event_userprofiles. it does something very similar.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
codetwists
- Regular
- Posts: 44
- Joined: Sat Dec 20, 2008 5:46 pm
Re: Authors List
I'm trying...garvinhicking wrote:Sadly you're not so close.![]()
So, really the Authors plug-in actually does what I want it to do. The results are that it shows all of the entries for the author selected. I'd like to do the same thing, except that I don't want to show the body of the entry, just a list of all of the author's entries. In what I'm using now, I just changed the code in the entries.tpl so that it just displays a single line per entry with the title, author, and date. I'd like to do something similar with this, but I'd like it to be a single line with the title, date and either the first few words of the body or the META-Description.
I need to be able to tell if I'm listing by author so I can put in a title paragraph with the name of the author.
It seems like using a modification of the userprofiles event is overkill, especially with my limited expertise.
Myron
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Authors List
Hi!
Thus, you cannot simply modify a plugin to modify your author view. To do that you would need to do smarty checks on {$view} and see if it matches "authors", and in that case moduify your entries.tpl template to only emit entry bodies when $view is != "authors".
Regards,
Garvin
That is not the doing of the plugin! Thise is core s9y functionality, the plugin does not touch it. It simply emits a sidebar with links to that.So, really the Authors plug-in actually does what I want it to do.
Thus, you cannot simply modify a plugin to modify your author view. To do that you would need to do smarty checks on {$view} and see if it matches "authors", and in that case moduify your entries.tpl template to only emit entry bodies when $view is != "authors".
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
codetwists
- Regular
- Posts: 44
- Joined: Sat Dec 20, 2008 5:46 pm
Re: Authors List
Yes, but doesn't the link in the Authors plug in also pass the name or id of the author?garvinhicking wrote:Hi!
That is not the doing of the plugin! Thise is core s9y functionality, the plugin does not touch it. It simply emits a sidebar with links to that.So, really the Authors plug-in actually does what I want it to do.
Thus, you cannot simply modify a plugin to modify your author view. To do that you would need to do smarty checks on {$view} and see if it matches "authors", and in that case moduify your entries.tpl template to only emit entry bodies when $view is != "authors".
Regards,
Garvin
Myron
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Authors List
Hi!
You can use the link you have, even when the sidebar plugin is not installed.
Regards,
Garvin
I don't fully understand the question...viewing entry by author is a core functionality of serendipity. The plugin only addresses core functionality, it is not responsible for any entry output; the sole purpose of the plugin is to create a linklist to all existing authors, there are no functions provided by the plugin, as the core does the job of this, just like printing usual entries.Yes, but doesn't the link in the Authors plug in also pass the name or id of the author?
You can use the link you have, even when the sidebar plugin is not installed.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
codetwists
- Regular
- Posts: 44
- Joined: Sat Dec 20, 2008 5:46 pm
Re: Authors List
I think I understand that the core functionality exists. I just don't understand how to access the data that causes that particular functionality.garvinhicking wrote:...viewing entry by author is a core functionality of serendipity. The plugin only addresses core functionality, it is not responsible for any entry output; the sole purpose of the plugin is to create a linklist to all existing authors, there are no functions provided by the plugin, as the core does the job of this, just like printing usual entries.
I see two distinct links, both of which are creating a link that includes a reference to "authors" and the identification of a single author.You can use the link you have, even when the sidebar plugin is not installed.
In entries.tpl there's a link,
Code: Select all
{$CONST.POSTED_BY} <a href="{$entry.link_author}">{$entry.author}</a>that causes only the entries of the single author shown to be printed.
In serendipity_plugin_authors.php the link,
Code: Select all
echo '<a style="white-space: nowrap" href="' . $entryLink . '">' . $entry['realname'] . '</a><br />';When index.php loads the actual s9y framework it then checks multiple regular expressions on the URL to see what matches. It seems to me that those to lines of code are setting some variables in the serendiptiy superglobal to values equal to the name and id of the author. Then when entries.tpl is displayed again, only the entries for that author are displayed.
I was able to follow the code in index.php to figure out where those regular expression evaluations actually take place. I lost the trail, but it seems like the values make their way into an array called $entry, which is used in the entries.tpl to display data about the entries, having already been filtered in index.php using the values passed in the URI.
What I want to do is to be able to access those same values from the superglobal, or wherever they are, to be able to do more work with them. Does that make sense?
Right now I'm using
Code: Select all
{if $view == "start" AND $staticpage_pagetitle == ""}
{serendipity_fetchPrintEntries limit=9999 template="intro.tpl"}
{else}
{$ENTRIES}
{$ARCHIVES}
{/if}to trap the flow from content.tpl to entries.tpl and redirect it to my new page, intro.tpl, when the site's base URL is used. In intro.tpl I display only a list of entries without the entry body. I'd like to extend the functionality of content.tpl to also capture the flow when the URL includes a specific author or category name or id. I'm not yet sure how to do that. I can then use intro.tpl to list only the entries of the specific author or category that's been passed.
The intro.tpl is being used as an index; a list of entries. When a link to an entry is selected in intro.tpl, the flow through content.tpl should follow the else clause and go to the entries.tpl where the entry is then displayed as it normally would be. You can see what I've done so far at www.codetwists.com/Blog.
I'm learning a bit more about the constructs each time I delve into one of these. I think it would be easier if my search capabilities were better, but I don't think Macromedia Dreamweaver is searching all of the files correctly (maybe it's just me).
Thanks for your patience with me and for your help.
Myron
[/code]
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Authors List
Hi!
You can, following your current logic, do this:
and then modify intro_authors.tpl to your liking, instead of modifying entries.tpl and adding the if-checks there. But I personally like to avoid redundancy and only use a single template with if-checks instead of multiple files where much is identical.
Regards,
Garvin
Like I wrote earlier; by checking $view for == 'author'.I think I understand that the core functionality exists. I just don't understand how to access the data that causes that particular functionality.
You can, following your current logic, do this:
Code: Select all
{if $view == "start" AND $staticpage_pagetitle == ""}
{serendipity_fetchPrintEntries limit=9999 template="intro.tpl"}
{elseif $view == 'authors'}
{serendipity_fetchPrintEntries limit=9999 template="intro_authors.tpl"}
{else}
{$ENTRIES}
{$ARCHIVES}
{/if}and then modify intro_authors.tpl to your liking, instead of modifying entries.tpl and adding the if-checks there. But I personally like to avoid redundancy and only use a single template with if-checks instead of multiple files where much is identical.
Try to use a decent text editor like ActiveState Komodo, UltraEdit, PSPad or something like that - those offer the full flexibility of editing features.I'm learning a bit more about the constructs each time I delve into one of these. I think it would be easier if my search capabilities were better, but I don't think Macromedia Dreamweaver is searching all of the files correctly (maybe it's just me).
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
codetwists
- Regular
- Posts: 44
- Joined: Sat Dec 20, 2008 5:46 pm