User Tools

Site Tools


Translations of this page:

Sidebar

Documentation index

import_replacements

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  while we need width=500

If this field 	= URL
Contains this value = xvideo 

ie this rules works only if we have 'xvideo' in URL 

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://somesposnor/gallery/xxxx.html?id=25, while we need id=30.

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, while others - 2 (both for title and description), so a page may look a bit truncatedб so we can copy something into an empty field

an example replacement

If this field 	= Title
Contains this value = <!--EMPTY_VALUE-->
Then Search For  - * (* - means "everything\all")
in This Field 	- Title
And Replace it With - 	{DESCRIPTION}

So if "Title" == empty then replace it with "description" 

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 “!” or “..” at the end of each title

So we create a script that can fo it http://domain.com/replace.php

<?php
$rand_char = (rand(0, 100) > 50) ? '!' : '..';
echo $_GET['phase'] . $rand_char;

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::http://domain/replace.php?phase={ALT}

That means that for each imported gallery we will request http://domain/replace.php?phase={ALT} where {ALT} is an actual alt(title) for this gallery and replace.php will return a new value (with ! or .. at the end), and the script will save it this way into DB
 

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::http://domain/replace.php?phase={ALT}

import_replacements.txt · Last modified: 2017/03/27 09:13 (external edit)