User Tools

Site Tools


new_rotation_hints

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
new_rotation_hints [2023/01/09 09:46] – [Suggestions Based on logged searches] adminnew_rotation_hints [2026/04/20 13:55] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== New Rotation Hints  ====== +====== New Rotation Hints ======
  
 ===== Setting GET parameters  ===== ===== Setting GET parameters  =====
  
-This is one the most important things to understand. As mentioned in [[New Rotation Templates#How it works]] all the ages are not static, but generated 'on-the-fly' by the same script and you get different results based on request parameters and templateFor example /scj/tube/index.php?group_name=phones outputs all images from 'phonesgroup, and /scj/tube/index.php?group_name=cars - from groups 'cars'But on site you can use links like /category/phones/ and /category/cars/thanks to mod_rewrite+This is one of the important points that you must definitely understand, because it is used in many places below 
 +As already mentioned in [[New Rotation Templates#How it works]] all pages in new rotation are formed by essentially one script and different results are obtained depending on input parameters. Roughly speaking /scj/tube/index.php?group_name=phones will display thumbs of the phones group, and /scj/tube/index.php?group_name=cars - will display thumbs of the cars groupAlthough on the site it will look like /category/phones/ and /category/cars/clean URLs are provided by rewrites ([[New Rotation Faq#What is mod_rewrite]])
  
-In this example /scj/tube/index.php?group_name=phones group_name=phones is a GET parameter.+In this example /scj/tube/index.php?group_name=phones specifically group_name=phones are GET parameters
  
-What you are supposed to understand after reading this information is how to pass parameters to /scj/tube/index.php and there are few ways to do it.+The main thing to understand in this section is: you can pass parameters to the script /scj/tube/index.php in different ways.
  
 **Option 1** **Option 1**
  
-Direct url to /scj/tube/index.php?group_name=phones . +Direct when you write it like this /scj/tube/index.php?group_name=phones.  
 +The only detail here is how query parameters are written: after the file name comes a ? (question mark), and parameters are separated by & (ampersand).
  
-**2 - rewrites**+**Option 2 - Via rewrites**
  
-Lets say we want to output group 'phones' using template 'super_template' , direct URL - /scj/tube/index.php?group_name=phones&force_template=super_template  +For example we want to display the phones group with a specific template. In option 1 this would look like /scj/tube/index.php?group_name=phones&force_template=super_template which is not very nice. So we write a rewrite
- +
-Rewrite +
  
   RewriteRule ^super_phones\.html$ /scj/tube/index.php?group_name=phones&force_template=super_template   RewriteRule ^super_phones\.html$ /scj/tube/index.php?group_name=phones&force_template=super_template
  
-and you get an URL like this - http://yourdomain/super_phones.html.+and the URL will be beautiful - http://yourdomain/super_phones.html.
  
-**3 - file **+**Option 3 - via file**
  
-The same task for /scj/tube/index.php?group_name=phones&force_template=super_template.  +The rewrite option is good, but it has 2 problems: there are sites without Apache, i.e. purely on nginx for example, which doesn't read .htaccess files and accordingly the rewrites written there don't work. And if there are very many rewrites it starts to put load on the CPU.  
-Create file super_phone.php + 
 +Besides, it's harder to make flexible conditions in rewrites, so there is option 3. 
 + 
 +Same task: a beautiful link for /scj/tube/index.php?group_name=phones&force_template=super_template. Create file super_phone.php with the content 
  
 <code> <code>
Line 36: Line 38:
 </code> </code>
  
-and you get URL like  http://yourdomain/super_phones.php+and we get a beautiful URL http://yourdomain/super_phones.php
  
-===== Different titles ===== +Another advantage of this option is that parameters can be adjusted directly in PHP for conditions not covered by the script, for example:
- +
-There are some tricks to get different titles for pages generated using the same template. +
- +
-For example  'sort' domain/category/asd/1/ctr/ and domain/category/asd/1/date/ +
  
 <code> <code>
-<?php if ($_GET['order'== 'ctr') {?>+<?php 
 +$_GET['group_name'] = 'phones';
  
-<title>Site order by CTR </title>+// here we change the template depending on the referrer 
 +if ($_SERVER['HTTP_REFERER'] == 'google') { 
 +   $_GET['force_template'] = 'super_template_for_google'; 
 +} else { 
 +   $_GET['force_template'] = 'super_template_for_traders'; 
 +}
  
-<?php } elseif ($_GET['order'] == 'date'{ ?>+include('./scj/tube/index.php')
 +</code>
  
-<title>Site order by date </title> 
  
-<?php } else { ?> 
  
-<title>Default order (default = by ctr ) </title> 
  
-<?php } ?> +===== How to sort by date by default, effectively with no homepage rotation, like a regular tube =====
- +
-</code> +
- +
- +
-===== Rating ===== +
- +
-Add styles+
  
 +* Create a main.php file on the domain root that looks like 
 <code> <code>
-<style> +<?php 
-div.rating-cancel,div.star-rating{float:left;width:17px;height:15px;text-indent:-999em;cursor:pointer;display:block;background:transparent;overflow:hidden} +$_GET['order'] = 'date'
-div.rating-cancel,div.rating-cancel a{background:url(/scj/tube/delete.gif) no-repeat 0 -16px} +include('./scj/tube/index.php');
-div.star-rating,div.star-rating a{background:url(/scj/tube/star.gifno-repeat 0 0px} +
-div.rating-cancel a,div.star-rating a{display:block;width:16px;height:100%;background-position:0 0px;border:0} +
-div.star-rating-on a{background-position:0 -16px!important} +
-div.star-rating-hover a{background-position:0 -32px} +
-/* Read Only CSS */ +
-div.star-rating-readonly a{cursor:default !important} +
-/* Partial Star CSS */ +
-div.star-rating{background:transparent!important;overflow:hidden!important} +
-/* END jQuery.Rating Plugin CSS */ +
-</style>+
 </code> </code>
 +  * Write the PATH (NOT URL!!!) to this file in Settings - CJPages (before this, you probably had the path to scj/tube/index.php written there - delete this line, there should be only 1 line left with the path to main.php)
 +  * That's all.
  
  
-Add JS script to make stars selectable +===== How to organize a trade in groups using the new rotation (rewrite) =====
  
-<code> +Firsthow traffic gets from the trader to you:
-<script src='/scj/includes/js/jquery.js' type="text/javascript"></script> +
-<script src='/scj/includes/js/jquery.rating.pack.js' type="text/javascript" language="javascript"></script> +
-<script> +
-$(function(){ +
- $('.auto-submit-star').rating({ +
- callback: function(valuelink){ +
- $('#rating_div').html('Posting...');+
  
- $.get('/scj/tube/index.php', +**The trader has a multi-niche website:**  
-+  * The easiest way is to set up a redirect to the desired niche using a referrer (this is in [[Tube CMS Pages#redirects]]
- 'content_id': '<!--GALLERY_MD5-->', +  * There you can also configure custom words if the names of the trader’s niches do not coincide strongly with yours
- 'action''rating', +
- 'rating': value +
- }, +
-  function(data{ +
-             $('#rating_div').html('Thank you!'); +
-   } +
- ); +
-+
- }); +
-}); +
-</script> +
-</code>+
  
 +**The trader has a single-niche website** 
 +  * or his domain contains a niche keyword, which is a fairly common situation and he will be redirected to the desired niche anyway
 +  * or add its domain to custom niche redirects
  
 +All. You don't need to do anything else for simple options.
  
-adding stars .. +**If for some unknown reason auto-redirect does not suit you and you want the old-style with setting up each trader separately, then the options are as follows:** 
 +  - create rewrite for example 
 +  RewriteRule ^niche\.php$ /?niche_name=niche 
 +  and ask the trader to send http://yourdomain/niche.php 
 +  - option 2 is to create a file for example niche.php like 
 <code> <code>
-<h4>Rate this movie:</h4> <div id='rating_div'>     +<?php 
-    <input class="auto-submit-star" type="radio" name="rating" value="1"/ <? if(<!--RATING--> > 0) echo 'checked?> > +$_GET['group_id'21; /this is the id of the rotation niche 
-    <input class="auto-submit-star" type="radio" name="rating" value="2"<? if(<!--RATING--> > 1) echo 'checked' ?> > +include('./scj/tube/index.php');
-    <input class="auto-submit-star" type="radio" name="rating" value="3"/ <? if(<!--RATING--> > 2) echo 'checked' ?> > +
-    <input class="auto-submit-star" type="radio" name="rating" value="4"<? if(<!--RATING--> > 3) echo 'checked' ?> > +
-    <input class="auto-submit-star" type="radio" name="rating" value="5"/ <? if(<!--RATING--> > 4echo 'checked' ?> > +
-</div>+
 </code> </code>
 +and then either the trader immediately sends to http://yourdomain/niche.php or we go to the trader’s edit and set niche.php to him as a personal page.
  
  
 +If you use any of the complex options, please describe why. We need to add an example of why this might be necessary.
  
-That's it. 
  
 +**Now sending traffic out by groups.**
  
-PS To output rating use <!--RATING--> - it's a number so you can show in any way you want it. 
  
-for example+**Option 1**
  
 +* Create groups for the trade, the name of the trade group must match the name of the rotation groups. In Update 45, a special button even appeared in rotation - groups, which copied the names of groups.
 +  * add rewrite. As you can see, the group is taken into account in the link to the out
 <code> <code>
-<? if(<!--RATING--> > 0echo '*? +RewriteRule ^gal/(.*)/(.*)/index.html?(.*)$ /scj/cgi/out.php?link=images/%{QUERY_STRING}&group=$1&url=content&slug=$3 
-<? if(<!--RATING--> 1) echo '*' ?>  +</code> 
-<? if(<!--RATING--> > 2) echo '*' ?>  +  and change the subtemplate used to display thumbs, so that the links would be something like this 
-<? if(<!--RATING--> > 3) echo '*' ?>  +<code
-<? if(<!--RATING--> > 4) echo '*' ?> +a href='/gal/<!--GROUP_NAME-->/<!--GALLERY_SLUG-->/index.html?<!--THUMB_LINK-->'
 </code> </code>
  
  
 +It’s not difficult to notice that the group name is transmitted via rewrite.
  
-===== Rating +1\-1 like\dislike =====+**Option 2**
  
-and other 2-options rating systems+Update 48 introduced the Trade by groups feature
  
-Actually the trick is simple: we leave only 2 options to chooseIt's gonna be 1 and 2Lets say 1 means "dislike", and 2 - "like"So if average is 1.5 that means 50% of visitors like it1.75 - means 75% like25 dislike. It should be clear.+We have a classic multi-niche CJ site, we want to trade in groupsTo do this, you need to add &group=... to the URLhowever, for tube site with rewrites this is not as convenient and beautiful as we would like. If by default the links look like /gallery/cool_gal/index.html, then to trade by group we need to do something like /gallery/current_group/cool_gal/index.html + change rewrite a little so that the group parameter is passed to the outFor those who find this difficultthere is another option.
  
-What to do:+If you use default rewrite, it means that your category pages have a URL like /category/123/asian/ or simply /category/asian/, which means that if a person clicks in this category, then when out, we can determine in which category the click was made by the referrer, and depending on the category, send it to different groups of traders.
  
-Add JS script  +To use this feature, you need to:
-<code>+
  
-<script src='/scj/includes/js/jquery.jstype="text/javascript"></script> +- If you have not created them yet, then create trade groups with names as rotation categoriesBy the way, you can do this with one click in Rotation - Groups (Copy To Trade Groups) 
 +  - Distribute traders into groups 
 +  - Rotation - CMS - Tube settings enable Niche trade option 
 +  - that's it :)
  
-<script> 
-function post_rating(value) { 
  
-$.get('/scj/tube/index.php', 
- { 
- 'content_id': '<!--GALLERY_MD5-->', 
- 'action': 'rating', 
- 'rating': value 
- }, 
- function(data) { 
-        $('#rating_div').html('Thank you!'); 
- } 
-); 
  
-}+**Option 3**
  
-</script> +Usually there are quite a few niches on a multi-niche CJ site, more than the number of niches in which I would like to distribute traders, for example, 500 niches in rotation, but I would like to distribute traders into only 15 groups.
-</code> +
- +
-Adding vote buttons+
  
 +* Create groups for trade, let’s say the same 15 pieces, the names may or may not coincide with the names of the rotation groups - it doesn’t matter.
 +  * in the rotation groups, find the custom var1 field and for each rotation group, enter the name of the trade group that will be used
 +  * add rewrite. As you can see, the group is taken into account in the link to the out
 <code> <code>
- +RewriteRule ^gal/(.*)/(.*)/index.html?(.*)$ /scj/cgi/out.php?link=images/%{QUERY_STRING}&group=$1&url=content&slug=$2 
-<div id='rating_div'+</code
-current rating = <?=(<!--RATING--> == 0) ? 'not rated' : round( (<!--RATING--> - 1) * 100 ) '%'?<br> +  * and change the subtemplate used to display thumbs, so that the links would be something like this 
-rate it:  +<code> 
- +a href='/gal/<!--GROUP_CUSTOM_VAR1-->/<!--GALLERY_SLUG-->/index.html?<!--THUMB_LINK-->'
-<span onclick='post_rating(2)' style="cursor: pointer"> +1 </span> ............................ +
-<span onclick='post_rating(1)' style="cursor: pointer"> -1 </span> +
- +
-</div> +
- +
-+1 and  -1 can be replaced with whatever you want. +
 </code> </code>
  
  
-That's it ) +===== Thumbs' Rolling  =====
- +
- +
-===== Rotating thumbs of a gallery  =====+
  
-Thumbs rolling is when we have lets say 5 thumbs from the same gallery and when you hover mouse cursor over a thumb it starts to show the rest of those 5 thumbsTake look at demo here [[http://demo.smartcj.com/cat/14/7%20Demo2%20%20Taylor/ctr/1/content_list_pic/image/|example]])  and [[http://demo.smartcj.com/cat/14/7%20Demo2%20%20Taylor/ctr/1/content_list_mov/movie/|example 2]].+Thumb rolling means taking, for example, 5 thumbs from one gallery into rotation to find the best oneYou can also make thumbs roll on mouse hover within gallery. This approach has been developed in tubes, but this has not yet happened in pix sites ([[http://demo.smartcj.com/cat/14/7%20Demo2%20%20Taylor/ctr/1/content_list_pic/image/|example for a picture gallery]], you need to hover over any thumb and wait a split second) and of course the same option [[http://demo.smartcj.com/cat/14/7%20Demo2%20%20Taylor/ctr/1/content_list_mov/movie/|for movie galleries]].
  
-How to do it +It's very easy to do: 
-  * add JS code into your template , it rotates thumbs with id starting with 'rot_'+  * we add JS code to the template, which arranges the roll for all pictures whose ID starts with rot 
 <code> <code>
  
Line 256: Line 212:
 </code> </code>
  
-  adding rot_ id to thumbs (changing subtemplate)+here is a role for thumb whose ID starts with 'rot'. The sub will look something like this:
 <code> <code>
  
 <a href="/gallery/<!--SAFE_DESC-->/<!--GALLERY_ID-->/index.html?<!--THUMB_LINK-->" title="<!--ALT-->"> <a href="/gallery/<!--SAFE_DESC-->/<!--GALLERY_ID-->/index.html?<!--THUMB_LINK-->" title="<!--ALT-->">
-<img id='rot<!--ID-->' src="<!--THUMB_URL-->" class="t_img" alt="" rel="<!--ALL_THUMBS-->" />+<img id='rot<!--GALLERY_ID-->' src="<!--THUMB_URL-->" class="t_img" alt="" rel="<!--ALL_THUMBS-->" />
 </a>  </a> 
 </code> </code>
  
-notice 2 points here+Rolling is based on two things: 
 <code> <code>
-id='rot<!--ID-->' - script rotates only those thumbs that has id starting with 'rot' +id='rot<!--GALLERY_ID-->'the script rolls only thumbs whose ID starts with rot  
-rel="<!--ALL_THUMBS-->" - here script enumerates all available thumbs for this gallery+rel="<!--ALL_THUMBS-->" - here the script lists all available thumbs for this gallery
 </code> </code>
  
  
-===== Internationalization ( i18 ) =====+===== Custom pagination =====
  
-it's pretty easy to translate site's menu (links like Most popularLongest Videos and so on) into different languages.+In mysql there are 2 options for sampling from the database: when the total number of results for a query is counted and when not. The second option is faster. Accordingly, when there is no <pagination macro, the script thinks that exact numbers are not needed, for example prev\next is used, and makes the request the 2nd option.
  
-1. Create custom template 'languages' with set of words like+Therefore, if you need your own navigation and the exact number of TOTAL_ITEMS, you need to insert something like
  
 <code> <code>
-<?php  
-$my_keywords['en'] = array( 
-  'most_popular' => 'Most popular', 
-  'order_by_date' => 'Order By Date', 
-  and so on 
-); 
  
-$my_keywords['es'] = array( +<!-- 
-  'most_popular' ='Lo más leído', +<pagination
-  'order_by_date' ='Ordenar por Fecha', +
-  and so on +</pagination
-);+-->
  
 +</code>
  
-$my_keywords['de'] = array( +There is still a pagination macrobut it is inside an HTML comment, so the script will still calculate <!--TOTAL_ITEMS-->, and you can use that number in your own code.
-  'most_popular' => 'Populärste', +
-  'order_by_date' ='Sortiert nach Datum', +
-  and so on +
-);+
  
-and so on as many languages as you want.+You can make any one to your tasteFor example
  
-Now you have 2 options to setup language for each user+<code>
  
-using browser language+$total_pages = ceil(<!--TOTAL_ITEMS-->/100); 
 +for ($i = 1; $i <= $total_pages; $i++) { 
 +echo "<a href='/?page={$i}'>{$i}</a>"; 
 +
 +</code>
  
-if (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE']'es')) { +where 100 is the number of thumbs you have on your page (you will add itsince you build the template yourself). This is a simple exampleof course you can diversify it as you need for a specific page.
-  $lang = $my_keywords['es']; +
-} elseif (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE']'de')) { +
-  $lang = $my_keywords['de']; +
-} else $lang = $my_keywords['en'];+
  
-or geo_ip 
  
-if ($_SERVER['GEOIP_COUNTRY_CODE'] =='SP') { +**Option 2**
-  $lang = $my_keywords['es']; +
-} elseif ($_SERVER['GEOIP_COUNTRY_CODE'] =='DE') { +
-  $lang = $my_keywords['de']; +
-} else $lang = $my_keywords['en'];+
  
 +In most cases, surfers don’t need the 25th page at all and people don’t go there in most cases, so it makes sense to limit them to, for example, 5 or 10 pages and just fit them into the template as is
  
-Hopefully those examples are pretty self explaining +<code> 
 +<ul class="pages"> 
 +<li><a href="/category/<!--CATEGORY_ID-->/<!--CATEGORY_NAME-->/ctr/1/" title="1">1</a></li> 
 +<li><a href="/category/<!--CATEGORY_ID-->/<!--CATEGORY_NAME-->/ctr/2/" title="2">2</a></li> 
 +<li><a href="/category/<!--CATEGORY_ID-->/<!--CATEGORY_NAME-->/ctr/3/" title="3">3</a></li> 
 +</ul>
  
-at the ens of template you can add a cookie+For beauty, you can select the current page, for example
  
-if ($_GET['set_lng'and isset($my_keywords[$_GET['set_lng']])) { +<li><a href="/category/<!--CATEGORY_ID-->/<!--CATEGORY_NAME-->/ctr/1/" title="1"> 1 here </a></li> 
-  setcookie('force_lng', $_GET['set_lng'], time() + 86400); +add the code and it turns out 
-  $lang = $my_keywords['en']; +<li><a href="/category/<!--CATEGORY_ID-->/<!--CATEGORY_NAME-->/ctr/1/" title="1"> <? if ($_GET['page'== 1'<b>1</b>'1?> </a></li> 
-} elseif ($_COOKIE['force_lng'and isset($my_keywords[$_COOKIE['force_lng']])){ +and the same for the remaining pages.
-  $lang = $my_keywords[$_COOKIE['force_lng']]; +
-}+
  
-That's it for this template 
 </code> </code>
  
-2. Now you have to include this template into each template where you are going to use those words 
  
 +
 +===== Separate page for a list of categories =====
 +**Option 2
 +
 +First
 +**
 +
 +1. Create a custom template, for example cat_template, in which the categories themselves are displayed, for example 
 <code> <code>
-<!--INCLUDE_TEMPLATE_languages-->+<category order=clicks num=1-20> 
 +<a href="/category/<!--CATEGORY_ID-->/<!--CATEGORY_NAME-->/ctr/1/?<!--THUMB_LINK-->" title="<!--CATEGORY_NAME-->"><img src="<!--THUMB_URL-->" class="t_img" alt="" /></a> 
 +</category>
 </code> </code>
  
  
-3. and replace words in templates with variables+2. this page will be visible via the link /scj/tube/?force_template=cat_template 
 + 
 +3. to get a beautiful link, add rewrite
 <code> <code>
-Most popular ->  <?=$lang['most_popular']?> +RewriteRule ^categories/?force_template=cat_template
-Order By Date -> <?=$lang['order_by_date']?> +
-and so on+
 </code> </code>
  
-From this point it should work as it supposed to.+and the page will open at the link domain.com/categories
  
-4. Now we want to add an ability for user to force switch to a selected language  
  
-<code> +**Option 2**
-add a link like +
  
-http://domain/?force_lng=de (and so on any language based on your language array $my_keywords['de'])+1. Create a custom template, for example cat_template, in which the categories themselves are displayed, for example  
 +<code> 
 +<category order=clicks num=1-20> 
 +<a href="/category/<!--CATEGORY_ID-->/<!--CATEGORY_NAME-->/ctr/1/?<!--THUMB_LINK-->" title="<!--CATEGORY_NAME-->"><img src="<!--THUMB_URL-->" class="t_img" alt="" /></a> 
 +</category> 
 +</code>
  
 +2. create a file categories.php at the root of the domain in which
 +<code>
 +<?php
 +$_GET['force_template'] = 'cat_template';
 +include('./scj/tube/index.php');
 </code> </code>
  
  
-That's it.+3The page is available at the link domain.com/categories.php
  
  
-===== Comments =====+===== Sitemap =====
  
-Adding AJAX code to add comments+By default, you have a sitemap in scj/sitemap.php, but if suddenly for some reason it’s not there, then
  
 +1. Create a sitemap template (starting from update 46 it is included in the default templates) with content like
 <code> <code>
 +<!--default_1-1000-->
 +</code>
  
-<script src='/scj/includes/js/jquery.js' type="text/javascript"></script> ---- don't use this string twice+and subtemplate in accordance with the sitemap format.
  
-<script+2. create a sitemap.php file on the domain root  
-function post_comment() {+<code
 +<?php
  
- $.post( +define('CACHE_TIME', 86400); 
- '/scj/tube/', +$_GET['force_template'] = 'sitemap'; 
- +$_GET['skip_cell_settings'true; // skips cell K calculation - saves a bit of CPU time 
- 'action': 'add_comment', +// $_GET['custom_galleries'] = true// uncomment this line if you need only custom galleries in site map 
- 'content_id': '<!--GALLERY_ID-->', +header('Content-Type: application/xml'); 
- 'captcha': $('#captcha').val(), +include('./scj/tube/index.php'); 
- 'username': $('#username').val(), +</code>
- 'comment': $('#comment').val() +
- }, +
- function(data) { +
- if (data !'OK') { +
- $('#comment_error').text(data)+
- } else { +
-    $('#comment_error').text(' '); +
-        $('#add_comment').html('Thank you ! Your comment will be reviewed by admin.'); +
-         }+
  
- } 
- ); 
-} 
-</script> 
  
-</code>+Please note that if you use descriptions that contain special characters, for example & (ampersand), then you must use CDATA in the template (if you don’t know what this is, it makes sense to open Google).
  
 +__Considering that this point in the docs could have been written quite a long time ago relative to the time you read it, it makes sense to check Google docs again regarding the sitemap rules.__
 +In addition, Google’s rules say that the sitemap size should not be more than a certain amount, so if you have more than 1-2-3k gallery, then in any case you need to divide it into pages by ?page=1 ?page=2, etc. (see [[New Rotation Hints#setting_get_paramaters]]
  
-Add html form+===== How to make RSS =====
  
 +1. Create an rss template (starting from update 47 it is in the default templates) with content like
 <code> <code>
 +<thumb num=1-100> template for rss </thumb>
 +</code>
  
-<div id='comment_error'></div> +and subtemplate in accordance with the rss format.
-<div id='add_comment'> +
-<div class="clear"></div> +
-<h4>Add comment</h4>+
  
-<FORM name="add_comment" method="POST">+2. create a file rss.php on the root of the domain  
 +<code> 
 +<?php
  
-<div class="r_line"> +define('CACHE_TIME', 86400); 
-<label>Name:</label> <input class="s_input" type="text" name='usernameid='usernamevalue="<?=$user['username']?>"> +$_GET['force_template'= 'rss'
-</div> +$_GET['skip_cell_settings'= true; /skips cell K calculation - saves a bit of CPU time 
-<div class="r_line"> +include('./scj/tube/index.php'); 
-<label>Comment:</label> <textarea class="s_text" class="ph2" name='comment' id='comment' rows=5 cols=35 value="Leave Your Comments Here"></textarea> +</code>
-</div>+
  
-<? if ($rot_settings['tube_comment_captcha']) {  ?> 
-<div class="r_line"> 
-<label>Captcha:</label><div class="clear"></div><img src="/scj/tube/captcha.php" id="captcha_img" width="158" height="60" alt="Visual CAPTCHA" /> 
-<input id='captcha' class="s_input" type="text" name='captcha' value="" /> 
-</div> 
-<div class="r_line"> 
-<input type='button' value='Post Comment' onClick='post_comment();'> 
-</div> 
-<? } ?> 
-</div> 
  
-</form> 
  
-</code>+===== Custom title for each template =====
  
 +For example, you include the header template in all templates, so if you want different titles for different pages, you have the following options:
  
-and output existing comments+Option depending on template
  
 <code> <code>
  
-<!--TOTAL_COMMENTS-->+<?php  
 +if ('<!--TEMPLATE_NAME-->' == 'index' { ?>  
 +This is index 
 +<? } elseif ('<!--TEMPLATE_NAME-->' == 'content_list') { ?> 
 +This is category  
 +<? } elseif ('<!--TEMPLATE_NAME-->' == 'content_search') { ?> 
 +this is search 
 +<? } else { ?> 
 +some other page 
 +<? } ?>
  
-<comments num=1-10> 
-<!--DATE--> <!--USERNAME--> : <!--COMMENT--> 
-</comments> 
  
 </code> </code>
  
 +Depending on the variables passed to the URL
  
-That's it. +<code> 
-Note that comment moderation available for paid versions only.+<html> 
 +<?php if ($_GET['gallery_id']) {?> 
 +<title>This is custom gallery , display gallery description here for example <!--DESCRIPTION--></title> 
 +<?php } elseif ($_GET['group_id']) { ?> 
 +<title>This is category page, use here <!--GROUP_NAME--></title> 
 +<?php } else { ?> 
 +<title>This is index, any other desc here</title> 
 +<?php } ?>
  
 +</code>
  
  
  
  
-===== Thumb rolling ===== 
  
-Let's say you have 5 thumbs for each gallery, usually rotation engine tries to find the best one among them, but you can also "roll" those thumbs with mouseover ie thumbs will replace it other while mover cursor is over it. 
  
-How to do it +===== How to separate content by type ===== 
-  * Add some JS some that add rolling for all thumbs with швы starting with 'rot'+  
 +For example, we need to display only movies on some page. To do this, you need to add content_type=movie to the parameters 
 <code> <code>
 +http://domain.com/scj/tube/?group_id=5 - all content from group 5
 +http://domain.com/scj/tube/?group_id=5&content_type=movie - only movies from group 5
  
-<script src='/scj/includes/js/jquery.js'></script>+You can also use image and flash 
 +</code>
  
-<script> +All this also works through the file
-$(document).ready(function() { +
-  +
- $("img[id^=rot]").bind('mouseenter', function() { +
- $(this).attr('rotating', 1); +
- StartSlide($(this).attr('id')); +
- }).mouseleave(function() { +
- $(this).attr('rotating', 0); +
-        if ($(this).attr('original_src')) $(this).attr('src', $(this).attr('original_src')); +
- });+
  
-});+<code> 
 +<?php 
 +$_GET['group_id'] = 5; 
 +$_GET['content_type'] = 'movie'; 
 +include('./scj/tube/index.php'); 
 +</code>
  
  
-function StartSlide(id) { +===== Separate template for a specific category =====
- if (!$('#' + id).attr('rotating') || $('#' + id).attr('rotating'== 0) return false;+
  
-    if (!$('#' + id).attr('original_src')) $('#' + id).attr('original_src'$('#' + id).attr('src'));+Before making a separate templatethink about it: maybe you don’t need a separate template, but just use custom vars for categories and thus solve this issueHowever, if you are sure that you need a completely different page, then you can do it as follows:
  
- var images = $('#' + id).attr('original_src') + ',$('#+ id).attr('rel'); +- Rotation - CMS pages - create a new template for example cat_new.tpl 
-    images images.split(',')+  - in common.php we write the following (after <? ) 
-    var cur = $('#+ id).attr('current_img');+<code> 
 +if ($_GET['group_id'] == '1or $_GET['group_name'] == 'group_name') $_GET['force_template'] = 'cat_new'; 
 +where 1 and group_name are the corresponding ID and name of the category you need 
 +</code>
  
-    cur parseInt(cur); +===== Blog on a subdomain =====
-    cur (!cur || cur == 0) ? 1 : (cur+1);+
  
-    cur = (!images[cur]) ? 0 : cur; +- Create a subdomain, copy common.php, index.php, as well as 2 directories scj/cgi and scj/tube to the root create .htaccess as usual 
-    $('#' id).attr('current_img'cur);+  - In the basic admin panel we create templatesfor example blog_index, blog_content_list, etc. 
 +  - We got 3 komons, so as not to get confused, we’ll do the same in all 3 
 +<code> 
 +After <? add
  
-  var preload new Image();+if ($_SERVER['REQUEST_URI'== '/') { 
 +$_GET['force_template'] = 'blog_index'; 
 +} elseif (isset($_GET['group_id'])) { 
 +$_GET['force_template'] = 'blog_content_list'; 
 +
 +</code>
  
- if (cur == 0) { 
- preload.src = $('#' + id).attr('original_src'); 
- } else { 
- preload.src = images[cur]; 
- } 
  
-    if ($('#' + id).attr('rotating')) setTimeout("ChangeSRC('"+id+"', '"+preload.src+"')", 700); +===== Skimming on custom galleries =====
  
-}+In version 46, a new option has been added - skimming to gallery.
  
-function ChangeSRC(id, src) { +Rotation - CMS - Tube Settings can be set **custom gallery skimming** for example in the form  
- if (!$('#' + id).attr('rotating') || $('#' + id).attr('rotating') == 0) return false; +<code> 
- $('#' + id).attr('src'src); +100%,70%trader.com,70%sponsor,50%sponsor_join,100
-    StartSlide(id); +
-+
-</script>+
  
 +first click on the content (100 and 100% are the same, you can write it as you wish)
 +second: 70% content, rest acc. 30% - /scj/cgi/out.php?member=trader.com,
 +3rd: 70% content 30% sponsor (on the URL that is registered with the sponsor in the site url)
 +4th: 50% content 50% sponsor (URL - join url),
 +5 and onwards - 100% content
 </code> </code>
  
-  * add id='rot..' for all thubms in subtemplate like+Please note that this only works if you link not directly to the content, but through a script, for example 
 <code> <code>
 +<a href='/gallery/<!--SAFE_DESC-->/<!--GALLERY_MD5-->/1.html'><img src='<!--IMG_1_THUMB-->'></a>
 +</code>
  
-<a href="/gallery/<!--SAFE_DESC-->/<!--GALLERY_ID-->/index.html?<!--THUMB_LINK-->" title="<!--ALT-->"> + 
-<img id='rot<!--ID-->' src="<!--THUMB_URL-->" class="t_img" alt="" rel="<!--ALL_THUMBS-->/> +===== Niche traffic selling ===== 
-</a+ 
 +Many people sell traffic on exchanges. When purchasing, the exchange only takes into account the domain and for multi-niche domains the price of traffic is usually lower than for niche ones, however, it is possible to send traffic indicating a niche and in this case the exchange can give a higher bid. 
 + 
 +<code> 
 +For example, usually everyone sells traffic using the link http://brocker.com/in.cgi?your_id  
 +In this case, if you have a multi-niche, your traffic is considered multi-niche traffic. 
 +But the exchange provides the opportunity to send traffic like http://brocker.com/in.cgi?your_id&niche=test, where test is niche. Such traffic is already considered niche and may cost more.
 </code> </code>
  
 +To do this, we add the {GROUP} parameter to the sales URL; the URL looks like http://brocker.com/?id=your_id&niche={GROUP} (for example, for the holder http://www.trafficholder.com/in/in.php?yourid-{GROUP}). However, the question is that the broker does not have a Japanese niche? the closest one is for example tube_asian. To do this, in Rotation - CMS - Tube settings there is a Niche traffic sell field in which we need to enter the correspondence between our niches and the broker’s niches, for example,
  
-That'it.+  tube_asian=Japanese,Asian  
 +   
 +where tube_asian is the broker’niche, and Japanese,Asian are our niches on the site, separated by a comma.
  
  
-Note. there are 2 points you have to understand+ 
 + 
 +===== PHP in navigation ===== 
 + 
 +As you know, you can use PHP in template. And of course, it can be used in navigation to display, for example, some category in a different color, or somehow highlight it, or not display a category, etc.
  
 <code> <code>
-id='rot<!--ID-->'JS tries to roll there thumbs only + 
-rel="<!--ALL_THUMBS-->"here script outputs all available thumbs for this gallery+by default it looks something like this 
 +<navigation> 
 +<a href="/category/<!--CATEGORY_NAME-->/" title="<!--PAGE_NUM-->"><!--PAGE_NUM--></a> 
 +</navigation> 
 + 
 +Let's say we need to highlight the girls category with color 
 + 
 +<navigation> 
 +<? if ('<!--CATEGORY_NAME-->' == 'girls') { ?> 
 +<a href="/category/<!--CATEGORY_NAME-->/" title="<!--PAGE_NUM-->"><font color='pink'><!--PAGE_NUM--></font></a> 
 +<? } else { ?> 
 +<a href="/category/<!--CATEGORY_NAME-->/title="<!--PAGE_NUM-->"><!--PAGE_NUM--></a> 
 +<? } ?> 
 +</navigation> 
 + 
 + 
 +Let's say we need to skip the girls category in this list 
 + 
 +<navigation> 
 +<? if ('<!--CATEGORY_NAME-->' != 'girls') { ?> 
 +<a href="/category/<!--CATEGORY_NAME-->/" title="<!--PAGE_NUM-->"><font color='pink'><!--PAGE_NUM--></font></a> 
 +<? }  ?> 
 +</navigation> 
 </code> </code>
  
 +===== Extra Thumb =====
  
-PS feel free to modify this code+For design, it is sometimes convenient to have 2 sizes of thumb rotation, for example, to show large thumbs on the index, and smaller ones on category pages.
  
 +To make the script create larger images for the index, create a crop profile with larger dimensions in Rotation - Settings - Crop Profile, and specify that profile in the Extra Thumb field during grabbing. In that case the script creates two thumbs: one regular thumb, for example /scj/thumbs/123/456.jpg, and a second one from the same source using the other crop profile, for example /scj/thumbs/123/456.jpg.extra.jpg
  
-===== Hide rotation parameter =====+You can use this in a template like this: usually we display thumb as
  
-A regular link looks like +  <img src='<!--THUMB_URL-->'>  
 + 
 +If you made an extra thumb, then you can display it as follows: 
 + 
 +  <img src='<!--EXTRA_THUMB_URL-->'> 
 + 
 + 
 + 
 + 
 +===== How to make a personal template for a trader in the new rotation ===== 
 +  - Create a template in Rotation - CMS pages, for example trd_tpl 
 +  - Create a file for example trd_tpl.php at the root of the domain with the following content 
 + 
 +<code> 
 +<?php 
 +$_GET['force_template'] = 'trd_tpl'; 
 +include('./scj/tube/index.php'); 
 +</code> 
 + 
 +and write the PATH (!NOT URL!!!) to this file in the trader edit. 
 + 
 +===== How to remove the rotation parameter from links (1x23x456) ===== 
 + 
 +Relevant only for script version 1.x 
 + 
 +In version 2.x there is a magic rotation parameter, when nothing is needed in the links 
 + 
 +Typically links look like this:
  
   /gallery/cool_gallery/index.html?12x34x56   /gallery/cool_gallery/index.html?12x34x56
  
-where  12x34x56 is rotation parameter. It this a way for the script to understand what thumb has been clicked, at what page and so on. You can hide it from surfer, here's how to do it +12x34x56 are rotation parameters, the goal is to get rid of this in the URL so that it looks more aesthetically pleasing. 
 + 
 +You can do it like this:
  
-1. In subtemplate you have something like +1. In the sub, your links look something like this:
  
 <code> <code>
 <a href="/gallery/<!--GALLERY_SLUG-->/index.html?<!--THUMB_LINK-->"> <img ...> </a> <a href="/gallery/<!--GALLERY_SLUG-->/index.html?<!--THUMB_LINK-->"> <img ...> </a>
  
-replace it by +replace with
  
 <a href="/gallery/<!--GALLERY_SLUG-->/index.html" rot_id='<!--THUMB_LINK-->'> <img ...> </a> <a href="/gallery/<!--GALLERY_SLUG-->/index.html" rot_id='<!--THUMB_LINK-->'> <img ...> </a>
Line 554: Line 590:
 </code> </code>
  
-not that <!--THUMB_LINK--> has been moved to rot_id+no matter how difficult it is to notice, we put <!--THUMB_LINK--> in the rot_id parameter
  
  
-2. add some JS code to <head> section of your template+2. add to <head>
  
 <code> <code>
Line 574: Line 610:
  
  
-And that's it. it will add the parameter on click only, so surfer won't see it on 'mouseover'+===== I don't like links like /gallery/cool/index.html?123x45x678 =====
-===== How to change links /gallery/cool/index.html?123x45x678 =====+
  
  
-**For version 1.X only**+There are 2 types of “dislikes” here - the /gallery view itself, etc. - this changes in rewrite.
  
 +2nd option - I don’t like that 123x45x678 is right after the URL, it changes there, etc.
  
-If you'd like to change links like /gallery to let's say /video - edit rewrites and templates.+Here are the options:
  
-if you'like to change rotation parameter (?123x45x678  part) there are some options+1. If you don’t like that the surfer sees it - http://smartcj.com/wiki/doku.php?id=new_rotation_hints#%D0%BA%D0%B0%D0%BA_%D1%83%D0%B1%D1%80%D0%B0%D1%82%D1%8C_%D0%BF%D0%B0%D1%80%D0%B0%D0%BC%D0%B5%D1%82%D1%80_%D1%80%D0%BE%D1%82%D0%B0%D1%86%D0%B8%D0%B8_%D0%B8%D0%B7_%D0%BB%D0%B8%D0%BD%D0%BA%D0%BE%D0%B2_1x23x456
  
 +2. For CE - http://smartcj.com/wiki/doku.php?id=custom_galleries_and_google
  
-1. Если не нравится, что это видит серфер - check 'hide Rotation Params' at this page +3. For CE there is also another option - to make links like
- +
-2. For SEO purposes - http://smartcj.com/wiki/doku.php?id=custom_galleries_and_google +
- +
-3. For google (another option- make likes like +
  
   /gallery/cool/index.html?link=images/123x45x678   /gallery/cool/index.html?link=images/123x45x678
  
-and in Google webmaster's tools (GWT) set &linkk parameter as 'not important'+and in GWT declare that link is an insignificant parameter and Google can ignore it.
  
 +To do this, in .htaccess we replace places like
  
-In this case you should also change .htaccess +out.php?link=images/%{QUERY_STRING} 
- +  on 
-  out.php?link=images/%{QUERY_STRING} +
-  should be replaced by+
   out.php?%{QUERY_STRING}   out.php?%{QUERY_STRING}
-  for all occurrences  +  In the template we change it to 
-   +
-  and template like+
   http://domain/gallery/<!--GALLERY_SLUG-->/index.html?link=images/<!--THUMB_LINK-->   http://domain/gallery/<!--GALLERY_SLUG-->/index.html?link=images/<!--THUMB_LINK-->
  
  
-**Options 2 for rotation parameter** 
  
-if you'd like to have something not '&link='  +**Option 2 of changing the end of links**
  
-in rewrites change+In rewrite we change
  
 <code> <code>
Line 619: Line 648:
 </code> </code>
  
-to +on
  
 <code> <code>
Line 626: Line 655:
 </code> </code>
  
-You can see 'paramhere. So this is a way to use another word instead of 'link'+As you can seeparam has been added here, which can be disabled in GWT
  
-Don't forget about links+Accordingly, links should be made like
  
   href="/gallery/<!--GALLERY_SLUG-->/index.html?param=<!--THUMB_LINK-->   href="/gallery/<!--GALLERY_SLUG-->/index.html?param=<!--THUMB_LINK-->
Line 634: Line 663:
  
  
-**Option 3 if you want completely another style  **  +**Option 3 if you want completely different look**
- +
-Tag <!--THUMB_LINK--> outputs something like '12x34x56', you can change it into something like &a=12&b=34&c=56 or &ppp=12.34.56 and so on, actually any thing.+
  
-Here's an example:+At the moment, the <!--THUMB_LINK--> tag produces conditionally 12x34x56, for example, you want it to be &a=12&b=34&c=56 or for example &ppp=12.34.56, etc., in a word, some other type.
  
 <code> <code>
  
-subtemplate +you do it in saba
  
 $my_var = explode('x', '<!--THUMB_LINK-->'); $my_var = explode('x', '<!--THUMB_LINK-->');
  
-in $my_var  you'll get in array like +you get an array
  
 Array Array
Line 657: Line 684:
 </code> </code>
  
-now you can create 'your style' link +and you can form a link from it as you wish
  
-an example with acb+for example option with a b c
  
 <code> <code>
Line 665: Line 692:
 out.php?url=....&a=<?=$my_var[0]?>&b=<?=$my_var[1]?>&c=<?=$my_var[2]?> out.php?url=....&a=<?=$my_var[0]?>&b=<?=$my_var[1]?>&c=<?=$my_var[2]?>
  
-then in common.php you have to assemble it back into a normal format, so script can understand it.+and in common.php the parameter is added back
  
 if (isset($_GET['a'])) { if (isset($_GET['a'])) {
Line 673: Line 700:
 </code> </code>
  
-This way you can have any links you want.+In this wayyou can make parameters with any names or dots; in a word, your imagination is not limited in any way.
  
  
-===== Quick Pagination =====+===== How to display all pages in navigation ===== 
 + 
 +Typically navigation (aka pagination) looks something like this: 1 2 3 ... 40 41 42. 
 + 
 +If you need to display all 42 without... you need to replace the navigation with something like the following
  
-Basic pagination looks like 
 <code> <code>
 +
 +Was
  
 <navigation> <navigation>
-<li><a href="/category/<!--CATEGORY_ID-->/<!--CATEGORY_NAME-->/<!--SORT_ORDER-->/<!--PAGE_NUM-->/" title="<!--PAGE_NUM-->"><!--PAGE_NUM--></a></li>+<li><a href="/category/<!--CATEGORY_NAME-->/<!--SORT_ORDER-->/<!--PAGE_NUM-->/" title="<!--PAGE_NUM-->"><!--PAGE_NUM--></a></li>
 </navigation> </navigation>
  
 +
 +replace it with
 +
 +<!--
 +commented out the current navigation without removing it from the template altogether
 +<navigation>
 +<li><a href="/category/<!--CATEGORY_NAME-->/<!--SORT_ORDER-->/<!--PAGE_NUM-->/" title="<!--PAGE_NUM-->"><!--PAGE_NUM--></a></li>
 +</navigation>
 +-->
 +
 +<?php
 +$thumbs_per_page = 200;
 +$total_pages = ceil(<!--TOTAL_ITEMS-->/$thumbs_per_page);
 +
 +for ($i = 1; $i <= $total_pages; $i++ ) {
 +?> 
 +<li><a href="/category/<!--CATEGORY_NAME-->/<!--SORT_ORDER-->/<?php echo $i?>/" title="<?php echo $i?>"><?php echo $i?></a></li>
 +<?php }?>
 +
 +
 +
 +where $thumbs_per_page = 200; accordingly, the number of thumbs per page in your template.
 </code> </code>
  
-But if you have a big DB it takes time to calculate how much galleries you actually have in particular category, and at the same time user doesn't care if you have 122123 videos or 123344. You can actually type any numbers in you templates.  
  
-So here's what we can do to save some resources of your server: we don't count total results and output just a link to the next page.+===== Rating =====
  
 +To add a custom gallery rating you need (using the example of content_custom_pic)
 +
 +Add styles to make the stars beautiful
  
 <code> <code>
 +<style>
 +div.rating-cancel,div.star-rating{float:left;width:17px;height:15px;text-indent:-999em;cursor:pointer;display:block;background:transparent;overflow:hidden}
 +div.rating-cancel,div.rating-cancel a{background:url(/scj/tube/delete.gif) no-repeat 0 -16px}
 +div.star-rating,div.star-rating a{background:url(/scj/tube/star.gif) no-repeat 0 0px}
 +div.rating-cancel a,div.star-rating a{display:block;width:16px;height:100%;background-position:0 0px;border:0}
 +div.star-rating-on a{background-position:0 -16px!important}
 +div.star-rating-hover a{background-position:0 -32px}
 +/* Read Only CSS */
 +div.star-rating-readonly a{cursor:default !important}
 +/* Partial Star CSS */
 +div.star-rating{background:transparent!important;overflow:hidden!important}
 +/* END jQuery.Rating Plugin CSS */
 +</style>
 +</code>
  
-So if there's no <navigation> tag - the script doesn't count totals and we can use links like  
  
-<?php if ('<!--PREV_PAGE-->') { ?> +Add JS script that will beautifully do mouseover for stars
-<li><href="/category/<!--CATEGORY_ID-->/<!--CATEGORY_NAME-->/<!--SORT_ORDER-->/<!--PREV_PAGE-->/" title="<!--PREV_PAGE-->"><!--PREV_PAGE--></a></li> +
-<?php } ?>+
  
-<?php if ('<!--NEXT_PAGE-->') { ?+<code
-<li><a href="/category/<!--CATEGORY_ID-->/<!--CATEGORY_NAME-->/<!--SORT_ORDER-->/<!--NEXT_PAGE-->/" title="<!--NEXT_PAGE-->"><!--NEXT_PAGE--></a></li+<script src='/scj/includes/js/jquery.js' type="text/javascript"></script> 
-<?php } ?>+<script src='/scj/includes/js/jquery.rating.pack.js' type="text/javascript" language="javascript"></script> 
 +<script
 +$(function(){ 
 + $('.auto-submit-star').rating({ 
 + callback: function(value, link){ 
 + $('#rating_div').html('Posting...');
  
 + $.get('/scj/tube/index.php',
 + {
 + 'gallery_id': '<!--GALLERY_ID-->',
 + 'action': 'rating',
 + 'rating': value
 + },
 +  function(data) {
 +            $('#rating_div').html('Thank you!');
 +   }
 + );
 + }
 + });
 +});
 +</script>
 </code> </code>
  
  
-Note, that in this case we also don't have TOTAL_ITEMS (actually it will output amount of galleries on the current page)+ 
 +We add the stars themselves 
 + 
 +<code> 
 +<h4>Rate this movie:</h4> <div id='rating_div'>     
 +    <input class="auto-submit-star" type="radio" name="rating" value="1"/ <? if(<!--RATING--> > 0) echo 'checked' ?> > 
 +    <input class="auto-submit-star" type="radio" name="rating" value="2"/ <? if(<!--RATING--> > 1) echo 'checked' ?> > 
 +    <input class="auto-submit-star" type="radio" name="rating" value="3"/ <? if(<!--RATING--> > 2) echo 'checked' ?> > 
 +    <input class="auto-submit-star" type="radio" name="rating" value="4"/ <? if(<!--RATING--> > 3) echo 'checked' ?> > 
 +    <input class="auto-submit-star" type="radio" name="rating" value="5"/ <? if(<!--RATING--> > 4) echo 'checked' ?> > 
 +</div> 
 +</code> 
 + 
 + 
 + 
 +All. 
 + 
 +PS You can display the rating anywhere with the tag <!--RATING--> - this will be a number from which you can get anything. 
 +the simplest example in the sub 
 +<code> 
 +<? if(<!--RATING--> > 0) echo '*' ?>  
 +<? if(<!--RATING--> > 1) echo '*' ?>  
 +<? if(<!--RATING--> > 2) echo '*' ?>  
 +<? if(<!--RATING--> > 3) echo '*' ?>  
 +<? if(<!--RATING--> > 4) echo '*' ?>  
 +</code> 
 + 
 + 
 +===== Rating +1\-1 like\dislike ===== 
 + 
 +And other 2-variant ratings. 
 +The idea is simple: reduce the rating scale to two values, 1 and 2. In practice, 1 means dislike and 2 means like. So an average of 1.5 means a 50/50 split between likes and dislikeswhile 1.75 means 75% like and 25% dislike. 
 + 
 +Technical implementation: 
 + 
 +Add a JS script that will post the voting result 
 +<code> 
 + 
 +<script src='/scj/includes/js/jquery.js' type="text/javascript"></script> THIS IS ONLY NEEDED 1 TIME, IF YOU ALREADY HAVE IT IN THE TEMPLATE THEN YOU DO NOT NEED TO INSERT IT A 2ND TIME 
 + 
 +<script> 
 +function post_rating(value) { 
 + 
 +$.get('/scj/tube/index.php', 
 +
 + 'gallery_id': '<!--GALLERY_ID-->', 
 + 'action': 'rating', 
 + 'rating': value 
 + }, 
 + function(data) { 
 +        $('#rating_div').html('Thank you!'); 
 +
 +); 
 +
 + 
 +</script> 
 +</code> 
 + 
 +Adding voting buttons and rating output 
 + 
 +<code> 
 + 
 +<div id='rating_div'> 
 +current rating = <?=(<!--RATING--> == 0) ? 'not rated' : round( (<!--RATING--> - 1) * 100 ) . '%'?> <br> 
 +rate it:  
 + 
 +<span onclick='post_rating(2)' style="cursor: pointer"> +1 </span> ............................ 
 +<span onclick='post_rating(1)' style="cursor: pointer"> -1 </span> 
 + 
 +</div> 
 + 
 ++1 and -1 are replaced with fingers, checkmarks, etc. 
 + 
 +</code> 
 + 
 + 
 +All. 
 + 
 +===== PHP code in template ===== 
 + 
 +As you probably know, you can use PHP code in templates. Of course, it will not be possible to consider all the nuances of the language in one example, and apparently it is not necessary, but I would like to show a small example. For example, we need to display the desk tag <!--DESCRIPTION--> and we decided to make it all in capital letters, in PHP it’s very simple: 
 + 
 +change <!--DESCRIPTION--> to <?php echo strtoupper('<!--DESCRIPTION-->')?> 
 +   
 +However, there is one important caveat: if the description contains a quote, you will get something like <?php echo strtoupper('masha's super pic')?>, which breaks the string and causes a PHP error. For that reason, 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]] 
 + 
 +<code>     
 +An example with <!--DESCRIPTION--> would look like: 
 + 
 +<?php echo strtoupper('<!--ESCAPED_DESCRIPTION-->')?>  
 + 
 +</code>   
 + 
 + 
 + 
 +===== Comments ===== 
 + 
 +It's just as easy to add comments. 
 + 
 +Add code that will post a comment without reloading the page (AJAX) 
 + 
 +<code> 
 + 
 +<script src='/scj/includes/js/jquery.js' type="text/javascript"></script> ---- this line is not required if jquery is already included somewhere, for example in the rating. 
 + 
 + 
 +<script> 
 +function post_comment() { 
 + 
 + $.post( 
 + '/scj/tube/', 
 +
 + 'action': 'add_comment', 
 + 'gallery_id': '<!--GALLERY_ID-->', 
 + 'captcha': $('#captcha').val(), 
 + 'username': $('#username').val(), 
 + 'comment': $('#comment').val() 
 + }, 
 + function(data) { 
 + if (data != 'OK') { 
 + $('#comment_error').text(data); 
 + } else { 
 +    $('#comment_error').text(' '); 
 +        $('#add_comment').html('Thank you ! Your comment will be reviewed by admin.'); 
 +         } 
 + 
 +
 + ); 
 +
 +</script> 
 + 
 +</code> 
 + 
 + 
 +Adding an HTML comment form 
 + 
 +<code> 
 + 
 +<div id='comment_error'></div> 
 +<div id='add_comment'> 
 +<div class="clear"></div> 
 +<h4>Add comment</h4> 
 + 
 +<FORM name="add_comment" method="POST"> 
 + 
 +<div class="r_line"> 
 +<label>Name:</label> <input class="s_input" type="text" name='username' id='username' value="<?=$user['username']?>"> 
 +</div> 
 +<div class="r_line"> 
 +<label>Comment:</label> <textarea class="s_text" class="ph2" name='comment' id='comment' rows=5 cols=35 value="Leave Your Comments Here"></textarea> 
 +</div> 
 + 
 +<? if ($rot_settings['tube_comment_captcha']) {  ?> 
 +<div class="r_line"> 
 +<label>Captcha:</label><div class="clear"></div><img src="/scj/tube/captcha.php" id="captcha_img" width="158" height="60" alt="Visual CAPTCHA" /> 
 +<input id='captcha' class="s_input" type="text" name='captcha' value="" /> 
 +</div> 
 +<div class="r_line"> 
 +<input type='button' value='Post Comment' onClick='post_comment();'> 
 +</div> 
 +<? } ?> 
 +</div> 
 + 
 +</form> 
 + 
 +</code> 
 + 
 + 
 +and add the output of existing comments 
 + 
 +<code> 
 + 
 +<!--TOTAL_COMMENTS--> 
 + 
 +<comments num=1-10> 
 +<!--DATE--> <!--USERNAME--> : <!--COMMENT--> 
 +</comments> 
 + 
 +</code> 
 + 
 + 
 +All. 
 + 
 + 
 +===== Geo targeting ===== 
 + 
 +In fact, this is an example of PHP code in templates 
 + 
 +<code> 
 +<? 
 +if ($_SERVER['GEOIP_COUNTRY_CODE'] == 'GB') { 
 +?> 
 + 
 +banner code 1 
 + 
 +<? } else { ?> 
 + 
 +banner code 2 
 + 
 +<? } ?> 
 + 
 +</code> 
 + 
 + 
 +===== Two indexes with different content types ===== 
 + 
 +Suppose you need two pages, one for movie content and one for image content. For example: movies.php and images.php 
 + 
 +Option 2 
 + 
 +1. We do everything on one template 
 + 
 +* create 2 files of the form  
 +<code> 
 +<?php 
 +$_GET['content_type'] = 'image'; // for the second file 'movie' 
 +include('./scj/tube/index.php'); 
 +</code> 
 +  * we register any of these pages in CJ Pages - this will be the site index  
 +  * since template is not specified here, index will be used 
 +  * if in your design you somehow work differently with different sizes of movie and picture thumbs, then for processing use code like this  
 +<code> 
 +<?php 
 +if ($_GET['content_type'] == 'image') { 
 +?> 
 +text 1 
 +<? 
 +} else  
 +?> 
 +testct 2 
 +<? 
 +
 + 
 +Please note that this code can be used both in the sub and in the template itself. 
 +Accordingly, links for pagination will be movies.php?page=2, etc. 
 + 
 +</code> 
 + 
 + 
 +Option 2. We make 2 different templates, for example index_movies and index_images with the desired design and navigation, as well as 2 view files 
 + 
 +<code> 
 +<?php 
 +$_GET['content_type'] = 'image'; // for the second file 'movie' 
 +$_GET['force_template'] = 'index_images'; // for the second file 'index_movies' 
 +include('./scj/tube/index.php'); 
 +</code> 
 + 
 + 
 +===== Translation of the site menu (i18) ===== 
 + 
 +It’s quite easy to translate the site menu (those links like Most Popular, Order By date, etc.) into other languages. 
 + 
 +Rotation - CMS Templates - Tpl Custom Var add custom variables, for example most_popular, this variable can be used in templates like <!--CUSTOM_VAR_MOST_POPULAR-->, and you can set a separate translation for each language. 
 + 
 + 
 +===== Another flash player ===== 
 + 
 +By default in the script there is a free player Jwplayer, at the moment it is already a bit old player, but it works :) If you want any other player, then the main thing is that you need to understand that the player and the script are not connected in any way. The script generates an HTML page where it replaces tags and how the page is displayed depends on the browser. How the movie plays depends on the player. 
 + 
 +By default the code is as follows 
 + 
 +<code> 
 +<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="<!--FLV_WIDTH-->" height="<!--FLV_HEIGHT-->"> 
 + <param name="movie" value="/scj/tube/player/player.swf" /> 
 + <param name="allowfullscreen" value="true" /> 
 + <param name="allowscriptaccess" value="always" /> 
 + <param name="flashvars" value="file=<!--FLV_URL-->&image=<!--FLV_THUMB_URL-->" /> 
 + <embed 
 + type="application/x-shockwave-flash" 
 + id="player2" 
 + name="player2" 
 + src="/scj/tube/player/player.swf"  
 + width="<!--FLV_WIDTH-->"  
 + height="<!--FLV_HEIGHT-->" 
 + allowscriptaccess="always"  
 + allowfullscreen="true" 
 + flashvars="file=<!--FLV_URL-->&image=<!--FLV_THUMB_URL-->"  
 + /> 
 + </object> 
 + 
 +</code> 
 + 
 +As you can see, the player /scj/tube/player/player.swf is called and the parameters flashvars="file=<!--FLV_URL-->&image=<!--FLV_THUMB_URL-->" are passed to it.  
 +You can put your player anywhere convenient, any player, change the template so that it loads your player, just check how it needs to pass parameters. For example, Kernel player 
 + 
 +<code> 
 + 
 +<object id="kt_player" name="kt_player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="600" height="400"> 
 +    <param name="allowscriptaccess" value="always"/> 
 +    <param name="allowFullScreen" value="true"/> 
 +    <param name="movie" value="http://%YOUR_DOMAIN_HERE%/player/kt_player.swf"/> 
 +    <param name="flashvars" value="video_url=<!--FLV_URL-->&amp;preview_url=<!--FLV_THUMB_URL-->"/> 
 +    <embed src="http://%YOUR_DOMAIN_HERE%/player/kt_player.swf?video_url=<!--FLV_URL-->&amp;preview_url=<!--FLV_THUMB_URL-->" width="600" height="400" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/> 
 +</object>  
 + 
 +</code> 
 + 
 + 
 +===== How to quickly create a blog using an existing database ===== 
 + 
 +If you filled the database well initially and you have good descriptions and a custom gallery is highly desirable, then you can create a parallel blog for the site in 10 minutes. 
 + 
 +* create a subdomain conditionally blog.yourdomain.com 
 +  * set this to the smartcj subdomain 
 +  * make it slave yourdomain.com 
 +  * download [[http://smartcj.com/wiki/local_upload/SCJ_templates.example.49.sql|blog templates ]] 
 +  * upload this file to Rotation - CMS (at the bottom Upload Templates) 
 + 
 +That's it, the blog is ready :)
  
  
 ===== Suggestions Based on logged searches ===== ===== Suggestions Based on logged searches =====
  
-You can add 'suggested searches' so when user starts to type something in a search field you can show him similar requests. +Auto-suggestions when the user starts to enter a search based on what was previously searched
  
-Addings JS and styles to template 
  
 <code> <code>
  
-<script type="text/javascript" src="/scj/includes/js/jquery.js"></script> Это может быть уже и есть в странице+<script type="text/javascript" src="/scj/includes/js/jquery.js"></script> This may already be on the page
-<script type="text/javascript" src="/scj/includes/js/jquery.autocomplete.min.js"></script>+<script type="text/javascript" src="/scj/includes/js/jquery.autocomplete.min.js"></script> This script does the autocompletion
  
  
Line 725: Line 1119:
  $(document).ready(function(){     $(document).ready(function(){   
         $('#search_field').autocomplete({         $('#search_field').autocomplete({
-         serviceUrl: '/scj/tube/index.php?force_template=search_suggest',+         serviceUrl: '/scj/tube/index.php?force_template=search_suggest&zero_items_to_404=off', /* This template will be below*/
  
             onSelect: function(suggestion, data) {             onSelect: function(suggestion, data) {
Line 736: Line 1130:
 </code> </code>
      
 +
 +some styles for beauty
      
 <code> <code>
Line 747: Line 1143:
  
  
-and a search field+the search field itself
  
 <code> <code>
Line 753: Line 1149:
 </code> </code>
  
-You can notice that script requests template 'search_suggest'. Here it is+The template 'search_suggest' itself
  
 <code> <code>
 <?php <?php
-header('Content-Type: application/xml');+header('Content-Type: application/json');
 ?>{ ?>{
 "query":"<!--ESCAPED_GET_QUERY-->", "query":"<!--ESCAPED_GET_QUERY-->",
Line 770: Line 1166:
 </code> </code>
  
-As you can see it is a regular template with a couple of new things like header -application/xml  +How to check: /scj/tube/index.php?force_template=search_suggest&zero_items_to_404=off&query=... should produce results with those searches that are already in the database
-and a tag prefix <!--ESCAPED_ that has been described here already+
  
  
 ===== Suggestions : Based on regular search ===== ===== Suggestions : Based on regular search =====
  
-You can also suggest results based on existing galleries. Basically it's pretty much the same+The same as above, but it suggests not by the search database, but by the gallery database
  
  
Line 822: Line 1216:
  
  
-Another template, let's call it 'gallery_search_suggest'+template 'gallery_search_suggest'
  
  
Line 833: Line 1227:
 {"value":"","data":""} {"value":"","data":""}
  
-<thumb skip_search_log=true search=GET_QUERY num=1-10>+<thumb skip_search_log=true search=GET_query num=1-10>
 ,{"value":"<!--ALT-->","data":"/gallery/<!--GALLERY_SLUG-->/index.html"} ,{"value":"<!--ALT-->","data":"/gallery/<!--GALLERY_SLUG-->/index.html"}
 </thumb> </thumb>
Line 841: Line 1235:
  
  
 +As you can see, the only difference is that in the template itself, specifically in the <thumb tag
 +
 +===== Site with main niches =====
 +
 +Let's say we want to create a site with 3 main categories (general (id 1), gay (2) and shemale (3)), each of these categories has sub-niches (typically teen, mature, etc.). They should be specifically for subcategories (in editing a category there is a parent category field)
 +
 +/?category_id=1 - will display only what is in category 1 AND(!) subgroups
 +  
 +For example, if he searches by tag and it is necessary from category 1 then
 +
 +  /?tag=...&category_id=1
 +  
 +  
 +
 +**Category thumbs**
 +
 +You can create 3 sets of thumb categories just for this situation
 +
 +Settings - System Thumbs 
 +
 +When displaying thumb categories, we can indicate the set number
 +
 +  <category num=1-10 set_id=2 
 +  
 +Please note that the set can also be passed in a URL
 +
 +  <category num=1-10 set_id=GET_set_id 
 + 
 +
 +
 +===== Custom flv: content separation =====
 +
 +Let's imagine that we have a gallery with 3 flash movies, like this http://babesfarm.com/caprice/movies/kitchen_fuck05/index01.html
 +
 +If you make a custom gallery out of it, but if you do it just like that, you will get a gallery with 3 movies (in the gallery template, the sponsor cleverly made direct links to movies for scripts that do not know how to rob flash content), 3 flash movies and all this will be on one page. And we want each of the movies to open on a separate page, like with pixelated content.
 +
 +**How ​​to do it:**
 +
 +1. Let’s create a new template for the flash gallery, where on the gallery page there will only be a thumb of this gallery (like the pix one), the movies themselves will be played on a separate page (again, like the pix gallery), let’s say it will be called **content_flv_gallery** and its template will be
 +
 +<code>
 +<a href='/scj/tube/?slug=<!--GALLERY_SLUG-->&force_template=content_flv_single_item&item_id=1'><img src='<!--FLASH_1_THUMB-->'></a>
 +<br>
 +<a href='/scj/tube/?slug=<!--GALLERY_SLUG-->&force_template=content_flv_single_item&item_id=2'><img src='<!--FLASH_2_THUMB-->'></a>
 +<br>
 +<a href='/scj/tube/?slug=<!--GALLERY_SLUG-->&force_template=content_flv_single_item&item_id=3'><img src='<!--FLASH_3_THUMB-->'></a>
 +<br>
 +</code>
 +
 +As it’s not difficult to notice, there is no flash player and all thumbs point to /scj/tube/?slug=<!--GALLERY_SLUG-->&force_template=content_flv_single_item&item_id=...
 +
 +where there is another template **content_flv_single_item** where the flash player will be, as well as item_id - where the number of the movie from the gallery is transmitted, which should be played.
 +
 +**Content content_flv_single_item**
 +
 +<code>
 +<? if ($_GET['item_id'] == 1)  { ?> 
 +<div class="flash">
 + <div class="player">
 +
 +<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="<!--FLASH_1_THUMB_X-->" height="<!--FLASH_1_THUMB_Y-->">
 + <param name="movie" value="/scj/tube/player/player.swf" />
 + <param name="allowfullscreen" value="true" />
 + <param name="allowscriptaccess" value="always" />
 + <param name="flashvars" value="file=<!--FLASH_1_IMAGE-->&image=<!--FLASH_1_THUMB-->" />
 + <embed
 + type="application/x-shockwave-flash"
 + id="player2"
 + name="player2"
 + src="/scj/tube/player/player.swf" 
 + width="<!--FLASH_1_THUMB_X-->" 
 + height="<!--FLASH_1_THUMB_Y-->"
 + allowscriptaccess="always" 
 + allowfullscreen="true"
 + flashvars="file=<!--FLASH_1_IMAGE-->&image=<!--FLASH_1_THUMB-->" 
 + />
 + </object>
 +
 +</div>
 +
 +<? } ?>
 +
 +
 +
 +
 +<? if ($_GET['item_id'] == 2)  { ?> 
 +<div class="flash">
 + <div class="player">
 +
 +<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="<!--FLASH_2_THUMB_X-->" height="<!--FLASH_2_THUMB_Y-->">
 + <param name="movie" value="/scj/tube/player/player.swf" />
 + <param name="allowfullscreen" value="true" />
 + <param name="allowscriptaccess" value="always" />
 + <param name="flashvars" value="file=<!--FLASH_2_IMAGE-->&image=<!--FLASH_2_THUMB-->" />
 + <embed
 + type="application/x-shockwave-flash"
 + id="player2"
 + name="player2"
 + src="/scj/tube/player/player.swf" 
 + width="<!--FLASH_2_THUMB_X-->" 
 + height="<!--FLASH_2_THUMB_Y-->"
 + allowscriptaccess="always" 
 + allowfullscreen="true"
 + flashvars="file=<!--FLASH_2_IMAGE-->&image=<!--FLASH_2_THUMB-->" 
 + />
 + </object>
 +
 +</div>
 +
 +<? } ?>
 +
 +
 +
 +<? if ($_GET['item_id'] == 3)  { ?> 
 +<div class="flash">
 + <div class="player">
 +
 +<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="<!--FLASH_3_THUMB_X-->" height="<!--FLASH_3_THUMB_Y-->">
 + <param name="movie" value="/scj/tube/player/player.swf" />
 + <param name="allowfullscreen" value="true" />
 + <param name="allowscriptaccess" value="always" />
 + <param name="flashvars" value="file=<!--FLASH_3_IMAGE-->&image=<!--FLASH_3_THUMB-->" />
 + <embed
 + type="application/x-shockwave-flash"
 + id="player2"
 + name="player2"
 + src="/scj/tube/player/player.swf" 
 + width="<!--FLASH_3_THUMB_X-->" 
 + height="<!--FLASH_3_THUMB_Y-->"
 + allowscriptaccess="always" 
 + allowfullscreen="true"
 + flashvars="file=<!--FLASH_3_IMAGE-->&image=<!--FLASH_3_THUMB-->" 
 + />
 + </object>
 +
 +</div>
 +
 +<? } ?>
 +
 +</code>
 +
 +there are 3 almost identical pieces that differ only <? if ($_GET['item_id'] == 1) { ? and accordingly the number of the substituted tag <!--FLASH_1_THUMB-->
 +
 +
 +
 +
 +**2. Grabbed gallery**
 +
 +When grabbing content or later through editing, you need to set **Embed Template** for this gallery, respectively - content_flv_gallery
 +
 +
 +**3. rewrite** 
 +
 +URLs like /scj/tube/?slug=<!--GALLERY_SLUG-->&force_template=content_flv_single_item&item_id=1 don’t look particularly nice, so you can add rewrite for example
 +
 +<code>
 +RewriteRule ^flash_gallery/([^/]+)/([0-9]{1,2}).html$ /scj/tube/?slug=$1&force_template=content_flv_single_item&item_id=$2&%{QUERY_STRING} [L]
 +</code>
 +
 +and accordingly replace content_flv_gallery in the template
 +
 +<code>
 +links like 
 +<a href='/scj/tube/?slug=<!--GALLERY_SLUG-->&force_template=content_flv_single_item&item_id=1'><img src='<!--FLASH_1_THUMB-->'></a>
 +on 
 +<a href='/flash_gallery/<!--GALLERY_SLUG-->/1.html'><img src='<!--FLASH_1_THUMB-->'></a>
 +</code>
 +
 +
 +**4. Features of this gallery**
 +
 +Her sponsor posted 2 types of links to content: they are flash, others are in the form of links to movie clips for scripts that do not know how to rob flash content. This is correct, but the script will download both options, although we only want to output flash. For us, this is only bad because some of the content that we don’t need will be stored on disk. Accordingly, when adding content, you can set Add only this type of content - flash in the import. This will save some disk space.
 +
 +===== Navigation within one gallery =====
 +
 +For example, we have a custom pix gallery with a certain number of images. Clicking on thumb opens not the picture itself, but a page with this picture plus some additional advertising, etc. You can put links on the same page to the following images of this gallery, for example
 +
 +<code>
 +
 +<? if ($_GET['item_id'] != 1) { ?>
 +<a href='/gallery/<!--GALLERY_SLUG-->/<?=($_GET['item_id']-1)?>.html'> Prev </a>
 +<? } ?>
 +
 +<? if ($_GET['item_id'] < <!--GALLERY_TOTAL_ITEMS--> ) { ?>
 +<a href='/gallery/<!--GALLERY_SLUG-->/<?=($_GET['item_id']+1)?>.html'> Next </a>
 +<? } ?>
 +
 +</code>
 +
 +If you have other rewrites, do not forget to edit the links.
 +
 +
 +===== Friendly tube =====
 +
 +For content sites on the same base (master slave), there is an option to organize a trader among themselves, when the surfer sees the content but on another site in the network.
 +
 +For example, a user clicks on http://domain1.com/gallery/gallery_slug/index.html, but the skim script decides to send him for a trade. In this case, the user does not see the gallery. If we send it to another site in our network, we can show it the gallery, but on a different domain.
 +
 +This has a positive effect on the product of the original site (the person wanted to see the movie - he saw it), and also makes it possible to show other thumbs around the embed itself = the surfer can click on these thumbs on the trader’s site.
 +
 +To do this, on the domain1.com website for the domain2.com trader, specify the site type - Friendly Tube. In this case, if the script decides to send to this trader, then the script will send the slug gallery to the trader. Of course, only if the redirect to the trader occurred when they clicked on the content, and not in the toplist. The script will simply send those to http://domain2.com/ and add http://domain2.com/?try&slug=super_gallery. to the URL
 +
 +On domain2.com, if of course SmartCJ is also installed there, the script sees this slug and does not open the site index, but redirects to the URL Try Param Redirect URL, which looks something like
 +
 +  http://{DOMAIN}/gallery/{GET_slug}/index.html 
 +
 +those redirect to gallery. If you have your own rewrites, then you need to change the URL to match your rewrites.
 +
 +This is of course only relevant when 
 +  - if the trader also has SmartCJ 
 +  - if you use either master-slave (then the IDs are 100% the same) or if the content as a whole overlaps.
 +
 +If there is no gallery with this ID on the trader’s website, it will just be an index
 +
 +
 +
 +===== Custom links =====
 +
 +Links to gallery in the default version /gallery/gallary_slug/index.html in order to change them you need to change rewrite + template so that the URLs for your rewrite are generated.
 +
 +Likewise for categories, tags, etc.
 +
 +The only special case here is category links such as /category/cool/date/1/. The word cool is the category name, but date is already a sort key, and the script must receive a sort value it understands. If you put something like new_galleries_first there, the script will not know how to interpret it.
 +
 +To change to this option you need to:
 +
 +Add to common.php (note: they should all be the same)
 +<code>
 +if (isset($_GET['order']) and $_GET['order'] == 'new_galleries_first') {
 +$_GET['order'] = 'date';
 +} elseif (isset($_GET['order']) and $_GET['order'] == 'long_galleries_first') {
 +$_GET['order'] = 'duration';
 +} else {
 +$_GET['order'] = 'ctr';
 +}
 +</code>
 +
 +Now the /category/cool/new_galleries_first/1/ option will work as expected.
 +
 +However, in the navigation itself there is SORT_ORDER, which is actually equal to $_GET['order'], and we need our option. Therefore, we also add our own variable to common.php
 +
 +<code>
 +if (isset($_GET['order']) and $_GET['order'] == 'new_galleries_first') {
 +$_GET['order'] = 'date';
 +$GLOBALS['original_sort_name'] = 'new_galleries_first';
 +} elseif (isset($_GET['order']) and $_GET['order'] == 'long_galleries_first') {
 +$_GET['order'] = 'duration';
 +$GLOBALS['original_sort_name'] = 'long_galleries_first';
 +} else {
 +$_GET['order'] = 'ctr';
 +$GLOBALS['original_sort_name'] = 'best_galleries_first';
 +}
 +</code>
 +
 +And in the template, instead of SORT_ORDER, we use <?=$GLOBALS['original_sort_name']?>
 +
 +PS In the navigation tag you need to add skip_href_deletion=true so that it does not clean up your PHP code.
 +
 +
 +===== Random keywords for galleries =====
 +
 +If you have a list of keywords that you would like to randomly scatter throughout the gallery (for example, create a custom var and then use it somewhere in the gallery), then you can do it like this:
 +
 +* create a text file with keywords (conditionally keywords.txt)
 +  * PHP script kw.php
 +
 +<code>
 +<?php 
 +$lines = file('/FULL/PATH/TO/keywords.txt');
 +echo $lines[rand(0, count($lines) -1)];
 +</code>
 +
 +* make sure that in the browser http://domain/kw.php displays a random string
 +  * add import replacement of the form
 +
 +<code>
 +If this field = URL
 +Contains this value = http
 +Then Search For = *
 +in This Field = Custom field 1
 +And Replace it With = external:http://domain/kw.php
 +</code>
 +
 +All.
 +
 +The main thing here is external:http://domain/kw.php, those custom var will receive the value that will be given by external:http://domain/kw.php.
  
  
 ===== Site with main niches ===== ===== Site with main niches =====
  
-Let's say we'd like to create a site with 3 main niches and X additional.+Let's say we need to create a website with 3 main niches and X additional ones.
  
-Main niches: general (id 1) , gay (2) and shemale(3) +Main niches: general (id 1), guy (2) and bumblebee (3) 
-and for example 100 niches like 'teen(id 4), amateur (id 5) and so on+and for example 100 niches like teen (id 4), amateur (id 5) and so on
  
-It's pretty obvious that if somebody wants to see 'general' - then he doesn'want to see the rest (niches 2 and 3) so we need kind of a general filter here.+It is logical that if a person wants to see general, but most likely he does not want to see the rest 2 and 3. Those in categories 1, 2 and 3 should have global filtering.
  
-That's why all gallery belong to at least 2 groups(1 2 or 3and (4 or for example). +Thus, all galleries on our site end up in at least 2 categoriesone of 1 2 3 and at least one of the others (in our example, and 5).
  
-When we show content we can limit galleries to a certain range let's say a surfer wants to see teens and general only:+When outputting gallery, we can limit what the surfer wants to see. For examplehe wants to see type (4) and only general (you need to exclude groups 2 and 3) - the link is obtained
  
   /?group_id=4&skip_group_id=2,3   /?group_id=4&skip_group_id=2,3
      
-If he wants to see teen but gay we exclude groups 1 and 3+If you need to see teenbut which is a guy in the group (this means you need to exclude 1 and 3), then the link will be
  
   /?group_id=4&skip_group_id=1,3   /?group_id=4&skip_group_id=1,3
  
-The same works for search by tag+Using the same scheme, you can divide, for example, tags
  
   /?tag=...&skip_group_id=1,3   /?tag=...&skip_group_id=1,3
  
  
-**Category thumbs**+**thumb categories:**
  
-Settings - System Thumbs we can setup category thumbs for each main niches+Settings - System Thumbs you can configure the required number of thumb categories.  
 +In this case, we need 3 sets (sets) of thumb categories - for each of groups 1 2 and 3. 
 +In order to filter thumb categories there is a field Skip group ids, comma separated
  
-In this example we need 3 sets: for each niche and 3. When we select category thumb (ie best thumb for this category) we need to exclude other 2 niches, and here's a field for it  : Skip group idscomma separated +For examplefor category 1, in which we do not want to see the thumb from the categories guy and shemale, we should write 2,3. Set 2 we will have a guy, then we will exclude the groups general (1) and bumblebee (3)we will write 1.3 there.
  
-So let say for niche 1 (general) we don't want to see thumbs from 2 and 3 - so we add 2,3 into that field. +When displaying thumb categories, we can specify which set to display, for example, we will display set 2
- +
-We we output category thumbs we can specify the set we want to show+
  
   <category num=1-10 set_id=2    <category num=1-10 set_id=2 
      
-Note what you can pass set id in URL like /?set_id=2+For convenience, the set number can be taken from the URL /?set_id=2
  
   <category num=1-10 set_id=GET_set_id    <category num=1-10 set_id=GET_set_id 
-  +   
-Note that some category thumb sets might miss galleries for some specific groups so we can add min_gallery_count filter to skip empty groups +Since we don’t want to display the current group itself, the skip_group_id parameter will come in handy (when displaying set 2, we don’t need to display the group guy (2) itself) /?set_id=2&skip_group_id=2
  
-<category num=1-10 set_id=GET_set_id min_gallery_count=1+  <category num=1-10 set_id=GET_set_id skip_group_id=GET_skip_group_id 
 +   
 +As you can see in this example, the category and set IDs match, so the tag can even be made 
 + 
 +  <category num=1-10 set_id=GET_set_id skip_group_id=GET_set_id 
 +   
 +but to avoid confusion in the example of such a replacement, we will not do it. 
 + 
 +In addition, some categories may be specific to a certain niche and therefore there may not be a gallery there, so it makes sense to add min_gallery_count=1 so as not to display empty categories 
 + 
 +<category num=1-10 set_id=GET_set_id skip_group_id=GET_set_id min_gallery_count=1 
 + 
 +   
 +   
 +===== Content protection =====   
 + 
 +By default, the content is in scj/thumbs/galleries/.../1.jpg and conditionally the movie for it is scj/thumbs/galleries/.../1.flv 
 + 
 +On the page we output <img src='/scj/thumbs/galleries/.../1.jpg'>, and in the movie player something like file: /scj/thumbs/galleries/.../1.flv 
 + 
 +And the surfer sees a direct link to /scj/thumbs/galleries/.../1.flv and can download the movie. For example, we decided to make the user’s life a little harder and prevent him from downloading via a direct link. How to do this (assuming we have nginx): 
 + 
 +1. first, in the nginx config, disable downloading files directly 
 + 
 +<code> 
 +location ~* /scj/thumbs/galleries/.*\.(flv)$ { 
 +   deny all; 
 +
 +</code> 
 + 
 +and add a secret location there too 
 + 
 +  location /protected { 
 +            root /var/www; 
 +            internal; 
 +  } 
 + 
 + 
 +2. Let's tweak the template a little. For example now it looks something like this 
 + 
 +  <a href='<!--IMG_1_IMAGE-->'><img src='<!--IMG_1_THUMB-->'></a> 
 + 
 + 
 +which gives us approximately the following result 
 + 
 +  <a href='/scj/thumbs/galleries/482/850/1_201.flv'><img src='/scj/thumbs/galleries/482/850/1_t.jpg'></a> 
 + 
 +we will add /content.php?check=<?=time()?>&url= 
 + 
 +  <a href='/content.php?check=<?=time()?>url=<!--IMG_1_IMAGE-->'><img src='<!--IMG_1_THUMB-->'></a> 
 + 
 +and the result will be 
 + 
 +  <a href='/content.php?check=1511450638&url=/scj/thumbs/galleries/482/850/0_771.flv'><img src='/scj/thumbs/galleries/482/850/0_t.jpg'></a> 
 +   
 + 
 +3. create content.php 
 +   
 +<code> 
 +<?php 
 +if (!$_GET['check'] or $_GET['check'] < time() - 86400) { 
 + die("Error link"); 
 +
 + 
 +header("X-Accel-Redirect: /protected/" . $_GET["url"]);   
 + 
 +</code> 
 + 
 + 
 +In total, if you configured nginx correctly, then when you directly request /scj/thumbs/galleries/482/850/0_771.flv it should display 403. 
 + 
 +The link /content.php?check=1511450638&url=/scj/thumbs/galleries/482/850/0_771.flv should give the file, here 1511450638 is just unix time. It can be replaced with anything. 
 + 
 +===== Content when no content is found =====   
 + 
 +For example, a person was looking for some keyword that you don’t have on your site, and he was given 0 search results. But you would like to show at least something. 
 + 
 +There are 3 options: 
 + 
 + 
 +**First** 
 + 
 +By default, if nothing is found, it shows template content_not_found , but if you display it there 
 + 
 +  <thumb num=1-10 order=easy_random >  
 + 
 +then these will be your random gallery 
 + 
 + 
 +**Option 2** 
 + 
 +if you don’t want to change content_not_found then make a separate random_content template 
 + 
 +<code> 
 +Nothing found , look at those links 
 + 
 +<thumb num=1-10 order=easy_random zero_items_to_404=off> ....  
 + 
 + 
 +</code> 
 + 
 + 
 +and change the search template (content_search) as 
 + 
 +<code> 
 + 
 + 
 +<?if (<!--TOTAL_ITEMS--> == 0) { ?> 
 + 
 +<script> 
 +window.location.replace("https://yourdomain/?force_template=random_content"); (here of course we add which rewrite) 
 +</script> 
 + 
 +<? } else { ?> 
 + 
 +display thumb as usual in search 
 + 
 +<? } ?> 
 + 
 + 
 +</code> 
 + 
 + 
 +Nothing extra is added to this soup. 
 + 
 + 
 +**Option 3** 
 + 
 +Just change content_search like 
 + 
 +<code> 
 + 
 +<?if (<!--TOTAL_ITEMS--> == 0) { ?> 
 + 
 +Nothing found , look at those links 
 + 
 +<thumb num=1-10 order=easy_random search="" zero_items_to_404=off> ....  
 + 
 + 
 +<? } else { ?> 
 + 
 +<thumb num=1-10 zero_items_to_404=off page_main_tag=true>....  
 +display thumb as usual in search 
 + 
 +<? } ?> 
 + 
 +</code> 
 + 
 +This option is simpler, but the downside is that even if something is found, the <thumb num=1-10 order=easy_random> tag will be processed (php is reflected after the script macros) and this means a little more load. 
 + 
 + 
 + 
 +===== Last Visited Galleries =====   
 + 
 +This is an example of using cache in template and macros 
 + 
 +Add the following piece of code to the gallery template (for example content_page) 
 + 
 +<code> 
 +Current gallery id: <!--GALLERY_ID--> <br><br><br> 
 + 
 +<? 
 + if ((int) '<!--GALLERY_ID-->') { 
 + $last_items = Cache::get('last_items'); 
 +  
 + if (!$last_items) $last_items = array(); 
 + 
 + if ($last_items[0] != (int) '<!--GALLERY_ID-->') array_unshift($last_items, (int) '<!--GALLERY_ID-->'); 
 + $last_items = array_slice($last_items, 0, 100, true); 
 + 
 + Cache::set('last_items', $last_items, 3600); 
 +
 + 
 +?> 
 + 
 + 
 +<thumb num=1-10 limit_by_gallery_id=true order=row gallery_id=CACHE_last_items cache_time=10>  
 + Last visited: <!--GALLERY_ID--><br> 
 +</thumb> 
 + 
 +</code> 
 + 
 + 
 +Here you should note for yourself 
 + 
 +- Cache::set('last_items', $last_items - add viewed IDs to cache 
 +  - in the tag we display it, picking it up from cache <thumb num=1-10 limit_by_gallery_id=true **gallery_id=CACHE_last_items** order=row >   
 +  - added to the list of recently viewed only if there is one if ('<!--GALLERY_ID-->') { 
 +  - but the list itself can also be displayed on the index 
 + 
 + 
 +Here you need to understand that 
 + 
 +- if you open a page without cache, then the list of recent ones will not be read (no cache) 
 +  - the cache page along with this list, if you looked at gallery ID 1 2 and 3, then for 3 in the last viewed there will be 1 and 2, but for 2, even if you open it again after 3, only 1 gallery 2 will be cached. 
 + 
 + 
 +There are 2 options here: 
 + 
 +- leave it as it is because for a surfer it’s not so important 
 +  - reduce cache time (cache_time=100) 
 + 
 + 
 +===== Last Visited Galleries by Country =====   
 + 
 +Here we need a slightly deeper understanding of the process. 
 + 
 +You have a website page, so you don’t have to generate it for each surfer - it is generated and stored in cache for some time, so you don’t have to generate a new page for the next visitors. If we want to show as in the example above, but by country, we need to at least remake the page for each country, given that there are 190 countries in the world, which means we will need to generate 190 times more pages (for each country separately) 
 + 
 + 
 +To avoid this, you can go another way 
 + 
 +- for example, on the index we make a code that conditionally requests the last_viewed.php page and displays the content  
 +  - it turns out that the index will be the same for everyone and only last_viewed.php will need to be worked out 190 (according to the number of countries) 
 + 
 + 
 +How to do it step by step 
 + 
 +1. add gallery to the template 
 + 
 +<code> 
 +id: <!--GALLERY_ID--> 
 + 
 + 
 +<? 
 + if ((int) '<!--GALLERY_ID-->') { 
 + 
 +     $cache_id = 'last_items_' . $_SERVER['GEOIP_COUNTRY_CODE']; 
 + 
 + $last_items = Cache::get($cache_id); 
 + 
 + $last_items[(int) '<!--GALLERY_ID-->'] = (int) '<!--GALLERY_ID-->'; 
 + $last_items = array_slice($last_items, 0, 100); 
 +  
 + Cache::set($cache_id, $last_items, 86400); 
 +  
 +
 + 
 + 
 +?> 
 + 
 +</code> 
 + 
 +here in the cache variable 
 + 
 +  $cache_id = 'last_items_' . $_SERVER['GEOIP_COUNTRY_CODE']; 
 + 
 +the gallery list is added (last 100). As you can see, the variable depends on the country. 
 + 
 + 
 + 
 +2. create a new template viewed_in_country 
 + 
 +<code> 
 +<thumb num=1-10 limit_by_gallery_id=true gallery_id=CACHE_GET_last_viewed_cache_id order=row > 
 + <!--GALLERY_ID--> ......<br> 
 +</thumb> 
 + 
 +</code> 
 + 
 +Pay attention to gallery_id=CACHE_GET_last_viewed_cache_id. This means the gallery_id list is taken from CACHE using the GET variable last_viewed_cache_id. 
 + 
 + 
 + 
 +3. where you need to display a gallery list for the current country 
 + 
 +<code> 
 + 
 +<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> 
 + 
 +last viewed in <?=$_SERVER['GEOIP_COUNTRY_CODE']?> 
 + 
 +<script language="JavaScript" type="text/JavaScript"> 
 + 
 +$(document).ready(function(){ 
 + 
 + $.get('./?force_template=viewed_in_country&last_viewed_cache_id=last_items_<?=$_SERVER['GEOIP_COUNTRY_CODE']?>' , {}, 
 +  function(data) { 
 +            $('#last_viewed').html(data); 
 +  } 
 + ); 
 + 
 +}); 
 + 
 +</script> 
 + 
 +<div id='last_viewed'></div> 
 + 
 +</code> 
 + 
 + 
 +the main thing here is that we are requesting a URL 
 + 
 +./?force_template=viewed_in_country&last_viewed_cache_id=last_items_<?=$_SERVER['GEOIP_COUNTRY_CODE']?> 
 + 
 +where in the last_viewed_cache_id variable we pass from which cache id the gallery list should be taken, and this variable will be different for each country. 
 + 
 +the resulting content is inserted into div = last_viewed 
 + 
 +Total needed for the test 
 + 
 +* go to a couple of gallery for step 1 to work 
 +  * open in the browser ./?force_template=viewed_in_country&last_viewed_cache_id=last_items_US , here US is your country code - should display a list of gallery IDs where you were in the previous paragraph 
 + 
 + 
 + 
 +===== Master/Slave First Thumb =====   
 + 
 +The master and slave have the same gallery set since it is one database. This means we can arrange a trade between sites on the same base in such a way that when going to the trader, the first thumb matches the one on which the click was made. This should boost sales. 
 + 
 +How to set it up: a simple version for clarity 
 + 
 +1. on site A, surfer click on gallery 12345, when going to the trader (site B), we need to let site B know which gallery to show first (id 12345).  To do this, the out parameters must contain the ID of the gallery on which the click is made, for example 
 + 
 +<code> 
 +<thumb num=1-10> 
 +    <a href='/scj/cgi/out.php?show_gallery_id=<!--GALLERY_ID-->'>  click  <!--GALLERY_ID--> </a> <br> 
 +</thumb> 
 +</code> 
 + 
 +As you can see here, the show_gallery_id= parameter is passed to out, the URLs will be like out.php?show_gallery_id=12345 
 + 
 +2. On site A, change the URL of the trader (site B) (only those that are on the same database and will support this feature) 
 + 
 +  http://trader/?first_gallery_id={GET_show_gallery_id} 
 + 
 + 
 +Note the {GET_show_gallery_id} placeholder from step 1. When sending traffic to the trader, it is replaced with the value that was passed to out, so the trader receives a URL like http://trader/?first_gallery_id=12345 
 + 
 + 
 +3. add an index to the trader’s template 
 + 
 + 
 +<code> 
 + 
 +<thumb num=1 gallery_id=GET_first_gallery_id limit_by_gallery_id=true> 
 +    first gallery <!--GALLERY_ID--> <!--THUMB_URL--> <br> 
 +</thumb> 
 + 
 +</code> 
 + 
 + 
 +here you should note gallery_id=GET_first_gallery_id which is taken from point 2 
 + 
 + 
 +All. 
 + 
 + 
 + 
 +===== Rotate for Rows =====   
 + 
 +There is a useful rotation option 
 + 
 +  Rotate page for raws 
 +  ie if surfer visits us for a second time - show him second page instead of the first one  
 + 
 + 
 +If a surfer goes to the site’s index, then we can automatically change the &page= parameter, those on the first visit the user actually sees &page=1, on the second (when the user is no longer unique) &page=2 - those if your index displays just thumb 
 + 
 +  <thumb num=1-10> 
 +   
 +then on the first login the user will see thumb 1-10, on the 2nd thumb number 11 - 20. 
 + 
 + 
 +**If you have thumb categories on your index** then the situation is different and there are 2 options 
 + 
 +1. if, for example, you have only 100 categories, and you display 50 on the index 
 + 
 +  <category num=1-50 adjust_num_to_page=true 
 +   
 + 
 +then on the first run there will be categories 1 - 50, and on the second 51 - 100 
 + 
 + 
 + 
 +2. if you have only 100 categories and you display all 100 on the index 
 + 
 +  <category num=1-100 
 + 
 + 
 +in this situation, in order to show other thumbs, you need to create an additional set of thumb categories. To do this, in the settings of the Category thumbs rotation, turn on set 2 (and for example also set 3).  We get 3 sets of thumb categories. 
 + 
 + 
 +add the set number in the template 
 + 
 + 
 +  <category order=clicks num=1-10 set_id=GET_page> 
 +  <!--CATEGORY_NAME--> <!--THUMB_URL--> <br> 
 +  </category> 
 + 
 + 
 +Pay attention to set_id=GET_page. The script will then rotate three different sets of thumb categories. 
 + 
 + 
 +===== Custom Vars for Ads =====   
 + 
 +If the same ad insertion code is used then I often see something like 
 + 
 +1. create an ads template in which 
 + 
 +$ads = '<a href= .. > <img = .. '; 
 + 
 +2. in page templates it is added in different places 
 + 
 +<?=ads?> 
 + 
 + 
 +The problem is 
 + 
 +- the code is not cached and PHP is executed every time (such simple code does not add much load, but still) 
 +  - if you need to change advertising, you need to go to websites and edit the template, which is not very convenient 
 +  - the client can edit to something like $ads = 'Today's Deal!' ';  , get a PHP error due to incorrect quotes 
 + 
 + 
 +If you use Rotation - CMS -TPL Custom var then you can 
 + 
 +- get variables for template in the form of <!--CUSTOM_VAR_MY_VAR1--> tags that are cached 
 +  - There you can edit these custom tags on the entire network at once. Moreover, both all at once and individual tags. 
 +  - no problems with quotes 
 + 
 + 
 + 
 +===== Related From Another Domain  =====   
 + 
 +You can add traffic for your new domains if, for example, you include a link to gallery on your domains with traffic, for example 
 + 
 +* you have a domain And where there is a lot of traffic 
 +  * there is a new domain B  
 +  * on domain B we make a template like 
 + 
 +<code> 
 + 
 +<thumb num=1-5> 
 +    <a href="http://domain_B/<!--GALLERY_SLUG-->/index.html"> <!--THUMB_URL--> </a> 
 +</thumb> 
 + 
 +</code> 
 + 
 + 
 +* and display the template on domain A for example like this 
 + 
 +  <iframe src="http://domain_B/?force_template=test" width="600" height="400"></iframe> 
 +   
 +   
 +Thus, on domain A there will be links directly to gallery from domain B, plus thumb from domain B will begin to receive CTR. 
 + 
 + 
 +===== Sphinx Related Search  =====   
 + 
 +Advanced search with synonyms. For example, a user searches for “car”, but in our database it says “auto”, because the descriptions do not match - they will not be found. Sphinx has synonyms that solve this problem. 
 + 
 +1. collect search phrases and make a list like 
 + 
 +word1 => synonym1 
 +word2 => synonym2 | synonym3 
 + 
 +2. add it to the sphinx 
 + 
 + wordforms = /path/to/your/synonyms.txt 
 + 
 +3. That's it, the sphinx will be able to search taking into account synonyms. 
 + 
 + 
 +===== Related Search Queries =====   
 + 
 +Test version. 
 + 
 +The user searches for “car” on the site, and then searches for “trailer”. Or after “auto”, it searches for “gasoline”.  
 +These are not synonyms, but we understand that these are related searches that may interest the user. 
 + 
 +The next time the user searches for “car”, we will not only show him “car”, but we can display “maybe you also want a trailer and gas”. 
 + 
 +Let's do it basicly using the search_query_limit feature. 
 + 
 +1. In the search template, you need to add a parameter that takes into account whether the user was looking for something before. 
 + 
 +For example, the user came to the page http://domain/?search=auto, in this case, if the user is again looking for something (trailer), then the URL must be formed as http://domain/?search=**trailer**&search_query_limit=**auto**. 
 + 
 +This way you make it clear that “trailer” and “car” are related searches. 
 + 
 + 
 +2. Display related searches (content_search) 
 + 
 +<code> 
 + 
 +<search_log filter=GET_search search_query_field=search_query_limit allow_dupes=true num=1-10> 
 +    <!--SEARCH_QUERY--> <br> 
 +</search_log> 
 + 
 +filter=GET_search - display search queries with the word currently searched for 
 + 
 +search_query_field=search_query_limit - displays “related searches” rather than the search queries themselves 
 + 
 + 
 +</code>
  
new_rotation_hints.1673257582.txt.gz · Last modified: by admin