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.

Urd Fluidhelper

Created:2014-05-09T11:11:32
Changed:2014-05-12T13:20:33.620000000
Classification:urd
Keywords:urd, viewhelper, render content, language menu, menu tree, menu breadcrumb, rootline, image, linktype, typolink, set variables, trim, page infos, string replace
Author:Stephan Langenegger
Email:admin@stibo.ch
language:en

Urd Fluidhelper

Extension Key: urd

Language:

Version: 1.0.5

Keywords: urd, viewhelper, render content, language menu, menu tree, menu breadcrumb, rootline, image, linktype, typolink, set variables, trim, page infos, string replace

Copyright 2013, Stephan Langenegger, <admin@stibo.ch>

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

`Urd Fluidhelper 1 <#__RefHeading__1027_1696583212>`_

`Introduction 3 <#__RefHeading__5710_1738894311>`_

What does it do? 3

`Namespace 4 <#__RefHeading__3150_1854705220>`_

`ViewHelpers 5 <#__RefHeading__467_413120346>`_

content.render 5

image 5

language.current 5

language.list 6

menu.breadcrumb 6

menu.tree 7

menu.inrootline 8

page.info 8

set 9

typolink.type 9

typolink.link 9

trim 10

replace 10

`ChangeLog 12 <#__RefHeading__31623_818911409>`_

Introduction

What does it do?

Urd Fluidhelper offers a few useful ViewHelpers for Fluid:

  • Render a content element by uid
  • Get a language menu as array
  • Get the current language
  • Get a breadcrumb menu as array
  • Get a recursive menu tree as array
  • Check if a page is in another pages rootline
  • Images without fixed dimensions
  • Get the type of a link (page, extern, email etc.)
  • Create a dynamic link according to its type (extern = _blank etc.)
  • Trims a string and remove multiple whitespaces
  • Sets variables within a fluid template
  • Get page-infos from a single page
  • Replace strings

Namespace

The following namespace must be defined on top of every fluid template in which you use an urd viewhelper:

{namespace urd=Tx_Urd_ViewHelpers}

ViewHelpers

content.render

Render a content element from tt_content by its uid .

Example
<urd:content.render uid=”123” />
Arguments
uid

Property

uid

Data type

integer

Description

The content element uid

Default

required

Returns

The complete HTML code of the content element.

image

Creates an image. Identically to the default image fluidhelper, except for one argument (showSizeAttr = false), which makes the image fluid.

OnlySrc allows you to output only the image-url, without the a tag. Useful for custom tags or background images.

Example
<urd:image src={image} showSizeAttr=”false” />
Arguments
showSizeAttr

Property

showSizeAttr

Data type

boolean

Description

Add width and height attribute to the img-tag if true.

Default

true

onlySrc

Property

onlySrc

Data type

boolean

Description

If true, only the image url will be returned, without a-tag

Default

false

Returns

The HTML code (onlySrc = false) or the image url (onlySrc = true).

language.current

Gets the current page language as array. If you define a field, then only the value from this field will be returned.

Example
<urd:language.current defaultLanguage=”Deutsch” />
Arguments
defaultLanguage

Property

defaultLanguage

Data type

string

Description

The Name of the default language

Default

required

useCacheHash

Property

useCacheHash

Data type

boolean

Description

Use typolink chash

Default

true

field

Property

field

Data type

string

Description

The name of a single field

Default

„“

Returns

The language as array (field = „“) or the defined single field.

language.list

Gets a language list array containing all the available languages for the current page.

Example
<urd:language.list defaultLanguage=”Deutsch” />
Arguments
defaultLanguage

Property

defaultLanguage

Data type

string

Description

The Name of the default language

Default

required

useCacheHash

Property

useCacheHash

Data type

boolean

Description

Use typolink chash

Default

true

showOnlyTranslated

Property

showOnlyTranslated

Data type

boolean

Description

Show only translated language

Default

true

showActive

Property

showActive

Data type

boolean

Description

Show the active language

Default

true

sorting

Property

sorting

Data type

string

Description

Sorted list of language ids

Default

null

Returns

The active languages as one-dimensional array.

page.info

Gets informations from a single page. If the field argument is defined, only this field will be returned. If not, you will receive an array containing all the available page-infos.

Example (all infos)
<urd:page.info pageUid=”24” />
Example (single info)
<urd:page.info pageUid=”24” field=”title” />
Arguments
pageUid

Property

pageUid

Data type

integer

Description

The page uid. Default is the current page id.

Default

$GLOBALS["TSFE"]->id

field

Property

field

Data type

mixed

Description

Name of a single field, if you only need one single page-info

Default

Returns

An array containing all page-infos if field is not defined, else an mixed value depending on which field you define.

set

Sets any variable within a fluid template. The variable can be invoked like normal fluid variables, just after the assignation.

Example (string)
<urd:set var=”stringvar” value=”var value” />
Example (array)
<urd:set var=”arrayvar” value={key:'value'} />
Arguments
var

Property

var

Data type

string

Description

Name of the variable

Default

required

value

Property

value

Data type

mixed

Description

Value which should be assigned to the var.

Default

required

overwrite

Property

overwrite

Data type

boolean

Description

If false, already existing variables won't be overwritten

Default

true

Returns

Nothing.

trim

Trims a string and removes multiple whitespaces.

Example
<urd:trim string={string} all=”true” />
Arguments
string

Property

string

Data type

string

Description

The string which should be trimmed

Default

required

all

Property

all

Data type

boolean

Description

If true ALL multiple whitespaces will be removed from the string

Default

true

Returns

The trimmed string.

replace

Replaces a string inside a string with another string.

Example
<urd:replace subject=”i am a banana” search=”banana” replace=“tomatoe“ />
Arguments
replace

Property

replace

Data type

string

Description

The replacement value

Default

required

subject

Property

subject

Data type

string

Description

The string being searched and replaced on

Default

„“

Returns

The new replaced string.

ChangeLog

1.0.4

Version

1.0.4

Changes

Updated all ViewHelpers for TYPO3 6.2+

New argument overwrite added to the set -Viewhelper

New ViewhHelper replace

New ViewHelper language.current

New ViewHelper language.list

Fixed the typolink.type detection Function

1.0.3

Version

1.0.3

Changes

New ViewHelper trim New ViewHelper set New ViewHelper page.info New argument hideDoktypes added to the menu.tree -ViewhelperNew argument reverse, startLevel and showLast added to the menu.breadcrumb -ViewhelperNew argument onlySrc added to the image -ViewhelperNew arguments noLinkTag, attributesPageLink, attributesEmailLink, attributesFileLink and attributesExternalLink added to the typolink.link -Viewhelper

1.0.2

Version

1.0.2

Changes

Manual fixed and new extension icon added

1.0.1

Version

1.0.1

Changes

First stable release.