Documentation · ViewHelper reference

XSD schema file | vhs 2.1.4

Format / Url / SanitizeStringViewHelper

URL text segment sanitizer. Sanitizes the content into a valid URL segment value which is usable in an URL without further processing. For example, the text "I am Mr. Brown, how are you?" becomes "i-am-mr-brown-how-are-you".

Also useful when creating anchor link names, for example for news entries in your custom EXT:news list template, in which case each news item's title would become an anchor:

And links would look much like the detail view links:

/news/#this-is-a-newsitem-title

When used with list views it has the added benefit of not breaking if the item referenced is removed, it can be read by Javascript (for example to dynamically expand the news item being referenced). The sanitized urls are also ideal to use for AJAX based detail views - and in almot all cases the sanitized string will be 100% identical to the one used by Realurl when translating using table lookups.

  • Tag usage example

    <v:format.url.sanitizeString string="NULL">
    	<!-- tag content - may be ignored! -->
    </v:format.url.sanitizeString>
  • Inline usage example

    {v:format.url.sanitizeString(string: 'NULL')}

Arguments

Argument Description Type
string string
Required attribute

Revision history

commit 522b1ee542a7d630a8137cd1c3f27d6a6b2b9ad3
Author: Claus Due <*****@wildside.dk>
Date:   Mon Nov 5 00:45:09 2012 +0100

    [FEATURE] Format / Url / SanitizeString ViewHelper

commit ee2a6166deab26ac9c7a4d152030b9f0578da38b
Author: Claus Due <*****@wildside.dk>
Date:   Sat Nov 10 21:59:00 2012 +0100

    [DOC] Updated description of Format / Url / SanitizeString

commit da31bad1d9bb058c072ddb5591e8ed907a1ae8e1
Author: Claus Due <*****@namelesscoder.net>
Date:   Tue Dec 31 23:08:37 2013 +0100

    [TASK] Happy new year!

commit d2e531da034976e6db1478eef5a8478595fd16fe
Author: Claus Due <*****@namelesscoder.net>
Date:   Sun Jan 5 00:45:10 2014 +0100

    [TASK] Migrate to using namespace core class names

commit 52bd6e41ccfef3d8193b350153912a9716e6a087
Author: Benjamin Rau <*****@codearts.at>
Date:   Tue Apr 1 21:09:00 2014 +0200

    [TASK] CGL compliance

commit da7677bc74f14e9a9300e4ba4487e52c3cb97642
Author: Claus Due <*****@namelesscoder.net>
Date:   Sun Apr 20 01:13:33 2014 +0200

    [TASK] Switch to namespaces

commit c5c5791488b7e84af200617deb700fcc188a18f2
Author: Björn Fromme <*****@bjo3rn.com>
Date:   Fri Dec 5 11:14:44 2014 +0100

    [TASK] Allow and replace special characters like umlauts
    
    Additional characters or overriding of the built-in map via argument customMap.

commit 69d00904e69cb2107d878b59e1812ec8b12aa588
Author: Björn Fromme <*****@bjo3rn.com>
Date:   Sun Dec 7 11:31:32 2014 +0100

    [TASK] Relocate viewhelper and add alias

commit 8bb2fc5ee124ba19b0a0ab8e061c9a153fc4651f
Author: Xaver Maierhofer <*****@xwissen.info>
Date:   Sun Jan 18 17:56:13 2015 +0100

    [TASK] Reference Copyright to license.md file