Documentation
Version 1 (Armin Ruediger Vieweg, 2012-03-12 17:26)
| 1 | 1 | h1. Documentation |
|
|---|---|---|---|
| 2 | 1 | ||
| 3 | 1 | h2. Installation |
|
| 4 | 1 | ||
| 5 | 1 | Just install the extension and include the "static setup":http://forge.typo3.org/projects/extension-sprite/repository/entry/trunk/Configuration/TypoScript/setup.txt to your template. |
|
| 6 | 1 | ||
| 7 | 1 | h2. Configuration |
|
| 8 | 1 | ||
| 9 | 1 | h3. Create my first sprite |
|
| 10 | 1 | ||
| 11 | 1 | It is very easy to setup the first sprite. Just create a folder and put some images in there, then use this snippet: |
|
| 12 | 1 | <pre><code> page.5 < lib.sprite_generator |
|
| 13 | 1 | page.5.userFunc { |
|
| 14 | 1 | name = whatever |
|
| 15 | 1 | directories.10 = fileadmin/templates/images/sprite/ |
|
| 16 | 1 | }</code></pre> |
|
| 17 | 1 | ||
| 18 | 1 | Set a unique name, which will be used as prefix for sprite classes. In this example the spriteclass will look like: tx-sprite-whatever-imagename. |
|
| 19 | 1 | You can define several directories, so it is used like an array (.10, .20, ...). |
|
| 20 | 1 | ||
| 21 | 1 | You need to assign the user-function call to the page node. Then the sprite will be created and the css file will attached to headerData. |
|
| 22 | 1 | ||
| 23 | 1 | ||
| 24 | 1 | h3. Use my first sprite |
|
| 25 | 1 | ||
| 26 | 1 | Now we have a cool sprite, but of course we want to use it in our template. Instead using the IMAGE cObject we use this: |
|
| 27 | 1 | <pre><code> lib.logo < lib.spriteImage |
|
| 28 | 1 | lib.logo.params = class="tx-sprite-whatever tx-sprite-whatever-logo" alt="The optional alt tag" |
|
| 29 | 1 | </code></pre> |
|
| 30 | 1 | ||
| 31 | 1 | We need to define two classes: |
|
| 32 | 1 | # The class of the sprite, which contains the image |
|
| 33 | 1 | # The class of the sprite part we want to show. It contains the automatic calculated background positions and the width and height of our image |
|
| 34 | 1 | ||
| 35 | 1 | This example tells us, that there exists an image _logo.png_ in the specified _fileadmin/templates/images/sprite/_ directory. The name of the image (without extension) will be taken as last part of the sprite classname. |