|
|
#1 |
|
Member
|
Hey everybody, I've been searching around for a way to have an RSS feed link on a category listing and have the feed be specific to that category. I couldn't find anything like it in the forums, so I just set it up myself.
STEP 1: Get the category ID. Open up category.php and around line 37 add this: Code:
$class_tpl->assign('catID', $cat['id']);
STEP 2: Add to your template. I added the RSS link and icon to the breadcrumb area so it's right out in the open. To do this, open your_template>categories>breadcrumb.tpl and add the following code: Code:
{if $file == "category.php"}
<h3><a href="{$smarty.const.URL}/external.php?category={$catID}">RSS Feed</a> <a href="{$smarty.const.URL}/external.php?category={$catID}"><img src="templates/{$smarty.const.MAIN_TEMPLATE}/images/rss.gif" alt="RSS Feed" /></a></h3>
{/if}
Code:
{$smarty.const.URL}/external.php?category={$catID}
I hope this helps. Cheers, Jonah |
|
|
|
|
|
#2 |
|
All Hands On Deck
Join Date: Mar 2008
Posts: 1,113
Rep Power: 29 ![]() |
You can if you want SEO friendly URLs for the feeds do this as well. An RSS feed for each category and for each advertiser. For example, in the .htaccess
RewriteRule ^external\.html$ external.php [NC] RewriteRule ^external/([0-9]+)\.html$ external.php?owner=$1 [NC] RewriteRule ^external/aquitaine\.html$ external.php?category=1 [NC] RewriteRule ^external/limousin\.html$ external.php?category=11 [NC] . . . SEO file "'(?<!/)".URL."/external.php'", "'(?<!/)external.php'", . . . "external.html", "external.html", Last edited by seymourjames; 07-01-2008 at 06:34 AM. |
|
|
|
|
|
#3 |
|
Coder
Join Date: Mar 2006
Posts: 4,469
Rep Power: 109 ![]() ![]() |
external.php also has built in logic to return "types" so you can just display top, featured and new ads in the feed. by appending type=top, type=featured or type=new to the url.
|
|
|
|
|
|
#4 |
|
Member
|
Thanks Seymour and Larry,
I did the .htaccess and SEO mod and it works great! |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Jan 2007
Posts: 367
Rep Power: 19 ![]() |
I've successfully integrated jonahcoyote's code, it looks good and works well - thank you.
A request though. In addition to category.php, I'd like the RSS Feed to also appear in the breadcrumb trail displayed on viewlisting .php which calls on the same file; mytemplate/categories/breadcrumb.tpl The file is short enough to post in it's entirety; Code:
{*$Revision: 165 $*}
<p class="breadcrumb">
<a href="category.php" class="breadcrumb">{$smarty.const.LANG_BROWSE_CATEGORIES}</a>
{foreach from=$breadcrumb item="entry"}
{$smarty.const.LANG_CAT_SEPERATOR} {$entry}
{/foreach}
{if $file == "category.php"}
. . . . <a href="{$smarty.const.URL}/external.php?category={$catID}">RSS Feed</a> <a href="{$smarty.const.URL}/external.php?category={$catID}"><img src="templates/{$smarty.const.MAIN_TEMPLATE}/images/rss.gif" alt="RSS Feed" /></a>
{/if}
</p>
Any ideas?
__________________
M Michael V4.1.3 Developer - 3 Column Default Template "All truths are easy to understand once they are discovered; the point is to discover them" - Galileo Galilei (1564 - 1642) |
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Jan 2007
Posts: 367
Rep Power: 19 ![]() |
Just bumping this 'cos I see Eric is online . . .
__________________
M Michael V4.1.3 Developer - 3 Column Default Template "All truths are easy to understand once they are discovered; the point is to discover them" - Galileo Galilei (1564 - 1642) |
|
|
|
|
|
#7 | |
|
Coder
Join Date: Mar 2006
Posts: 4,469
Rep Power: 109 ![]() ![]() |
Quote:
did you clear the contents of /templates_c? |
|
|
|
|
|
|
#8 |
|
68 Classifieds Staff
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,023
Rep Power: 116 ![]() |
I have done it for this site:
CGIExpo What I did was alter the breadcrumb.tpl and add in the with out any if statements. Then in viewlisting.tpl I just manually inserted the breadcrumb instead of including it. Code:
<p class="breadcrumb">
<a href="category.php" class="breadcrumb">{$smarty.const.LANG_BROWSE_CATEGORIES}</a>
{foreach from=$breadcrumb item="entry"}
{$smarty.const.LANG_CAT_SEPERATOR} {$entry}
{/foreach}
</p>
__________________
Eric Barnes 68 Classifieds Developer Please do not send me a private message asking for support. Instead use these open forums or our ticket system. Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules |
|
|
|
|
|
#9 |
|
Senior Member
Join Date: Jan 2007
Posts: 367
Rep Power: 19 ![]() |
Hi Eric. I've stripped out the if/else commands and all still works well on category.php - so far, so good. I inserted the code you posted into viewlisting.tpl (in place of the include) and the breadcrumb showed up fine but no RSS link or image. Did you mean to post the revised breadcrumb.tpl?
So I tried that. The breadcrumb is still ok and I also get the RSS link and image (getting close now), but the link/image do not have the category ID attached. See MKClassifieds Citroen 2cv6 PickUp Any suggestions? Larry,you said "What do you get if you put {$file} in your template?" Could you explain that a bit please? Should I put {$file} into viewlisting.tpl?
__________________
M Michael V4.1.3 Developer - 3 Column Default Template "All truths are easy to understand once they are discovered; the point is to discover them" - Galileo Galilei (1564 - 1642) |
|
|
|
|
|
#10 |
|
68 Classifieds Staff
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,023
Rep Power: 116 ![]() |
For the rss link change it to:
<a href="external.php?cat={$smarty.get.cat}">RSS FEED</a>
__________________
Eric Barnes 68 Classifieds Developer Please do not send me a private message asking for support. Instead use these open forums or our ticket system. Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
LinkBacks (?)
LinkBack to this Thread: http://www.68classifieds.com/forums/modules-plugins-modifications/5250-modification-rss-feeds-category-anything-else.html
|
||||
| Posted By | For | Type | Date | |
| nicolaou's Bookmarks on Delicious | This thread | Refback | 05-31-2009 11:24 PM | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Category specific RSS feeds. | michael | v4 Questions & Support | 9 | 12-01-2008 02:50 PM |
| Hide a category on public pages? | HotAir | v3.1 Questions & Support | 6 | 12-05-2007 10:17 AM |
| Display Banner in one Category | BABBSELA | v3.1 Questions & Support | 3 | 02-10-2007 02:22 PM |
| Branding each Category | BABBSELA | v3.1 Modules & Modifications | 0 | 02-10-2007 01:17 PM |
| Category problem | dawyatt | v3.1 Questions & Support | 2 | 05-24-2006 03:58 PM |