* 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:
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
include('/home/user/domain.com/file.txt'); ?>
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
include('http://domain.com/file.txt'); ?>
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