kunzite (kunzite1) wrote in component_help,
kunzite
kunzite1
component_help

add free find search to your lj

this tutorial is my version of this one and it assumes that you know how to make customizations.
and that you havent overridden MonthPage::print() ... and, with this info it will break the iframe mini-calendar if you are using that.

create an s2 style that uses the core as its layout.
go here.
cruise to the bottom to "Create Style".
i suggest using a name like "ljusername_freefindsearch" so u know not to del or change it.
hit the "create" button.
change the layout to "a simple gesture" and hit the "change" button.
change the layout back to the blank option and hit the "save changes" button.
take note of the s2id.
go here.
edit the layer that you are currently using for customizations.

add this code to the end, make sure you change the s2id:
###################################
#         FREEFIND SEARCH         #
# kunzite1, component-help/255144 #
# overrides MonthPage::print()    #
###################################
function MonthPage::print() {
  var int s2id = 3332344; # change this to your s2id

  # set these to a month and date for when you want to stop indexing
  # you would also need to decomment the below pink lines
#  var int month =    7;
#  var int year  = 2002;
  if ($.args{"searchstart"} == "true" or $.args{"searchseed"} == "true") {
    # search mode
    """<html><head><title>FreeFind Search Seed</title></head><body>""";
    if ($.args{"searchstart"} == "true") {
      # searchstart mode
      var YearMonth latestMonth = $this->get_latest_month();
      """<a href="$latestMonth.url?.searchseed=true">$latestMonth.url""" + """?.searchseed=true</a>""";
      # end searchstart mode
    } else {
      # searchseed mode
      var MonthEntryInfo    index;
      var MonthDay       dayindex;
      foreach $dayindex (reverse $.days) {
#        if($dayindex.date.year >= $year){
#          if($dayindex.date.month >= $month or $index.date.year > $year){
            var Entry entryindex;
            foreach $entryindex (reverse $dayindex.entries) {
              print """<a href="$entryindex.permalink_url?s2id=$s2id">$entryindex.permalink_url?s2id=$s2id</a><br />""";
            }
#          }
#        }
      }
      if($.prev_date){
        print """<a href="$.prev_url?.searchseed=true">$.prev_url?.searchseed=true</a><br />""";
      }
      # end searchseed mode
    }
    """</body></html>""";
    # end search mode
  } else {
    # normal
    page_layout($this);
    # end normal
  }
}
after youve done that, we're gonna set up your freefind account.
go to http://www.freefind.com/ .
1. if user account: http://www.livejournal.com/users/ljusername/1970/01/?.searchstart=true
   if community account: http://www.livejournal.com/community/ljusername/1970/01/?.searchstart=true
2. enter your email address
3. hit the "sign up button".
4. check your email.
5. open the confirmation email and have your login info handy.
6. log in to freefind.
7. enter your website address, email address and password.
8. hit the "login" button.
9. click the "admin" tab.
10. change your password and write it down.
11. click the "build index" tab.
12. click "schedule reindexing".
13. select "every sunday", "greenwich (GMT)", and make the time whatever midnite in your timezone would be.
14. hit the "finish" button.
15. click "exclude pages".
16. for both types of accounts, youll put in http://www.livejournal.com/*
17. add the following:
if user account:
http://www.livejournal.com/users/ljusername/*?.searchstart=true index=no follow=yes
http://www.livejournal.com/users/ljusername/*?.searchseed=true index=no follow=yes
http://www.livejournal.com/users/ljusername/*.html?s2id* index=yes follow=no
http://www.livejournal.com/users/ljusername/*.html index=no follow=no
http://www.livejournal.com/users/ljusername/*.html?mode=reply index=no follow=no
http://www.livejournal.com/users/ljusername/*.html?thread=*#* index=no follow=no

if community account:
http://www.livejournal.com/community/ljusername/*?.searchstart=true index=no follow=yes
http://www.livejournal.com/community/ljusername/*?.searchseed=true index=no follow=yes
http://www.livejournal.com/community/ljusername/*.html?s2id* index=yes follow=no
http://www.livejournal.com/community/ljusername/*.html index=no follow=no
http://www.livejournal.com/community/ljusername/*.html?mode=reply index=no follow=no
http://www.livejournal.com/community/ljusername/*.html?thread=*#* index=no follow=no

18. hit the "finish" button.
19. click "starting points".
if user account:
http://www.livejournal.com/users/ljusername/
if community account:
http://www.livejournal.com/community/ljusername/
20. hit the "finish" button.
21. click "index now".
22. hit the "finish" button.
23. click the "html" tab.
24. choose the form that you want to use. i have provided the html code for the simplest one here. make sure to change your site id number.
<form action="http://search.freefind.com/find.html" method="get" target="_self">
<font size=1 face="arial,helvetica" >
<input type="hidden" name="id" value="$siteID" />
<input type="hidden" name="pageid" value="r" />
<input type="hidden" name="mode" value="all" />
<input type="hidden" name="n" value="0" />
<input type="text" name="query" size="15" /><small> 
<input type="submit" value=" find " /><br />
</small>powered by <a href="http://www.freefind.com">
freefind</a></font></form>


and then... if you want a custom template for the search results, click the "customize" tab, read the docs and restrictions, then click "upload custom template".
the thing that irritated me the most was the "Templates are limited to 32K bytes of HTML" part.
from there, you should be set.
Tags: admin: deprecated, user: kunzite1
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 26 comments