Support Forums


Go Back   68 Classifieds Forums > Help & Support > Modules / Plugins / Modifications

Notices

 
LinkBack (1) Thread Tools Display Modes
Old 06-30-2008, 11:51 PM   #1
Member
 
Join Date: May 2008
Location: Madison, WI
Posts: 77
Rep Power: 6
jonahcoyote is on a distinguished road
Lightbulb Modification: RSS Feeds by Category (or anything else)

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']);
This will get the category ID and assign it to a catID variable for the template.

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}
I first check to make sure I am on the category.php file and not any other file. If I am, then display my RSS link and icon. As referenced in the 68 Classifieds documentation on RSS Feeds - there are lots of parameters you can use for the feed which is really nice. I just want to use category as a parameter, so I use:

Code:
{$smarty.const.URL}/external.php?category={$catID}
{$smarty.const.URL} is my sites URL. external.php is the file which gets the feeds and all I do is pass category as a parameter and use {$catID} as my dynamic category ID.

I hope this helps.

Cheers,
Jonah
jonahcoyote is offline   Reply With Quote
Old 07-01-2008, 06:31 AM   #2
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 1,113
Rep Power: 29
seymourjames has a spectacular aura about
Default

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.
seymourjames is offline   Reply With Quote
Old 07-01-2008, 08:31 AM   #3
Coder
 
Join Date: Mar 2006
Posts: 4,469
Rep Power: 109
Lhotch is just really niceLhotch is just really nice
Default

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.
__________________
Larry.
Lhotch is offline   Reply With Quote
Old 07-01-2008, 11:37 AM   #4
Member
 
Join Date: May 2008
Location: Madison, WI
Posts: 77
Rep Power: 6
jonahcoyote is on a distinguished road
Default

Thanks Seymour and Larry,

I did the .htaccess and SEO mod and it works great!
jonahcoyote is offline   Reply With Quote
Old 06-01-2009, 06:43 AM   #5
Senior Member
 
 
Join Date: Jan 2007
Posts: 367
Rep Power: 19
michael is a jewel in the rough
Default

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>
I've had a fiddle but I just don't know the correct way of getting viewlisting.php to act on this code. I even tried simply replacing category.php with viewlisting.php in the {if $file == } statement but nothing happened.

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)
michael is offline   Reply With Quote
Old 06-01-2009, 01:38 PM   #6
Senior Member
 
 
Join Date: Jan 2007
Posts: 367
Rep Power: 19
michael is a jewel in the rough
Default

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)
michael is offline   Reply With Quote
Old 06-01-2009, 01:50 PM   #7
Coder
 
Join Date: Mar 2006
Posts: 4,469
Rep Power: 109
Lhotch is just really niceLhotch is just really nice
Default

Quote:
Originally Posted by michael View Post
I've had a fiddle but I just don't know the correct way of getting viewlisting.php to act on this code. I even tried simply replacing category.php with viewlisting.php in the {if $file == } statement but nothing happened.

Any ideas?
What do you get if you put {$file} in your template?

did you clear the contents of /templates_c?
__________________
Larry.
Lhotch is offline   Reply With Quote
Old 06-01-2009, 02:20 PM   #8
68 Classifieds Staff
 
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,023
Rep Power: 116
Eric Barnes is a jewel in the rough
Default

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
Eric Barnes is offline   Reply With Quote
Old 06-01-2009, 03:37 PM   #9
Senior Member
 
 
Join Date: Jan 2007
Posts: 367
Rep Power: 19
michael is a jewel in the rough
Default

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)
michael is offline   Reply With Quote
Old 06-01-2009, 03:54 PM   #10
68 Classifieds Staff
 
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,023
Rep Power: 116
Eric Barnes is a jewel in the rough
Default

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
Eric Barnes is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 11:56 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0