This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
import_replacements [2014/01/29 18:04] 127.0.0.1 external edit |
import_replacements [2017/03/27 09:13] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Import Replacements ===== | ||
+ | |||
+ | Rotation - Settings - Import Replacements you can add autoreplacements that will be used always when you import something, that means both Import and ImportSets and even TubeImport. | ||
+ | |||
+ | This is very useful to remove\replace some text in import, for example size of embedded video or some text in gallery description. | ||
+ | |||
+ | **Example 1** | ||
+ | |||
+ | < | ||
+ | xvideo has embedded videos with width=400 | ||
+ | |||
+ | If this field = URL | ||
+ | Contains this value = xvideo | ||
+ | |||
+ | ie this rules works only if we have ' | ||
+ | |||
+ | Then Search For width=400 (what we have in original format) | ||
+ | in This Field - embed code (width=400 is located in embedded code) | ||
+ | And Replace it With - width=500 | ||
+ | |||
+ | </ | ||
+ | |||
+ | **Example 2** | ||
+ | |||
+ | Let's say we have import like http:// | ||
+ | |||
+ | < | ||
+ | If this field = URL | ||
+ | Contains this value = somesposnor | ||
+ | Then Search For - id=25 | ||
+ | in This Field - URL | ||
+ | And Replace it With - id=30 | ||
+ | |||
+ | </ | ||
+ | |||
+ | ==== EMPTY_VALUE ==== | ||
+ | |||
+ | Sometimes a sponsor gives just one description, | ||
+ | |||
+ | < | ||
+ | an example replacement | ||
+ | |||
+ | If this field = Title | ||
+ | Contains this value = < | ||
+ | Then Search For - * (* - means " | ||
+ | in This Field - Title | ||
+ | And Replace it With - {DESCRIPTION} | ||
+ | |||
+ | So if " | ||
+ | |||
+ | </ | ||
+ | |||
+ | ==== external:: ==== | ||
+ | |||
+ | The main purpose of this replacement is to translate texts but you can use it in any other way, for example to replace something that was not provided by the script. | ||
+ | |||
+ | Let's say we want to add " | ||
+ | |||
+ | < | ||
+ | So we create a script that can fo it http:// | ||
+ | |||
+ | <?php | ||
+ | $rand_char = (rand(0, 100) > 50) ? ' | ||
+ | echo $_GET[' | ||
+ | |||
+ | </ | ||
+ | |||
+ | and add a rule | ||
+ | |||
+ | < | ||
+ | |||
+ | If this field = URL | ||
+ | Contains this value = http (all galleries) | ||
+ | Then Search For - * | ||
+ | in This Field - Alt (Title) | ||
+ | And Replace it With - external:: | ||
+ | |||
+ | That means that for each imported gallery we will request http:// | ||
+ | </ | ||
+ | |||
+ | |||
+ | Here's another example just to show that you can save the result into another field | ||
+ | |||
+ | < | ||
+ | |||
+ | If this field = URL | ||
+ | Contains this value = http | ||
+ | Then Search For - * | ||
+ | in This Field - Description | ||
+ | And Replace it With - external:: | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||