import_replacements
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| import_replacements [2017/03/27 09:13] – admin | import_replacements [2026/03/21 10:11] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ===== Import Replacements ===== | ===== Import Replacements ===== | ||
| - | Rotation | + | In Rotation |
| - | This is very useful to remove\replace some text in import, for example | + | **Example 1: Adjusting embed size** |
| - | **Example 1** | + | Suppose xVideo embeds have width=400, but you need width=500: |
| < | < | ||
| - | xvideo has embedded videos with width=400 | ||
| - | If this field = URL | + | If this field = URL |
| - | Contains this value = xvideo | + | Contains this value = xvideo |
| - | + | ||
| - | ie this rules works only if we have ' | + | |
| - | Then Search For width=400 | + | Then Search For - width=400 |
| - | in This Field - embed code (width=400 is located in embedded code) | + | in This Field - embed code |
| - | And Replace it With - width=500 | + | And Replace it With - width=500 |
| </ | </ | ||
| - | **Example 2** | + | **Example 2: Changing URL parameters** |
| - | Let's say we have import | + | An RSS feed provides URLs like http://somesponsor/ |
| < | < | ||
| - | If this field = URL | + | |
| - | Contains this value = somesposnor | + | If this field = URL |
| - | Then Search For - id=25 | + | Contains this value = somesponsor |
| - | in This Field - URL | + | Then Search For - id=25 |
| - | And Replace it With - id=30 | + | in This Field - URL |
| + | And Replace it With - id=30 | ||
| </ | </ | ||
| + | |||
| ==== EMPTY_VALUE ==== | ==== EMPTY_VALUE ==== | ||
| - | Sometimes a sponsor gives just one description, | + | Replacements support special meta tags for conditional field operations. For SEO purposes, you often need multiple descriptions for a single gallery. Instead of manually entering duplicate content, you can use meta tags to automatically |
| + | |||
| + | Available meta tags: | ||
| + | |||
| + | < | ||
| + | {DESCRIPTION}, | ||
| + | |||
| + | **Example: Populate empty Title from Description** | ||
| < | < | ||
| - | an example replacement | ||
| - | If this field = Title | + | If this field = Title |
| Contains this value = < | Contains this value = < | ||
| - | Then Search For - * (* - means " | + | Then Search For - * (entire field) |
| - | in This Field - Title | + | in This Field - Title |
| - | And Replace it With - {DESCRIPTION} | + | And Replace it With - {DESCRIPTION} |
| - | + | ||
| - | So if " | + | |
| </ | </ | ||
| + | |||
| + | This rule copies the gallery description into any empty Title field, automatically generating a second description for SEO purposes. You can adapt this to copy to other fields like URL or custom fields as needed. | ||
| + | |||
| + | |||
| + | < | ||
| + | |||
| + | special variable to indicate that the field contains only " | ||
| + | |||
| + | |||
| + | ==== ANY_VALUE ==== | ||
| + | |||
| + | Like EMPTY_VALUE, | ||
| ==== external:: ==== | ==== external:: ==== | ||
| - | The main purpose of this replacement is to translate texts but you can use it in any other way, for example | + | This feature was originally designed for translations |
| - | Let's say we want to add " | + | **Example: Randomly |
| + | |||
| + | Create a PHP script at http:// | ||
| < | < | ||
| - | So we create a script that can fo it http:// | ||
| <?php | <?php | ||
| $rand_char = (rand(0, 100) > 50) ? ' | $rand_char = (rand(0, 100) > 50) ? ' | ||
| - | echo $_GET[' | + | echo $_GET[' |
| + | ?> | ||
| </ | </ | ||
| - | and add a rule | + | Then add this replacement |
| < | < | ||
| If this field = URL | If this field = URL | ||
| - | Contains this value = http (all galleries) | + | Contains this value = http |
| - | Then Search For - * | + | Then Search For - * (entire field) |
| - | in This Field - Alt (Title) | + | in This Field - Alt (Title) |
| - | And Replace it With - external:: | + | And Replace it With - external:: |
| - | That means that for each imported gallery | + | </ |
| - | </ | + | |
| + | For each imported gallery, the script requests the URL with the actual | ||
| + | **Example 2: Save processed data to a different field** | ||
| - | Here's another example just to show that you can save the result | + | Use the same logic but save the result |
| < | < | ||
| If this field = URL | If this field = URL | ||
| - | Contains this value = http | + | Contains this value = http |
| - | Then Search For - * | + | Then Search For - * (entire field) |
| - | in This Field - Description | + | in This Field - Description |
| - | And Replace it With - external:: | + | And Replace it With - external:: |
| </ | </ | ||
| + | |||
| + | Now the modified text is saved to the Description field instead of Alt. This flexibility lets you transform data in unlimited ways using custom scripts on your server. | ||
import_replacements.1490605987.txt.gz · Last modified: (external edit)
