Examples

The following gives you an example template configuration how you may use the extension on your website. You may take this to start using Rating AX and just playing around with the configuration options.

HTML-Template (fileadmin/templates/fullSize.html)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
   xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
   xmlns:thr="Thucke\ThRating\ViewHelpers"
   data-namespace-typo3-fluid="true">

<div class="exampleBlock">
   <div class="example">
      <h2><f:cObject typoscriptObjectPath="example.7.headerText" /></h2>
      <f:format.raw><f:cObject typoscriptObjectPath="example.7" /></f:format.raw><br/>
   </div>
</div>
<hr/>
<div class="exampleBlock">
   <div class="example">
      <h2>Plain ViewHelperDemo</h2>
      <p>This rating is included using the Fluid viewhelper of the extension.
      The UID in this example is static regardless which page you select in the frontend.
      It should be easy for you to replace the here choosen static UID with a variable one.</p>
      <thr:rating ratetable="tx_any_table" ratefield="anyField" ratedobjectuid="1" ></thr:rating>
   </div>
</div>
<div class="contentBlock">
   <h2>Content</h2>
   <f:format.raw>{content}</f:format.raw>
</div>

CSS-file (fileadmin/templates/fullSize.css)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
.exampleBlock {
   padding:0px;
   margin:0px;
   line-height:125%;
   font-family:verdana, arial, sans-serif;
   background-color:#FFFF; font-size:0.9em;
}
.example {
   padding:20px;
   font-size:1.1em;
}
.exampleBlock h2 {
   color:#FF8700;
   font-weight:bold; font-size:1.0em;
   margin-bottom:0.5em; margin-top:1.3em;
   white-space:nowrap;
}

Typoscript templates

The following seperates different template files for better structure.

Main

This template must be activated as the root template of your TYPO3 installation. It should include all other template definitions.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#replace this uid with the one on your site
plugin.tx_felogin_pi1.storagePid = 3

config {
   no_cache = true
   removeDefaultJS = external
   inlineStyle2TempFile = 1
   meaningfulTempFilePrefix = 100

   sys_language_mode = content_fallback;0
   sys_language_overlay = 1
   # Setting up the language variable "L" to be passed along with links
   linkVars = L

   // configure default language
   sys_language_uid = 2
   language = en
   locale_all = en_GB.utf8
}

# German language, sys_language.uid = 1
[globalVar = GP:L = 1]
config {
   sys_language_uid = 1
   language = de
   locale_all = de_DE
   htmlTag_langKey = de
   dateFormat = %x
   timeFormat = %X
}

# English language, sys_language.uid = 2
[globalVar = GP:L = 0]
config {
   sys_language_uid = 2
   locale_all = en_GB
   htmlTag_langKey = en
   language = en
   dateFormat = %x
   timeFormat = %X
}

[global]

Page definition

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
page = PAGE
page.typeNum = 0
page.includeCSS.file = fileadmin/templates/fullSize.css

# Create a Fluid Template
page.10 = FLUIDTEMPLATE
page.10 {
   file = fileadmin/templates/fullSize.html
   variables {
      siteName = TEXT
      siteName.value = Ratinx AX examples
      content < styles.content.get
   }
}

Rating extension

Please set mapAnonymous to a valid frontend user id.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
plugin.tx_thrating.ratings {
   # adjust default starrating config
   stars < plugin.tx_thrating.ratingConfigurations.stars
    stars {
      settings {
         mapAnonymous = 2
         cookieLifetime = 0
      }
      fluid {
         layouts {
            default {
               showSummary = 1
            }
         }
         templates {
            ratinglinks.tooltips = 1
         }
      }
   }
   # adjust default barrating config
   barrating < plugin.tx_thrating.ratingConfigurations.barrating
    barrating {
      settings {
         mapAnonymous = 2
         cookieLifetime = 0
      }
      fluid {
         layouts {
            default {
               showSummary = 1
            }
         }
         templates {
            ratinglinks.tooltips = 1
         }
      }
   }
   # adjust default starsTilt config
   starsTilt < plugin.tx_thrating.ratingConfigurations.starsTilt
    starsTilt {
      settings {
         mapAnonymous = 2
         cookieLifetime = 0
      }
      fluid {
         layouts {
            default {
               showSummary = 1
            }
         }
         templates {
            ratinglinks.tooltips = 1
         }
      }
   }
   # adjust default facesbartilt config
   facesbartilt < plugin.tx_thrating.ratingConfigurations.facesbartilt
   facesbartilt {
      settings {
         mapAnonymous = 2
         cookieLifetime = 0
      }
      fluid {
         layouts {
            default {
               showSummary = 1
            }
         }
         templates {
            ratinglinks.tooltips = 1
         }
      }
   }
}

Example content objects

Please set mapAnonymous to a valid frontend user id.

Example Description
Example 1 Classic starrating
Example 2 Smiley rating
Example 3 Barrating
Example 4 Vertical classic starrating
Example 5 Current rating (text)
Example 6 Current rating (classic starrating)
Example 7 Vote form
Example 8 Vertical rating
Example 9 Polling mode

Example 1

