.. You may want to use the usual include line. Uncomment and adjust the path. .. include:: ../Includes.txt ======================================= Browser Tutorial Search and Filter (en) ======================================= :Author: Kasper Skårhøj :Created: 2002-11-01T00:32:00 :Changed by: dirk :Changed: 2014-05-01T03:42:23 :Classification: browser_tut_search_en :Description: Provide a search form and filters for your data on your website. The Browser - the TYPO3-Frontend-Engine - enables searching and filtering in every database. The Browser enables to search in areas like from last month to next month or from 10.000 EUR to 20.000 EUR. It enables a radial serach (Umkreissuche) in every database. Category menus can displayed in form of a tree view. :Keywords: forAdmins, forDevelopers, browser, typo3 without php, tutorial, search, filter, radial search, umkreissuche, treeview, areas :Author: Dirk Wildt, Die Netzmacher :Email: http://wildt.at.die-netzmacher.de :Website: http://die-netzmacher.de :Language: en |img-1| |img-2| extKey: browser\_tut\_search\_en |img-3| .. _Browser-Tutorial-Search-and-Filter-en: Browser Tutorial Search and Filter (en) ======================================= Provide a search form and filters for your data on your website. The Browser - the TYPO3-Frontend-Engine - enables searching and filtering in every database. The Browser enables to search in areas like from last month to next month or from 10.000 EUR to 20.000 EUR. It enables a radial serach (Umkreissuche) in every database. Category menus can displayed in form of a tree view. |img-4| Version: 4.9.0, 2014-05-02 - Version is corresponding with the version of the Browser. Extension Key: browser\_tut\_search\_en - Tutorial for the extension Browser (extkey: browser) Language: en Keywords: forAdmins, forDevelopers, browser, typo3 without php, tutorial, search, filter, radial search, umkreissuche, treeview, areas Copyright 2009-2014, Dirk Wildt, Die Netzmacher, 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.org `_ .. _Table-of-Contents: Table of Contents ----------------- `Browser Tutorial Search and Filter (en) 1 <#__RefHeading__12229_1904948122>`_ `Screen Shots 3 <#__RefHeading__12231_1904948122>`_ `Frontend 3 <#__RefHeading__13092_922500463>`_ `Backend 5 <#__RefHeading__13094_922500463>`_ `Introduction 6 <#__RefHeading__12239_1904948122>`_ `What does the Tutorial do? 6 <#__RefHeading__12241_1904948122>`_ `What does the Browser Search and Filter do? 6 <#__RefHeading__12243_1904948122>`_ `Further Information 6 <#__RefHeading__12245_1904948122>`_ `Tutorial search 7 <#__RefHeading__12251_1904948122>`_ `Example with tt\_news 7 <#__RefHeading__12253_1904948122>`_ `Test it! 8 <#__RefHeading__12261_1904948122>`_ `Configuring the search form 10 <#__RefHeading__12269_1904948122>`_ `Extending the search 12 <#__RefHeading__12281_1904948122>`_ `Search and filter 13 <#__RefHeading__19710_976858060>`_ `Security 13 <#__RefHeading__12287_1904948122>`_ `Tutorial filters and a category menu 14 <#__RefHeading__12293_1904948122>`_ `The Common Ground 14 <#__RefHeading__13564_976858060>`_ `The Difference 14 <#__RefHeading__13568_976858060>`_ `Workflow 14 <#__RefHeading__13574_976858060>`_ `HTML Template 15 <#__RefHeading__12301_1904948122>`_ `TypoScript 16 <#__RefHeading__12303_1904948122>`_ `TypoScript Object Browser 17 <#__RefHeading__3651_353271708>`_ `Tutorial Radial Search (Umkreissuche) 18 <#__RefHeading__3475_353271708>`_ `What does it do? 18 <#__RefHeading__9981_1850859471>`_ `Configuring 18 <#__RefHeading__9983_1850859471>`_ `Performance 20 <#__RefHeading__9985_1850859471>`_ `Tutorial tree view 21 <#__RefHeading__9987_1850859471>`_ `Hierarchical list, hierarchical checkbox 21 <#__RefHeading__19502_833091110>`_ `Restrictions 21 <#__RefHeading__18815_631209951>`_ `What does this tutorial do? 21 <#__RefHeading__7547_2105258750>`_ `Step overview 21 <#__RefHeading__7549_2105258750>`_ `cps\_tcatree 22 <#__RefHeading__7551_2105258750>`_ `Extending the SQL table manufacturer 22 <#__RefHeading__7557_2105258750>`_ `Extending the TCA configuration 23 <#__RefHeading__7559_2105258750>`_ `Frontend works 26 <#__RefHeading__7571_2105258750>`_ `Tree view in depth 30 <#__RefHeading__7579_2105258750>`_ `Based on the jQuery plugin jsTree 30 <#__RefHeading__7581_2105258750>`_ `Cookies 30 <#__RefHeading__10509_2105258750>`_ `Themes 31 <#__RefHeading__7583_2105258750>`_ `More than one tree view 32 <#__RefHeading__10517_2105258750>`_ `Disable the tree view / top level only 34 <#__RefHeading__6908_1478459716>`_ `How to add an own script? 35 <#__RefHeading__10519_2105258750>`_ `Use marker in your script 35 <#__RefHeading__10521_2105258750>`_ `Restrictions 35 <#__RefHeading__4415_865869582>`_ `Known bugs, unproper usability 36 <#__RefHeading__18720_833091110>`_ `More examples 37 <#__RefHeading__7585_2105258750>`_ `Quick Shop - 1 Filter 37 <#__RefHeading__8078_353271708>`_ `Green Cars - Dynamic Filter 41 <#__RefHeading__8080_353271708>`_ `Organiser - Filter for a period (data area) 45 <#__RefHeading__22584_354458180>`_ `Condition for a Filter 47 <#__RefHeading__5816_62016291>`_ `Configuring hits 49 <#__RefHeading__12305_1904948122>`_ `The difference between counting and displaying 49 <#__RefHeading__13096_922500463>`_ `Performance 49 <#__RefHeading__11806_922500463>`_ `Disable counting 49 <#__RefHeading__19504_833091110>`_ `cObject 50 <#__RefHeading__13100_922500463>`_ `Display conditions for a filter item 50 <#__RefHeading__13102_922500463>`_ `The "no value" label 50 <#__RefHeading__13104_922500463>`_ `Replace values 51 <#__RefHeading__13106_922500463>`_ `Configure or disable hits 51 <#__RefHeading__13108_922500463>`_ `Reference 52 <#__RefHeading__13110_922500463>`_ `master\_templates 53 <#__RefHeading__11019_182679940>`_ `CATEGORY\_MENU 54 <#__RefHeading__19871_976858060>`_ `CHECKBOX 54 <#__RefHeading__19873_976858060>`_ `RADIOBUTTONS 54 <#__RefHeading__11296_144712033>`_ `RADIAL SEARCH 55 <#__RefHeading__9989_1850859471>`_ `SELECTBOX 55 <#__RefHeading__11298_144712033>`_ `TREEVIEW 56 <#__RefHeading__19506_833091110>`_ `filter condition 57 <#__RefHeading__11644_62016291>`_ `AREAS 58 <#__RefHeading__15228_354458180>`_ `AREA - Period interval 59 <#__RefHeading__22596_354458180>`_ `AREA - Period hard coded 60 <#__RefHeading__22606_354458180>`_ `AREA - Currency hard coded 60 <#__RefHeading__22608_354458180>`_ `What's new in Version 4? 61 <#__RefHeading__7147_1026684304>`_ `Filter: AND 61 <#__RefHeading__8011_1026684304>`_ `Filter: Checkboxes for Selectbox 61 <#__RefHeading__42547_1751203740>`_ `Filter: cObject 61 <#__RefHeading__42549_1751203740>`_ `Filter: conditions 61 <#__RefHeading__13112_922500463>`_ `Filter: radial search (de: Umkreissuche) 61 <#__RefHeading__8015_1026684304>`_ `Filter: tree view 61 <#__RefHeading__8017_1026684304>`_ `What's new in Version 3.6? 63 <#__RefHeading__15236_354458180>`_ `Area and interval: get parameters with date 63 <#__RefHeading__11652_62016291>`_ `Category Menu 63 <#__RefHeading__14501_976858060>`_ `Configurable: Search respects Filters 63 <#__RefHeading__18247_976858060>`_ `Filter for areas 63 <#__RefHeading__11654_62016291>`_ `Filter for local table 63 <#__RefHeading__15240_354458180>`_ `Helpful suggestions 64 <#__RefHeading__12313_1904948122>`_ `Forum 64 <#__RefHeading__11300_144712033>`_ `Credits 65 <#__RefHeading__8088_353271708>`_ `dorn & malag 65 <#__RefHeading__8090_353271708>`_ `LEG Thüringen 65 <#__RefHeading__13076_1159297345>`_ `To-Do List 66 <#__RefHeading__12315_1904948122>`_ `Known bugs 67 <#__RefHeading__12317_1904948122>`_ `Change Log 68 <#__RefHeading__19508_833091110>`_ `Illustration Index 70 <#__RefHeading__12319_1904948122>`_ .. _Screen-Shots: Screen Shots ------------ .. _Frontend: Frontend ^^^^^^^^ .. _Colored-search-words: Colored search words """""""""""""""""""" |img-5| .. _Tree-view-and-select-boxes: Tree view and select boxes """""""""""""""""""""""""" |img-5| The Browser enables you, to move every category table to a filter. In the illustration above are four category tables used, the first one is tree view, the other three are usual checkboxes. |img-5| The Browser filter modul enables you to use hierarchical checkboxes. |img-5| The illustration above displays filter in a so called depending mode: Items without any hit won't displayed. You can configure, if hits should displayed or not. See the tutorial 'Green Cars - Dynamic Filter' on page 41 below. .. _Check-boxes: Check boxes """"""""""" |img-5| .. _Category-menu-and-areas: Category menu and areas """"""""""""""""""""""" |img-5| The illustration above displays a category menu: a filter in form of a list. And this list is an area. Area means values from one value to a value like from the first day of this week to the last day of this week. .. _Backend: Backend ^^^^^^^ |img-5| .. _Introduction: Introduction ------------ .. _What-does-the-Tutorial-do: What does the Tutorial do? ^^^^^^^^^^^^^^^^^^^^^^^^^^ This is a tutorial for the extension Browser (extkey: browser). It is only a step-by-step introduction for the configuration of the search functionality and filters. If you are interested in other issues, please note the section "Further Informations" below. .. _What-does-the-Browser-Search-and-Filter-do: What does the Browser Search and Filter do? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. _Search: Search """""" - Searching in displayed and in non displayed columns. - Searching for words and phrases. Example: - Sword: "My Phrase" Word another word - Will search for "My Phrase" or "Word" or "another" or "word". - |img-6| Illustration 8: Tutorial in PDF format The search is case insensitive. - The search is configurable: - You can search in every column of every table. It doesn't matter, if table or field are displayed in the current view. - You can configure the search form and the colours of the result items among others. .. _Filter: Filter """""" Filter your data by category menus, checkboxes, radiobuttons, selectboxes and treeviews - Filter are configurable. Examples for possibilities: - Items are cObjects - You can add a first item like "All Cars" - Filter are dynamically. If there isn't any hit, filter items won't be displayed. It's configurable. - Filter count hits. It's configurable. - Filter can handle data areas. Example for a data area: from January to December, from 10.000 EUR to 20.000EUR .. _Further-Information: Further Information ^^^^^^^^^^^^^^^^^^^ .. _This-tutorial-in-PDF-format: This tutorial in PDF format """"""""""""""""""""""""""" You find this manual as PDF file at - doc/manual.pdf - `http://typo3-browser.de/typo3conf/ext/browser\_tut\_search\_en/doc/ma nual.pdf `_ .. _Browser-Manual-and-Browser-Tutorial-Basics: Browser Manual and Browser Tutorial Basics """""""""""""""""""""""""""""""""""""""""" Manual: The Browser has it's own manual (with the reference of course). - HTML: `http://typo3.org/extension-manuals/browser\_manual\_en/current/ `_ - PDF: `http://typo3-browser.de/typo3conf/ext/browser\_manual\_en/doc/ma nual.pdf `_ .. _Tutorial-search: Tutorial search --------------- .. _Example-with-tt-news: Example with tt\_news ^^^^^^^^^^^^^^^^^^^^^ .. _Requirements: Requirements """""""""""" You need - the extension Browser of course - the extension tt\_news `:sup:`0` <#sdfootnote1sym>`_ - a page with - the plugin browser - set in the tab [General] the type of the header to hidden - set in the tab [Plugin] the startingpoint to your sysfolder with the news records - an extension template - with the include static template of the browser - and in the setup field the TypoScript from below. .. _TypoScript: TypoScript """""""""" plugin.tx\_browser\_pi1 { views { list { 1 { select = tt\_news.title, tt\_news\_cat.title } } single { 1 { select = tt\_news.title, tt\_news.short, tt\_news.bodytext, tt\_news\_cat.title } } } } This is the TypoScript for - a list view with the fields tt\_news.title and tt\_news\_cat.title and - a single view with the fields tt\_news.title, tt\_news.short, tt\_news.bodytext, tt\_news\_cat.title. .. _Result-in-the-Frontend: Result in the Frontend """""""""""""""""""""" The Result in the frontend should look like the screen shot below, if you are using the German language: |img-5| .. _Test-it: Test it! ^^^^^^^^ Familiarize you with the search. .. _Example-with-two-words: Example with two words """""""""""""""""""""" Search for the words: Browser Erweiterung |img-5| |img-5| .. _Example-with-seven-words: Example with seven words """""""""""""""""""""""" Search for seven words: Browser Erweiterung Bequem durch die Daten browsen |img-5| |img-5| .. _With-words-and-phrases: With words and phrases """""""""""""""""""""" Search for words and phrases: Browser Erweiterung "Bequem durch die Daten browsen" |img-5| |img-5| .. _Configuring-the-search-form: Configuring the search form ^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. _Configuring-with-the-Plugin: Configuring with the Plugin """"""""""""""""""""""""""" |img-5| Plugin Tab [Lists] Set the Search mode to [Configured] .. _Comment: Comment ~~~~~~~ - Search: TutorialsDummy check box for information only. link to the online tutorial - Search: Form - [X] Display the form - [X] with result phraseResult phrase will appear below the form. - [X] with colored swords (list view)Search words will be colored in the list view. But there is an exclusion: Search words linked values won't be colored. - [ ] with colored swords (single view)Search words will be colored in the single view. But there are some exclusions: Search words in children records and linked values won't be colored. - Search: Checkpoint for colored search words in the single viewDummy check box for information only.If you have the search word in the URL, you can get different links to the same content. Search engines doesn't like it! - Search: wild-cards - Self-acting (recommended)Search words will wrapped with wild-cards by default - User have to add wild-cards - Search: char for a wild-cardYou can use another wild-card. Be aware that are conflicts with the SQL queries: '%' isn't possible for example. .. _List-without-any-Search-Form: List without any Search Form """""""""""""""""""""""""""" |img-5| |img-5| .. _Search-Form-without-any-Result-Phrase: Search Form without any Result Phrase """"""""""""""""""""""""""""""""""""" |img-5| |img-5| .. _Configuring-the-Result-Phrase: Configuring the Result Phrase """"""""""""""""""""""""""""" If you want change the phrase of the result phrase, please configure plugin.tx\_browser\_pi1.displayList.display.searchform.resultPhrase { searchFor.value = Search for searchFor.lang.de = Suche nach ... } .. _Search-results-with-other-Colors: Search results with other Colors """""""""""""""""""""""""""""""" If you like to want less, more or other colors for the search result, please configure the array wrapSwordInResult. Be aware that displayList and displaySingle have there own search form array. // List View plugin.tx\_browser\_pi1.displayList.display.searchform { searchform { wrapSwordInResults { 0 { wrap = \| } 1 { wrap = \| } ... } } } // Single View plugin.tx\_browser\_pi1.displaySingle.display.searchform { searchform { wrapSwordInResults { 0 { wrap = \| } 1 { wrap = \| } ... } } } .. _Extending-the-search: Extending the search ^^^^^^^^^^^^^^^^^^^^ Usually visitors of a website can search in the displayed columns only. The Browser enables to search in every table and field you like - independing of the display mode. .. _Example: Example """"""" You want to display in the list view only the fields: tt\_news.title, tt\_news\_cat.title. But the visitor should search in the fields: tt\_news.title, tt\_news.short, tt\_news.bodytext. .. _TypoScript: TypoScript """""""""" plugin.tx\_browser\_pi1 { views { list { 1 { select = tt\_news.title, tt\_news\_cat.title search = tt\_news.title, tt\_news.short, tt\_news.bodytext } } } } .. _Search-and-filter: Search and filter ^^^^^^^^^^^^^^^^^ By default the search doesn't respect any filter. This has an effect only, if you are using filters or a category menu. The effect is, that .. _Security: Security ^^^^^^^^ .. _The-Minimum-Length-of-a-Sword-Word: The Minimum Length of a Sword Word """""""""""""""""""""""""""""""""" The default for the minimum length of a sword word is three chars. If a word is shorter, it will be removed from the sword. If you want to increase or decrease the minimum length, please configure minLenWord: plugin.tx\_browser\_pi1.advanced { security { sword { minLenWord = 3 } } } .. _MySQL-Security-add-Slashes: MySQL Security: add Slashes """"""""""""""""""""""""""" The Browser secures swords with the PHP method mysql\_real\_escape\_string(). mysql\_real\_escape\_string() adds slashes to \x00, \n, \r, \, ', " and \x1a, but not to \%. The Browser adds a slash to \% too. If you don't like it, please configure csvChars: plugin.tx\_browser\_pi1.advanced { security { sword { addSlashes { csvChars = % } } } } If you need slashes for more than the \%, please add the chars to csvChars comma separated like in the code below: plugin.tx\_browser\_pi1.advanced { security { sword { addSlashes { csvChars = %, \`, ´ } } } } .. _Tutorial-filters-and-a-category-menu: Tutorial filters and a category menu ------------------------------------ You can extend the search form with filters in form of - checkboxes, - radiobuttons and - selectboxes. And you can add a category menu to your HTML template within or without the search form. .. _The-Common-Ground: The Common Ground ^^^^^^^^^^^^^^^^^ .. _Both-have-the-same-Effect: Both have the same Effect """"""""""""""""""""""""" There is no difference between filters and a category menu in principle. Both enables the visitor of your website to search structured. Structured means: Visitors can limit the amount of records – they can search for data – by given categories like: - Display all news with the category “society”. - Display all events, which will happen “next week”. The difference between filters and a category menu isn't the effect but the rendered HTML code. .. _The-Difference: The Difference ^^^^^^^^^^^^^^ .. _Filters-are-a-Part-of-an-HTML-Form: Filters are a Part of an HTML Form """""""""""""""""""""""""""""""""" Filters have to be rendered as a COA object CHECKBOX, RADIOBUTTON or SELECTBOX. All of them are a part of an HTML form. Non item of them will be rendered as a link directly. All of them have to be placed within the Marker ###SEARCHBOX###. .. _AJAX: AJAX ~~~~ Because of AJAX filters have to stand outside the
. .. _A-Category-Menu-is-a-List-of-Links: A Category Menu is a List of Links """""""""""""""""""""""""""""""""" Every item of a CATEGORY\_MENU will be rendered as a link like the items of your main menu. A CATEGORY\_MENU isn't a part of a form. A link doesn't contain any filter criteria of any other filter. .. _Workflow: Workflow ^^^^^^^^ Add to your template the table.field, which should used as a filter or category menu You have to place it within the ###SEARCHBOX### marker, if you like to use a filter as a checkbox, radiobutton or selectbox. You have to place it within the ###SEARCHBOX### marker too, if you like to use a filter as a category menu. Add to your TypoScript the table.field Copy one of the Content Objects CATEGORY\_MENU, CHECKBOX, RADIOBUTTON, SELECTBOX or TREEVIEW from the master\_templates array to the table.field. Configure the category menu , checkbox, radiobuttons, selectbox or treeview. A good example for filters is the extension Green Cars. Green Cars provides the German case story "Fallstudie grüne-autos.org - Datenbank in drei Stunden". It explains very well, what you have to know, if you want to use filters. See - Extension Green Cars in the TYPO3 repository `http://typo3.org /extension-manuals/green\_cars/current/ `_ - Fall Studie "Grüne Autos" `http://gruene- autos.org/typo3conf/ext/green\_cars/doc/fall\_studie.pdf `_ |img-5| .. _HTML-Template: HTML Template ^^^^^^^^^^^^^ Add to your template the table.fields you want to use as filters like in the snippet below. See line 10 to 12. ###MY\_TITLE### ... ... .. _TypoScript: TypoScript ^^^^^^^^^^ Add the table.fields like in the snippet below. Line 6: Add the array filter.Line 7, 10, 13: Add the tables.Line 8, 11, 14: Add the fields.qLine 8, 11, 14: Copy to the fields the selectbox from the array master\_templates plugin.tx\_browser\_pi1 { views { list { 1 { ... filter { tx\_bzdstaffdirectory\_locations { title < plugin.tx\_browser\_pi1.displayList.master\_templates.checkbox } tx\_bzdstaffdirectory\_groups { group\_name < plugin.tx\_browser\_pi1.displayList.master\_templates.radiobuttons } tx\_bzdstaffdirectory\_functions { title < plugin.tx\_browser\_pi1.displayList.master\_templates.selectbox } } ... } } } } .. _TypoScript-Object-Browser: TypoScript Object Browser ^^^^^^^^^^^^^^^^^^^^^^^^^ |img-5| If you want to configure a filter / select box, please open the field array in your TypoScript Object Browser. You will see a lot of commented properties like in the illustration below: |img-5| That's it! .. _Tutorial-Radial-Search-Umkreissuche: Tutorial Radial Search (Umkreissuche) ------------------------------------- .. _What-does-it-do: What does it do? ^^^^^^^^^^^^^^^^ Radial Search (Umkreissuche) enables you, to search for records by distance. Your records must be geo-coded: they must have a latitude and a longitude. `:sup:`0` <#sdfootnote2sym>`_ Radial Search (Umkreissuche) extends your search form with - an input field for a postal code and / or a city, which will auto- completed by AJAX - a select box with options for a radius. Radial Search (Umkreissuche) takes care, that given distance and radius will respected by the search. Each record will extended with a field, which contains the distance. You can display records too, which aren't within the radius. .. _Configuring: Configuring ^^^^^^^^^^^ .. _Extension-Radial-Search-Umkreissuche: Extension Radial Search (Umkreissuche) """""""""""""""""""""""""""""""""""""" - Install the extension Radial Search (Umkreissuche) and enable it. - Add a folder "Radialsearch" to your page tree. It will needed for storing the postal code data. - Add a folder "Radialsearch" to your file list. It will needed for the postal code \*.txt-file. - Maintain the property [Database] of the extension manager. - You have to upload a file with the needed postal codes. - The workflow should be self-explained. - Include the Static Template and take care of the ordering `:sup:`0` <#sdfootnote3sym>`_ : - Radial Search (radialsearch) - Browser (browser) - Maintain the properties of the Constant Editor of the page, where you like to use Radial Search (Umkreissuche) You have to disable the jQuery UI CSS only, because your are controlling the CSS by the Browser plugin.See category [RADIAL SEARCH – CSS] > field: CSS jQuery UI file .. _TypoScript: TypoScript """""""""" .. _Extend-the-search-form-with-the-Radial-Search-fields-input-and-select-box: Extend the search form with the Radial Search fields input and select box. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Extend your filter array with a RADIALSEARCH filter like in the snippet below (here: list view 501 `:sup:`0` <#sdfootnote4sym>`_ ). See line 6. plugin.tx\_browser\_pi1 { views { list { 501 { filter { radialsearch < plugin.tx\_browser\_pi1.displayList.master\_templates.radialsearch } } } } } Extend your HTML with a RADIALSEARCH hashmarker. See from line 7 to 16. plugin.tx\_browser\_pi1 { views { list { 501 { htmlSnippets { marker { filter > filter = TEXT filter { value (
###TX\_ORG\_HEADQUARTERSCAT.TITLE### ###RADIALSEARCH###
) } } } } } } } } .. _Extend-the-list-view-with-Radial-Search-informations: Extend the list view with Radial Search informations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can control HTML and CSS depending on distance and radius: - without any radial search - with a radial search for records, - which are within or - which are outside of the given radius. Sample for a string like "234 Km linear distance from 10115 Berlin and" plugin.tx\_browser\_pi1 { views { list { 501 { ... tx\_org\_headquarters { // placeholder: radialsearch linear distance deleted < plugin.tx\_radialsearch.masterTemplates.linearDistanceString ... This will replace the marker ###TX\_ORG\_HEADQUARTERS.DELETED### with - 237 Km linear distance from 10999 Berlin Kreuzberg - 237 Km Luftlinie entfernt von 10999 Berlin Kreuzberg depending of the current language (default (en), de). See `Organiser > heaquarters > setup.txt `_ `» `_ Sample for a CSS color plugin.tx\_browser\_pi1 { views { list { 501 { ... tx\_org\_headquarters { // placeholder: radialsearch HTML class depending on radius crdate < plugin.tx\_radialsearch.masterTemplates.htmlClass ... This will replace the marker ###TX\_ORG\_HEADQUARTERS.CRDATE### with - radialsearch radialsearch-within-radius - radialsearch radialsearch-outside-radius depending of the distance. HTML snippet:
...
See `Organiser > heaquarters > setup.txt `_ `» `_ .. _Performance: Performance ^^^^^^^^^^^ .. _Example-with-worldwide-postal-codes: Example with worldwide postal codes """"""""""""""""""""""""""""""""""" Postal codes near by 1.2 million `:sup:`0` <#sdfootnote5sym>`_ records and a database with 540 address records - Query with filter and without a radial search needs round about 0.03 seconds - Query with filter and a radial search needs round about 1.3 seconds .. _Example-with-Postal-Codes-of-Germany: Example with Postal Codes of Germany """""""""""""""""""""""""""""""""""" Postal codes near by 16 000 `:sup:`0` <#sdfootnote6sym>`_ records, database with 540 address records - Query with filter and without a radial search needs round about 0.03 seconds - Query with filter and a radial search needs round about 0.05 seconds .. _Tutorial-tree-view: Tutorial tree view ------------------ .. _Hierarchical-list-hierarchical-checkbox: Hierarchical list, hierarchical checkbox ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ A tree view is a hierarchical list or a hierarchical checkbox. .. _Restrictions: Restrictions ^^^^^^^^^^^^ If you want to know, if a tree view is the solution for your demands, please refer to "Restrictions" on page 35 below. |img-5| .. _What-does-this-tutorial-do: What does this tutorial do? ^^^^^^^^^^^^^^^^^^^^^^^^^^^ We like to display categories in a tree view. This tutorial demonstrates, how to extend your own extension. We take the extension green\_cars and extend it with a tree view like - manufacturer 1 - model a - model b - model c - manufacturer 2 ... .. _Step-overview: Step overview ^^^^^^^^^^^^^ - Installing of the extension cps\_tcatree - Define the dependency of cps\_tcatree - Extending the SQL table manufacturer with a parent field for uids - Extending the TCA configuration for the table manufacturer - Extending the HTML template with a marker for the tree view - Extending the TypoScript with a configuration for the tree view .. _cps-tcatree: cps\_tcatree ^^^^^^^^^^^^ .. _Installing: Installing """""""""" |img-5| - Install the extension "Record tree for TCA" (extkey: cps\_tcatree). - Enable the extension. .. _Define-the-dependency-in-ext-emconf-php: Define the dependency in ext\_emconf.php """""""""""""""""""""""""""""""""""""""" Define the dependency to cps\_tcatree in the configuration of your extension. The definition of the dependency isn't obligatory but is best practise. See lines 'dependencies' and 'constraints' in the snippet below. The file is ext\_emconf.php. `wwwrun@s15315906 `_ : .../typo3conf/ext/green\_cars> nano ext\_emconf.php 'browser, **cps\_tcatree** ', ... 'constraints' => array( 'depends' => array( 'browser' => '3.9.6-0.0.0', 'cps\_tcatree' => '0.3.0-0.0.0', ), ... ), .... ?> .. _Extending-the-SQL-table-manufacturer: Extending the SQL table manufacturer ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ We need a field for the parent uid of each category, which should a child of another category. We extend the SQL table with the field uid\_parent. See the snippet below. `wwwrun@s15315906 `_ : .../typo3conf/ext/green\_cars> nano ext\_tables.sql ... # \# Table structure for table 'tx\_greencars\_manufacturer' # CREATE TABLE tx\_greencars\_manufacturer ( uid int(11) NOT NULL auto\_increment, pid int(11) DEFAULT '0' NOT NULL, uid\_parent int(11) DEFAULT '0' NOT NULL, ... ); ... The table tx\_greencars\_manufacturer is now able to administer subcategories. .. _Extending-the-TCA-configuration: Extending the TCA configuration ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. _Make-the-parent-uid-known-to-other-tables: Make the parent uid known to other tables """"""""""""""""""""""""""""""""""""""""" Tables which are connected with the manufacturer table, has to know about the parent uid of the manufacturer table. We configure ext\_tables.php like in the TCA snippet below. See the line with 'treeParentField': `wwwrun@s15315906 `_ : .../typo3conf/ext/green\_cars> nano ext\_tables.php ... $TCA['tx\_greencars\_manufacturer'] = array ( 'ctrl' => array ( 'title' => 'LLL:EXT:green\_cars/locallang\_db.xml:tx\_greencars\_manufacturer', 'label' => 'title', 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser\_id' => 'cruser\_id', 'treeParentField' => 'uid\_parent', ... ), ); ... For your background: The configuration of 'treeParentField' is a demand of the extension cps\_tcatree. And it is a demand of the extension TYPO3 Browser, which is using the TCA based on cps\_tcatree. .. _Extend-the-TCA-form: Extend the TCA form """"""""""""""""""" You have to edit two items and to add the field configuration. Please add the field name 'uid\_parent' to - showRecordFieldList - types. *X* `wwwrun@s15315906 `_ : .../typo3conf/ext/green\_cars> nano tca.php ... $TCA['tx\_greencars\_manufacturer'] = array ( ... 'interface' => array ( 'showRecordFieldList' => 'hidden,title, **uid\_parent** ' ), ... 'columns' => array ( ... 'uid\_parent' => array ( 'exclude' => 0, 'label' => 'LLL:EXT:green\_cars/locallang\_db.xml:tx\_greencars\_manuf acturer.uid\_parent', 'config' => array ( 'type' => 'select', 'form\_type' => 'user', 'userFunc' => 'tx\_cpstcatree->getTree', 'foreign\_table' => 'tx\_greencars\_manufacturer', 'treeView' => 1, 'expandable' => 1, 'expandFirst' => 0, 'expandAll' => 0, 'size' => 1, 'minitems' => 0, 'maxitems' => 2, 'trueMaxItems' => 1, ), ), ... ), 'types' => array ( '0' => array('showitem' => 'hidden;;1;;1-1-1, title;;;;2-2-2, **uid\_parent** ') ), ... ); ... If you take for the label of the field uid\_parent a LLL-value like in the snippet above, please add the value to your locallang file. If you want to know more about the configuration and possibilities of the uid\_parent field, please refer to the manual of the cps\_tcatree. .. _Update-your-extension: Update your extension """"""""""""""""""""" You have to update your extension like in the illustration below. The field "uid\_parent" will added to the manufacturer SQL table. |img-5| .. _Ready-for-tree-ordering: Ready for tree ordering! """""""""""""""""""""""" Clear the Cache of your TYPO3 backend. Open the manufacturer form. You will get a result similar to the illustration below. |img-5| You job is now, to add models and to allocate manufacturers. After finishing you should have a result like in the illustration below. |img-5| .. _Local-table-with-tree-view: Local table with tree view """""""""""""""""""""""""" tx\_greencars\_main.manufacturer is connected with the manufacturer table in our example green\_cars. We have to update the configuration of the field manufacturer of the table tx\_greencars\_main in the TCA. See the snippet below. wwwrun@s15315906: .../typo3conf/ext/green\_cars> nano tca.php ... $TCA['tx\_greencars\_main'] = array ( ... 'columns' => array ( ... 'manufacturer' => array ( 'exclude' => 0, 'label' => 'LLL:EXT:green\_cars/locallang\_db.xml:tx\_greencars\_main. manufacturer', 'config' => array ( 'type' => 'select', 'minitems' => 0, 'size' => 3, 'maxitems' => 5, 'form\_type' => 'user', 'userFunc' => 'tx\_cpstcatree->getTree', 'treeView' => 1, 'expandable' => 1, 'expandFirst' => 1, 'expandAll' => 0, 'foreign\_table' => 'tx\_greencars\_manufacturer', 'foreign\_table\_where' => 'AND 1 ORDER BY tx\_greencars\_manufacturer.uid', 'suppress\_icons' => 1, 'wizards' => array( ... ), ) ), ... If you want to know more about the configuration and possibilities of the uid\_parent field, please refer to the manual of the cps\_tcatree. The form should look like in the illustration below now. |img-5| .. _Frontend-works: Frontend works ^^^^^^^^^^^^^^ .. _HTML-template: HTML template """"""""""""" You have to add a table field marker to the HTML template within the search form section. See the line with the marker ###TX\_GREENCARS\_MANUFACTURER.TITLE### in the HTML snippet below. wwwrun@s15315906: .../typo3conf/ext/green\_cars> nano res/default.tmpl ...