DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

EXT: Ajax Searching Engine

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed by:Mario Haim
Changed:2009-03-06T09:06:21.310000000
Author:Mario Haim
Email:mario@marioonline.at
Info 3:
Info 4:

EXT: Ajax Searching Engine

Extension Key: mh_ajaxsearch

Copyright 2000-2002, Mario Haim, <mario@marioonline.at>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

Table of Contents

EXT: Ajax Searching Engine 1

Introduction 1

What does it do? 1

Users manual 1

How to install? 1

How to use? 1

Configuration 2

Max. results 2

Don't show spinner 2

No introduction sentence 2

Focus on load 2

Enable logging 2

Enable preview 2

Enable alternative language 2

Search string forwarding 2

Charset 2

Startingpoint 2

Template file 2

Stylesheet 2

Ignore stylesheet 2

Additional searching tables 3

PID aliases (x=y;) 3

Further submits 3

Aliases on further submits 3

Show additional information 3

Date format 3

Alternative Configuration 3

Known Problems 4

To-Do list 4

Changelog 4

Introduction

What does it do?

The Ajax Searching Engine is just another possibility to add a searching engine to your TYPO3 homepage. The difference to other systems is that mh_ajaxsearch is based on the AJAX principle which is not to reload the whole page. So directly when the user is typing something into the searching field the extension searches in the background.

For a demonstration of that see www.marioonline.at where also a F. A. Q. is located in porfolio > typo3 > Ajax Searching Engine > Frequently Asked Questions.

Update – 2007-06-03: You may go directly to the marioonline TYPO3 section by opening http://typo3.marioonline.at.

Users manual

How to install?

Import it. Install it. Let it create the needed database table if you want to view statistics.

How to use?

After installing it use the 'insert plugin' option somewhere on your page. Choose the 'Ajax Searching Engine'. Define a starting point, the levels of searching and you are ready to go.

You may also integrate in anywhere on the page. To get known of the possibilities of that configuration see 'Alternative Configuration'.

Configuration

Let's have a look at the configuration abilities in the backend...

Max. results

If you want to define a maximum of results enter the number here.

Don't show spinner

Activate this box if you don't want to show the spinner (running wheel when loading).

No introduction sentence

If checked no sentence will be shown. So neither 'x results with query y' nor 'no results found with query y' sentences are going to be displayed.

Focus on load