Example 1 - classic starrating

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
example.1 < plugin.tx_thrating
example.1 {
   headerText = TEXT
   headerText.value = Example 1 - classic starrating
   settings {
      ratetable = tt_content
      ratefield = ratinglinkDemo
      richSnippetFields {
         name = header
         description = bodytext
         url =
      }
      mapAnonymous = 2
      enableReVote = 1
      cookieLifetime = 0
      displayOnly = 0
      display = stars
      foreignFieldArrayUpdate = 0
   }
}

Example 2

Example 2 - barrating

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
example.2 < plugin.tx_thrating
example.2 {
   headerText = TEXT
   headerText.value = Example 2 - smiley rating
   settings {
      ratetable = tt_content
      ratefield = ratinglinkDemo
      richSnippetFields {
         name = header
         description = bodytext
         url =
      }
      mapAnonymous = 2
      enableReVote = 1
      cookieLifetime = 0
      displayOnly = 0
      display = smiley
      foreignFieldArrayUpdate = 0
   }
}

Example 3

Example 3 - vertical classic starrating

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
example.3 < plugin.tx_thrating
example.3 {
   headerText = TEXT
   headerText.value = Example 3 - barrating
   settings {
      ratetable = tt_content
      ratefield = ratinglinkDemo
      richSnippetFields {
         name = header
         description = bodytext
         url =
      }
      mapAnonymous = 2
      enableReVote = 1
      cookieLifetime = 0
      displayOnly = 0
      display = barrating
      foreignFieldArrayUpdate = 0
   }
}

Example 4

Example 4 - current rating (text)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
example.4 < plugin.tx_thrating
example.4 {
   headerText = TEXT
   headerText.value = Example 4 - vertical classic starrating
   settings {
      ratetable = tt_content
      ratefield = ratinglinkDemo
      richSnippetFields {
         name = header
         description = bodytext
         url =
      }
      mapAnonymous = 2
      enableReVote = 1
      cookieLifetime = 4
      displayOnly = 0
      display = starsTilt
      foreignFieldArrayUpdate = 0
   }
}

Example 5

Example 5 - current rating (classic starrating)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
example.5 < plugin.tx_thrating
example.5 {
   action = show
   switchableControllerActions {
      Vote {
         1 = show
      }
   }
   headerText = TEXT
   headerText.value = Example 5 - current rating (text)
   settings {
      ratetable = tt_content
      ratefield = ratinglinkDemo
      richSnippetFields {
         name = header
         description = bodytext
         url =
      }
      fluid {
         layouts.default.showSummary = 1
         partials {
            showTextInfo = 1
            showGraphicInfo = 0
         }
      }
     mapAnonymous = 2
     enableReVote = 0
     cookieLifetime = 0
     displayOnly = 0
     display = stars
     foreignFieldArrayUpdate = 0
     showNotRated = 1
   }
}

Example 6

Example 6 - vote form

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
example.6 < plugin.tx_thrating
example.6 {
   headerText = TEXT
   headerText.value = Example 6 - current rating (classic starrating)
   settings {
      ratetable = tt_content
      ratefield = ratinglinkDemo
      richSnippetFields {
         name = header
         description = bodytext
         url =
      }
      fluid.partials.showTextInfo = 0
      mapAnonymous = 2
      enableReVote = 1
      cookieLifetime = 0
      displayOnly = 0
      display = stars
      foreignFieldArrayUpdate = 0
   }
}

Example 7

Example 7 - vertical rating

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
example.7 < plugin.tx_thrating
example.7 {
   action = new
   switchableControllerActions {
      Vote {
         1 = new
      }
   }
   headerText = TEXT
   headerText.value = Example 7 - vote form
   settings {
      ratetable = tt_content
      ratefield = ratinglinkDemo
      richSnippetFields {
         name = header
         description = bodytext
         url =
      }
      fluid {
      layouts.default.showSummary = 1
      partials {
         showTextInfo = 1
         showGraphicInfo = 0
      }
     }
      mapAnonymous = 2
      enableReVote = 0
      cookieLifetime = 0
      displayOnly = 0
      display = stars
      foreignFieldArrayUpdate = 0
   }
}

Example 8

Example 8 - polling mode

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
example.8 < plugin.tx_thrating
example.8 {
   headerText = TEXT
   headerText.value = Example 8 - vertical rating
   settings {
      ratetable = tt_content
      ratefield = ratinglinkDemo
      richSnippetFields {
         name = header
         description = bodytext
         url =
      }
      mapAnonymous = 2
      enableReVote = 1
      cookieLifetime = 0
      displayOnly = 0
      display = facesbartilt
      foreignFieldArrayUpdate = 0
   }
}

Example 9

Example 8 - polling mode

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
example.9 < plugin.tx_thrating
example.9 {
   action = polling
   switchableControllerActions {
      Vote {
         1 = polling
      }
   }
   headerText = TEXT
   headerText.value = Example 9 - polling mode
   settings {
      ratetable = tt_content
      ratefield = ratinglinkDemo
      richSnippetFields {
         name = header
         description = bodytext
         url =
      }
      mapAnonymous = 2
      cookieLifetime = 0
      displayOnly = 0
      display = polling
   }
}