Plugin: SS Friendly 404
Posted: 04 October 2008 05:14 AM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  414
Joined  09-09-2006

This plugin suggests relevant pages to users on your 404 page.

It is used in your 404 template and returns suggested weblog entries based on the final segment of the 404 URL.

You can specify which weblogs are used and set the limit on entries returned.

Example

{exp:ss_friendly_404 weblog=“news” limit="10"}

The plugin honours the search path preferences for each weblog.

Download the latest version | Documentation

 Signature 

Shape Shed | Usable, elegant web design, London, UK
Twitter | Flickr | LastFm | Blog | EE addons

Profile
 
 
Posted: 29 October 2008 03:29 PM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  17379
Joined  06-03-2002

Hey George, nice work, it’s a great idea.  I just found it via Allard’s blog, didn’t catch your post here.  Couple things would make this worthy of EllisLab giving some promotion to, first making sure that all of your variables are escaped in queries.  Currently $weblog_name is not escaped.  Second, instead of having its own output, why not just loop through the results, and parse search_results_url, url_title, and title with template variables?  That lets the user control the markup and presentation.  The indenting and whitespace usage is a bit different, and would need to be made to match the EE style guidelines in order for us to host the add-on, but I wouldn’t mind promoting it if those other two issues are addressed.

 Signature 
Profile
MSG
 
 
Posted: 29 October 2008 03:36 PM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  414
Joined  09-09-2006

Hi Derek, Thanks for the encouragement and for the tips. I’ll update the plugin when the clients stop bugging me and will post up again when it when done.

 Signature 

Shape Shed | Usable, elegant web design, London, UK
Twitter | Flickr | LastFm | Blog | EE addons

Profile
 
 
Posted: 29 October 2008 03:38 PM   [ Ignore ]   [ # 3 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  17379
Joined  06-03-2002

when the clients stop bugging me

See you in a few years! wink

Sounds good, George, I look forward to seeing the update.

 Signature 
Profile
MSG
 
 
Posted: 01 November 2008 09:47 AM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  414
Joined  09-09-2006

Version 1.1.0 of the Friendly 404 plugin is now available featuring:

* Plugin updated to follow EE code guidelines
* Results now parsed with template variables
* Addition of {auto_path}, {count} and {total_results} variables

Updated download and documentation via the links at the top of the thread.

 Signature 

Shape Shed | Usable, elegant web design, London, UK
Twitter | Flickr | LastFm | Blog | EE addons

Profile
 
 
Posted: 01 November 2008 10:09 AM   [ Ignore ]   [ # 5 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9254
Joined  04-15-2006

Hi George,

Nice little plugin with a really great idea this one, well done.

Can I be bold though and ask how exactly the {if count == 1} part in your example code works when your plugin doesn’t actually set it anywhere? I’ve made a few plugins myself and have always had to code this using the prep_conditionals function or something like that if my memory serves correctly.

Just wondering how it does it really. Do plugins automatically exhibit a count then as it seems yours does wink although I’ve never been able to get mine to do that downer

Again an excellent plugin this one and I’m sure will help a whole heap of people out.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 01 November 2008 05:14 PM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  414
Joined  09-09-2006

Hi Mark

It is set here

foreach ($query->result as $count => $row)
     
{
      $tagdata
= $TMPL->tagdata;
      
$row['count'] = $count+1;
     
// do stuff
     
}

This references the array key to set the count variable. Then the prep_conditionals function is called to make it available as a conditional.

$tagdata = $FNS->prep_conditionals($tagdata, $row);

I picked this up by dissecting the query module wink

 Signature 

Shape Shed | Usable, elegant web design, London, UK
Twitter | Flickr | LastFm | Blog | EE addons

Profile
 
 
Posted: 01 November 2008 05:19 PM   [ Ignore ]   [ # 7 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9254
Joined  04-15-2006

Hmm that’s truly weird.

I downloaded the 1.1.0 version from Google your latest version but somehow it had downloaded version 1.0.0

I’d not seen this thread until today so not really too sure what happened there? Just downloaded it now and I can see that it is a very much different version. All very weird. Now I can definitely see how it does it.

Weird that. Does Google do that then? Spit out old versions or something?

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 09 May 2009 07:29 AM   [ Ignore ]   [ # 8 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  149
Joined  06-27-2008

hi there, I’m not shure if I got it right.
I’ve placed the following code within my 404 template:

      {exp:ss_friendly_404 limit=“10”}
          {if count == 1}<ul>{/if}
                <li><a href= “{ auto_path}”>{title}</a></li>
          {if count == total_results}</ul>{/if}
      {/exp:ss_friendly_404}

now: I have a working link that is the following: http://www.mysite.com/news-events/ (it’s the news-events template)
if somebody enters: http://www.mysite.com/news-events/news.html the 404 page is triggered.
so your plugin should reveal the last 10 entries of the news-event template?
is this correct?

well, in my case it displays nothing?
it would be a very handy plugin for my site, since all links will be changed…

cheers
stefan

 Signature 

buy me a beer wink

Profile
 
 
Posted: 10 May 2009 12:52 PM   [ Ignore ]   [ # 9 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  414
Joined  09-09-2006

The plugin gets the last segment of the 404 URL (in your case news.html) and does a SQL LIKE search on the title of weblog entries in your database.  In this case it is looking for the string “news.html”. I suspect none of your entries have a title similar to this so hence no results are being returned.

The plugin is expecting ExpressionEngine URLs so it is not really setup to handle searches that include an html extension I’m afraid.

A good example would be if someone found a 404 page at http://www.example.com/newss it should return weblog entries with ‘news’ in the title. e.g ‘My News Page’, ‘Another News Page’, ‘A third news page’.

 Signature 

Shape Shed | Usable, elegant web design, London, UK
Twitter | Flickr | LastFm | Blog | EE addons

Profile
 
 
Posted: 13 May 2009 04:50 AM   [ Ignore ]   [ # 10 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  149
Joined  06-27-2008

thanks for your explanations!
I am trying to display content if sombody enteres certain links (that I actually know) and then display the new (updated) links.

well I guess I have to try to do this other than with your plugin.
nice work though.

cheers
stefan

 Signature 

buy me a beer wink

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 77559 Total Logged-in Users: 37
Total Topics: 101553 Total Anonymous Users: 30
Total Replies: 544387 Total Guests: 264
Total Posts: 645940    
Members ( View Memberlist )