 | |  |
 |

Damon
Staff
/ Moderator

Oct 26, 2006, 8:51 AM
Post #1 of 1
(1226 views)
Shortcut
|
|
Tutorial: Creating a "View all articles by Author" link
|
Can't Post
|
|
With this tutorial, you will be able add a link to a list of all the articles by an author. This is done by linking to search results using a customized search result template and the authors name as the keyword. Here is the steps: Step 1: Create a copy of your searchResults.html template and rename it to articles_by_author_results.html /templates/searchEngine/searchResults.html Step 2: Make these edits to the articles_by_author_results.html template. (example with changes made is attached). Change title tags to this: <title>$my.siteName$ - Articles by $form.keyword$</title> Replace <a href="$_cgiurl$">ADVANCED SEARCH</a> with Articles by $form.keyword$ The $form.keyword$ will publish the keyword that was searched which will be the authors name. Step 3: Include "View all articles by Author" link on the full article page. Edit the article page articlePage.html template: /templates/articlePages/articlePage.html <!-- templateIf : $article.author$ ne "" --> <a href="$settings.searchurl$?action=search&keywordSearchFields=author&keyword=$article.author$&template=searchEngine/articles_by_author_results.html"> View all articles by $article.author$</a> <!-- /templateIf -->
Include this code in the template under the Printer Friendly Page link or any where you choose. The code uses a a templateIf to only publish the link if the author field has been filled in. The link uses the search engine to search the author field in all the articles for matching author names and returns the results using the customized template. Update: Correction with the search query, "fields" should be "keywordSearchFields". Cheers Damon Edis interactivetools.com
(This post was edited by Damon on Oct 30, 2006, 5:54 PM)
|
|
Attachments:
|
articles_by_author_results.html
(3.61 KB)
|
|
|  |
 | |  |
|