If you have a single page where the search element is on you probably want to set the focus into that field on page load. Just activate this option and enter the id of the input field (if you didn't change any template, enter 'tx_mhajaxsearch_q').

Enable logging

If you enable this option logging will be enabled and you can view statistics in the backend 'Web' module > 'Search logging'.

Enable preview

Enter a number that represents the amount of signs shown from the content where a result is found. This is like any other preview seen on other search engines.

If it takes too long finding any results try disabling this option.

Enable alternative language

If you have installed alternative languages for your homepage activate this option so that the extension will grab the page title in your current language from the 'pages_language_overlay' table.

Search string forwarding

This is an option to allow your user to see their searched word on the page they found. Example: You search 'hello', as a result you go to the 'Home' page and there is the word 'hello' highlighted. That this is going to happen you have to install the psm_highlight (Keyword Highlighting) extension by Christoph Köpernick and activate this option in the backend.

Charset

You might choose a different character set than the default 'UTF-8' here. Just leave it if you're not sure but if Umlaute (ä, ö, ü, ...) don't work try charset 'ISO-8859-15'.

Startingpoint

Define a point in the pagetree on which the search should start.

Recursive

Define the levels in the pagetree that the search should crawl down starting at the startingpoint.

Template file

By default the template file in the extension directory /res/tmpl is taken (search.tmpl) but you can define a different one. Needed in the file is an input box that has the onkeyup="javascript: tx_mhajaxsearch_search(this.value);" defined and a div area that has the id=”tx_mhajaxsearch_result”.

Stylesheet

The usual stylesheet is located in /res/style/ but you may change that here.

Ignore stylesheet

Don't want to include a separate stylesheet 'cause you have your own? No problem, just activate this option. Warning: If you check this option the spinner hiding doesn't work anymore since this is a stylesheet definition. If this case have a look into the default stylesheet located in the extension directory typo3conf/ext/mh_ajaxsearch/res/style/ and copy/paste the #tx_mhajaxsearch_spinner definition into your own stylesheet.

Additional searching tables

This is a very complex thing. You may define additional tables that should be searched. By default the extension only searches the tt_content table. The format to enter is 'table: field1,field2,...: pid'. Separate lots of them with a semicolon (;).

A few examples to understand the whole thing:

  • tt_calender: title,note: pidSearches the title and note fields in the tt_calender table. The reference field to the page id is pid.
  • tt_calender: title,note: pid; tt_news: title,bodytext: pidDoes the same as the one above but additionally searches the tt_news table (title and bodytext). As above the reference field is pid.

PID aliases (x=y;)

Like seen in the title you can define PID aliases in format “x=y;” here. PID aliases are a possibility to define “links” from one page to another. So if you have your news stored in a SysFolder but want the page with PID 4 shown (e.g. your single view) instead of the SysFolder you can define the alias 9 = 4; (9 would be your SysFolder, 4 the page you want to link to).

To define more of them separate with a semicolon (;).

NOTE: Generally SysFolders are ignored. Exceptions only if an alias is defined!

Further submits

This is a field that you could use if you need other parameters to be submitted. So if you want to submit the single news id from a tt_news if an entry is found. So type the table name, a double point, the field to be submitted, another double point and the parameter name that gets the field to be submitted as value. Separate more of them using a semicolon (;).

An example: You're searching the tt_news table via the 'Additional searching tables' field. Now you want the single id to be submitted, so the following code is needed in 'Further submits': tt_news: uid: tx_ttnews[tt_news]

NOTE: This only works with tables that are already included in the searching string. So tt_content and pages is included by default, others have to be added via the 'Additional searching tables' field (e.g. tt_news).

Another example using two parameters: tt_news: uid: tx_ttnews[tt_news]; tt_news: pid: tx_ttnews[backPid]

Aliases on further submits

If this is activated the aliases are also applied to the further submits. If not checked the aliases are ignored for further submits.

Show additional information

This is an option to display additional information in common with each search result line. The greyscale is defined in the stylesheet. NOTE: The ordering is ignored, it's just important if items are selected or not. Information is taken from ...

  • Created – table: pages; field: crdate
  • Modified – table: pages; SYS_LASTCHANGED

Date format

Only needed if additional information is shown. In this case this format represents the format of date the creation and modification date is shown. If you have no idea how this works have a look at http://at2.php.net/manual/en/function.date.php or try 'Y-m-d'.

Alternative Configuration

To insert the plugin anywhere on your page place the plugin.tx_mhajaxsearch_pi1 code somewhere in your TS template:

plugin.tx_mhajaxsearch_pi1 {

startingpoint = 1

recursive = 250

}

Let's have a look at the different types of options. I'll just point to the configuration part when talking about the sense of single points:

nostyle

Property

nostyle

Possible values // examples

0 (stylesheet) | 1(ignore it)

Reference in 'Configuration'

Ignore stylesheet

nospinner

Property

nospinner

Possible values // examples

0 (don't show spinner) | 1 (show spinner)

Reference in 'Configuration'

Don't show spinner

onload

Property

onload

Possible values // examples

tx_mhajaxsearch_q (input field id)

Reference in 'Configuration'

Focus on load

startingpoint

Property

startingpoint

Possible values // examples

4 (pid)

Reference in 'Configuration'

Startingpoint

recursive

Property

recursive

Possible values // examples

3 (levels down)

Reference in 'Configuration'

Recursive

template

Property

template

Possible values // examples

fileadmin/template/myfile.html

Reference in 'Configuration'

Template file

style

Property

style

Possible values // examples

fileadmin/template/res/style.css

Reference in 'Configuration'

Stylesheet

results

Property

results

Possible values // examples

-1 | 50 | 100 | ... (any int number)

Reference in 'Configuration'

Max. results

logging

Property

logging

Possible values // examples

0 (no logging) | 1 (logging enabled)

Reference in 'Configuration'

Enable logging

fwdsword

Property

fwdsword

Possible values // examples

0 (no forwarding) | 1 (forwarding)

Reference in 'Configuration'

Search string forwarding

preview

Property

preview

Possible values // examples

0 | 1 | 50 | ... (any int number)

Reference in 'Configuration'

Enable preview

inclLang

Property

inclLang

Possible values // examples

0 (no alternative language) | 1 (alt. lang.)

Reference in 'Configuration'

Enable alternative language

submit

Property

submit

Possible values // examples

tt_news: uid: tt_news_sid

Reference in 'Configuration'

Further submits

addReplace

Property

addReplace

Possible values // examples

0 (no further submit aliases) | 1 (aliases on further submits)

Reference in 'Configuration'

Aliases on further submits

nointro

Property

nointro

Possible values // examples

0 (introduction shown) | 1 (introduction hidden)

Reference in 'Configuration'

No introduction sentence

addInfo

Property

addInfo

Possible values // examples

coma-separated list of some of the following values:

- crdate (= creation)

- SYS_LASTCHANGED (= modification)

- path

Reference in 'Configuration'

Show additional information

dateFormat

Property

dateFormat

Possible values // examples

date format like 'Y-m-d' or 'd. m. Y'

Reference in 'Configuration'

Date format

charset

Property

charset

Possible values // examples

utf-8 | ISO-8859-1 | ISO-8859-15 | cp1252 | BIG5 | GB2312 | BIG5-HKSCS | Shift_JIS | EUC-JP

Reference in 'Configuration'

Charset

Known Problems

The input field is named 'q' like a lot of other searching input fields on well known searching pages. So, everytime you type something into the field your auto complete field appears and sometimes hides the searching results behind itself.

To fix that just open the template (extension directory and then res/tmpl/search.tmpl) and add an 'autocomplete="off"'-attribute either into the form or the input (name=”q”) tag. I didn't fix that by default because the autocomplete-attribute is not valid W3C!

The extension has a problem when your TYPO3 version is 3.8.1 or older. This comes because the database field entitled tt_content.altText doesnt exist. I fixed that bug so it should work properly now. In case it doesn't open the class.tx_mhajaxsearch_pi1.php file in the extension directory of the mh_ajaxsearch extension (usually typo3conf/ext/mh_ajaxsearch/) and change into the pi1/-directory.

Then comment line numbers 317 and 318 by putting a double slash (//) to the beginning of the lines (like in some lines beyond and beneath).

Please report if more...

To-Do list

  • improve text preview
  • improve language overlay
  • probably create more abilities for the backend

Changelog

  • 0.9.0 – 2009-03-06: new AJAX basis, optimized searching progress
  • 0.8.1 – 2007-06-03: upload bug at new Umlaute-working-version fixed (use this one instead of 0.8.0 version)
  • 0.8.0 – 2007-06-03: Umlaute now working including an option to choose your preferred charset
  • 0.7.2 – 2007-04-19: exclusion of restricted pages added; another try of fixing the XML response output bug which appears in certain (and very unclear) circumstances
  • 0.7.1 – 2007-04-13: bug fixed with XML response output
  • 0.7.0 – 2007-03-26: nearly complete rewrite; now working with realurl and every kind of database; xajax-ext needed!
  • 0.6.5 – 2007-02-05: bug fixed; YOULL BE WARNED: UPDATING TO THIS VERSION WILL PROBABLY DISCARD SOME OF YOUR MH_AJAXSEARCH-FLEXFORM- SETTINGS (on the other hand the backend flexform will be clearer)
  • 0.6.4 – 2007-02-02: aliases on further submits added
  • 0.6.3 – 2007-02-01: bug fixed – thanks to Joachim Streit
  • 0.6.2 – 2007-02-01: further submits added – ability to submit other parameters in the URL (thanks to Joachim Streit)
  • 0.6.1 – 2007-01-13: SysFolder-Bug fixed; Aliases added
  • 0.6.0 – 2006-12-30: extension now works with PHP4 and TYPO3 3.8.1(thanks to Gabriel Schreiber and Michael Glaesser)
  • 0.5.1 – 2006-12-28: bugfixing with special chars and outlining search string
  • 0.5.0 – 2006-12-27: text preview implemented
  • 0.4.0 – 2006-12-10: search string forwarding implemented
  • 0.3.0 – 2006-12-07: backend module for viewing statistics added
  • 0.2.0 – 2006-11-28: ability to add the plugin anywhere on the page (e.g. somewhere in the main structure)
  • 0.1.1 – 2006-11-27: added ability to hide the spinner and focus search field on load
  • 0.1.0 – 2006-11-26: General searching ability (initial release)

img-1 EXT: Ajax Searching Engine - 5