2013-11-01, 23:13
just another example, where the optional replacement comes in handy
eg if you want to replace like this:
<title> (<year>) - <imdb_id> - <videoformat>
Usually you would do this with
$T ($Y) - $I - $F
But what happens, when some parameter are empty?
Would result in weird names like
<title> () - - <videoformat>
This is where the optional replacement kicks in
Just use the curly brackets and a single replacement char in it.
$T{ ($Y)}{ - $I}{ - $F}
Note the space and separator chars within!
IF the $x value is empty the complete {...} tag will be empty.
But if the $x is filled, it just exchanges the variable, keeping all the extra stuff in there
hth
hth
eg if you want to replace like this:
<title> (<year>) - <imdb_id> - <videoformat>
Usually you would do this with
$T ($Y) - $I - $F
But what happens, when some parameter are empty?
Would result in weird names like
<title> () - - <videoformat>
This is where the optional replacement kicks in
Just use the curly brackets and a single replacement char in it.
$T{ ($Y)}{ - $I}{ - $F}
Note the space and separator chars within!
IF the $x value is empty the complete {...} tag will be empty.
But if the $x is filled, it just exchanges the variable, keeping all the extra stuff in there
hth
hth