This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
new_rotation_hints [2017/06/12 12:51] admin [Suggestions : Based on regular search] |
new_rotation_hints [2023/01/25 16:05] (current) admin |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== New Rotation Hints ====== | ||
+ | |||
+ | |||
+ | ===== Setting GET parameters | ||
+ | |||
+ | This is one the most important things to understand. As mentioned in [[New Rotation Templates# | ||
+ | |||
+ | In this example / | ||
+ | |||
+ | What you are supposed to understand after reading this information is how to pass parameters to / | ||
+ | |||
+ | **Option 1** | ||
+ | |||
+ | Direct url to / | ||
+ | |||
+ | **2 - rewrites** | ||
+ | |||
+ | Lets say we want to output group ' | ||
+ | |||
+ | Rewrite | ||
+ | |||
+ | RewriteRule ^super_phones\.html$ / | ||
+ | |||
+ | and you get an URL like this - http:// | ||
+ | |||
+ | **3 - file ** | ||
+ | |||
+ | The same task for / | ||
+ | Create file super_phone.php | ||
+ | |||
+ | < | ||
+ | <?php | ||
+ | $_GET[' | ||
+ | $_GET[' | ||
+ | include(' | ||
+ | </ | ||
+ | |||
+ | and you get URL like http:// | ||
+ | |||
+ | ===== Different titles ===== | ||
+ | |||
+ | There are some tricks to get different titles for pages generated using the same template. | ||
+ | |||
+ | For example | ||
+ | |||
+ | < | ||
+ | <?php if ($_GET[' | ||
+ | |||
+ | < | ||
+ | |||
+ | <?php } elseif ($_GET[' | ||
+ | |||
+ | < | ||
+ | |||
+ | <?php } else { ?> | ||
+ | |||
+ | < | ||
+ | |||
+ | <?php } ?> | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Rating ===== | ||
+ | |||
+ | Add styles | ||
+ | |||
+ | < | ||
+ | < | ||
+ | div.rating-cancel, | ||
+ | div.rating-cancel, | ||
+ | div.star-rating, | ||
+ | div.rating-cancel a, | ||
+ | div.star-rating-on a{background-position: | ||
+ | div.star-rating-hover a{background-position: | ||
+ | /* Read Only CSS */ | ||
+ | div.star-rating-readonly a{cursor: | ||
+ | /* Partial Star CSS */ | ||
+ | div.star-rating{background: | ||
+ | /* END jQuery.Rating Plugin CSS */ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | Add JS script to make stars selectable | ||
+ | |||
+ | < | ||
+ | <script src='/ | ||
+ | <script src='/ | ||
+ | < | ||
+ | $(function(){ | ||
+ | $(' | ||
+ | callback: function(value, | ||
+ | $('# | ||
+ | |||
+ | $.get('/ | ||
+ | { | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | }, | ||
+ | function(data) { | ||
+ | $('# | ||
+ | } | ||
+ | ); | ||
+ | } | ||
+ | }); | ||
+ | }); | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | adding stars .. | ||
+ | |||
+ | < | ||
+ | < | ||
+ | <input class=" | ||
+ | <input class=" | ||
+ | <input class=" | ||
+ | <input class=" | ||
+ | <input class=" | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | That's it. | ||
+ | |||
+ | |||
+ | PS To output rating use < | ||
+ | |||
+ | for example | ||
+ | |||
+ | < | ||
+ | <? if(< | ||
+ | <? if(< | ||
+ | <? if(< | ||
+ | <? if(< | ||
+ | <? if(< | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== Rating +1\-1 like\dislike ===== | ||
+ | |||
+ | and other 2-options rating systems | ||
+ | |||
+ | Actually the trick is simple: we leave only 2 options to choose. It's gonna be 1 and 2. Lets say 1 means " | ||
+ | |||
+ | What to do: | ||
+ | |||
+ | Add JS script | ||
+ | < | ||
+ | |||
+ | <script src='/ | ||
+ | |||
+ | < | ||
+ | function post_rating(value) { | ||
+ | |||
+ | $.get('/ | ||
+ | { | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | }, | ||
+ | function(data) { | ||
+ | | ||
+ | } | ||
+ | ); | ||
+ | |||
+ | } | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | Adding vote buttons | ||
+ | |||
+ | < | ||
+ | |||
+ | <div id=' | ||
+ | current rating = <? | ||
+ | rate it: | ||
+ | |||
+ | <span onclick=' | ||
+ | <span onclick=' | ||
+ | |||
+ | </ | ||
+ | |||
+ | +1 and -1 can be replaced with whatever you want. | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | That's it ) | ||
+ | |||
+ | |||
+ | ===== 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 thumbs. Take a look at demo here [[http:// | ||
+ | |||
+ | How to do it | ||
+ | * add JS code into your template , it rotates thumbs with id starting with ' | ||
+ | < | ||
+ | |||
+ | <script src='/ | ||
+ | |||
+ | < | ||
+ | $(document).ready(function() { | ||
+ | |||
+ | $(" | ||
+ | $(this).attr(' | ||
+ | StartSlide($(this).attr(' | ||
+ | }).mouseleave(function() { | ||
+ | $(this).attr(' | ||
+ | if ($(this).attr(' | ||
+ | }); | ||
+ | |||
+ | }); | ||
+ | |||
+ | |||
+ | function StartSlide(id) { | ||
+ | if (!$('#' | ||
+ | |||
+ | if (!$('#' | ||
+ | |||
+ | var images = $('#' | ||
+ | images = images.split(',' | ||
+ | var cur = $('#' | ||
+ | |||
+ | cur = parseInt(cur); | ||
+ | cur = (!cur || cur == 0) ? 1 : (cur+1); | ||
+ | |||
+ | cur = (!images[cur]) ? 0 : cur; | ||
+ | $('#' | ||
+ | |||
+ | var preload = new Image(); | ||
+ | |||
+ | if (cur == 0) { | ||
+ | preload.src = $('#' | ||
+ | } else { | ||
+ | preload.src = images[cur]; | ||
+ | } | ||
+ | |||
+ | if ($('#' | ||
+ | |||
+ | } | ||
+ | |||
+ | function ChangeSRC(id, | ||
+ | if (!$('#' | ||
+ | $('#' | ||
+ | StartSlide(id); | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | * adding rot_ id to thumbs (changing subtemplate) | ||
+ | < | ||
+ | |||
+ | <a href="/ | ||
+ | <img id=' | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | notice 2 points here | ||
+ | < | ||
+ | id=' | ||
+ | rel="< | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Internationalization ( i18 ) ===== | ||
+ | |||
+ | it's pretty easy to translate site's menu (links like Most popular, Longest Videos and so on) into different languages. | ||
+ | |||
+ | 1. Create custom template ' | ||
+ | |||
+ | < | ||
+ | <? | ||
+ | $my_keywords[' | ||
+ | ' | ||
+ | ' | ||
+ | and so on | ||
+ | ); | ||
+ | |||
+ | $my_keywords[' | ||
+ | ' | ||
+ | ' | ||
+ | and so on | ||
+ | ); | ||
+ | |||
+ | |||
+ | $my_keywords[' | ||
+ | ' | ||
+ | ' | ||
+ | and so on | ||
+ | ); | ||
+ | |||
+ | and so on as many languages as you want. | ||
+ | |||
+ | Now you have 2 options to setup language for each user | ||
+ | |||
+ | using browser language | ||
+ | |||
+ | if (strstr($_SERVER[' | ||
+ | $lang = $my_keywords[' | ||
+ | } elseif (strstr($_SERVER[' | ||
+ | $lang = $my_keywords[' | ||
+ | } else $lang = $my_keywords[' | ||
+ | |||
+ | or geo_ip | ||
+ | |||
+ | if ($_SERVER[' | ||
+ | $lang = $my_keywords[' | ||
+ | } elseif ($_SERVER[' | ||
+ | $lang = $my_keywords[' | ||
+ | } else $lang = $my_keywords[' | ||
+ | |||
+ | |||
+ | Hopefully those examples are pretty self explaining | ||
+ | |||
+ | at the ens of template you can add a cookie | ||
+ | |||
+ | if ($_GET[' | ||
+ | setcookie(' | ||
+ | $lang = $my_keywords[' | ||
+ | } elseif ($_COOKIE[' | ||
+ | $lang = $my_keywords[$_COOKIE[' | ||
+ | } | ||
+ | |||
+ | That's it for this template | ||
+ | </ | ||
+ | |||
+ | 2. Now you have to include this template into each template where you are going to use those words | ||
+ | |||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | |||
+ | 3. and replace words in templates with variables | ||
+ | < | ||
+ | Most popular -> <? | ||
+ | Order By Date -> <? | ||
+ | and so on | ||
+ | </ | ||
+ | |||
+ | From this point it should work as it supposed to. | ||
+ | |||
+ | 4. Now we want to add an ability for user to force switch to a selected language | ||
+ | |||
+ | < | ||
+ | add a link like | ||
+ | |||
+ | http:// | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | That's it. | ||
+ | |||
+ | |||
+ | ===== Comments ===== | ||
+ | |||
+ | Adding AJAX code to add comments | ||
+ | |||
+ | < | ||
+ | |||
+ | <script src='/ | ||
+ | |||
+ | < | ||
+ | function post_comment() { | ||
+ | |||
+ | $.post( | ||
+ | '/ | ||
+ | { | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | }, | ||
+ | function(data) { | ||
+ | if (data != ' | ||
+ | $('# | ||
+ | } else { | ||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
+ | } | ||
+ | ); | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | Add html form | ||
+ | |||
+ | < | ||
+ | |||
+ | <div id=' | ||
+ | <div id=' | ||
+ | <div class=" | ||
+ | < | ||
+ | |||
+ | <FORM name=" | ||
+ | |||
+ | <div class=" | ||
+ | < | ||
+ | </ | ||
+ | <div class=" | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | <? if ($rot_settings[' | ||
+ | <div class=" | ||
+ | < | ||
+ | <input id=' | ||
+ | </ | ||
+ | <div class=" | ||
+ | <input type=' | ||
+ | </ | ||
+ | <? } ?> | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | and output existing comments | ||
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | That's it. | ||
+ | Note that comment moderation available for paid versions only. | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== 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 " | ||
+ | |||
+ | How to do it | ||
+ | * Add some JS some that add rolling for all thumbs with швы starting with ' | ||
+ | < | ||
+ | |||
+ | <script src='/ | ||
+ | |||
+ | < | ||
+ | $(document).ready(function() { | ||
+ | |||
+ | $(" | ||
+ | $(this).attr(' | ||
+ | StartSlide($(this).attr(' | ||
+ | }).mouseleave(function() { | ||
+ | $(this).attr(' | ||
+ | if ($(this).attr(' | ||
+ | }); | ||
+ | |||
+ | }); | ||
+ | |||
+ | |||
+ | function StartSlide(id) { | ||
+ | if (!$('#' | ||
+ | |||
+ | if (!$('#' | ||
+ | |||
+ | var images = $('#' | ||
+ | images = images.split(',' | ||
+ | var cur = $('#' | ||
+ | |||
+ | cur = parseInt(cur); | ||
+ | cur = (!cur || cur == 0) ? 1 : (cur+1); | ||
+ | |||
+ | cur = (!images[cur]) ? 0 : cur; | ||
+ | $('#' | ||
+ | |||
+ | var preload = new Image(); | ||
+ | |||
+ | if (cur == 0) { | ||
+ | preload.src = $('#' | ||
+ | } else { | ||
+ | preload.src = images[cur]; | ||
+ | } | ||
+ | |||
+ | if ($('#' | ||
+ | |||
+ | } | ||
+ | |||
+ | function ChangeSRC(id, | ||
+ | if (!$('#' | ||
+ | $('#' | ||
+ | StartSlide(id); | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | * add id=' | ||
+ | < | ||
+ | |||
+ | <a href="/ | ||
+ | <img id=' | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | That's it. | ||
+ | |||
+ | |||
+ | Note. there are 2 points you have to understand | ||
+ | |||
+ | < | ||
+ | id=' | ||
+ | rel="< | ||
+ | </ | ||
+ | |||
+ | |||
+ | PS feel free to modify this code | ||
+ | |||
+ | |||
+ | ===== Hide rotation parameter ===== | ||
+ | |||
+ | A regular link looks like | ||
+ | |||
+ | / | ||
+ | |||
+ | 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 | ||
+ | |||
+ | 1. In subtemplate you have something like | ||
+ | |||
+ | < | ||
+ | <a href="/ | ||
+ | |||
+ | replace it by | ||
+ | |||
+ | <a href="/ | ||
+ | |||
+ | </ | ||
+ | |||
+ | not that < | ||
+ | |||
+ | |||
+ | 2. add some JS code to < | ||
+ | |||
+ | < | ||
+ | <script type=" | ||
+ | <script type=" | ||
+ | $(document).ready(function(){ | ||
+ | $(' | ||
+ | $(this).bind(' | ||
+ | if ($(this).attr(' | ||
+ | }); | ||
+ | }); | ||
+ | }); | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | And that's it. it will add the parameter on click only, so surfer won't see it on ' | ||
+ | ===== How to change links / | ||
+ | |||
+ | |||
+ | **For version 1.X only** | ||
+ | |||
+ | |||
+ | If you'd like to change links like /gallery to let's say /video - edit rewrites and templates. | ||
+ | |||
+ | if you'd like to change rotation parameter (? | ||
+ | |||
+ | |||
+ | 1. Если не нравится, | ||
+ | |||
+ | 2. For SEO purposes - http:// | ||
+ | |||
+ | 3. For google (another option) - make likes like | ||
+ | |||
+ | / | ||
+ | |||
+ | and in Google webmaster' | ||
+ | |||
+ | |||
+ | In this case you should also change .htaccess | ||
+ | |||
+ | out.php? | ||
+ | should be replaced by | ||
+ | out.php? | ||
+ | for all occurrences | ||
+ | | ||
+ | and template like | ||
+ | http:// | ||
+ | |||
+ | |||
+ | **Options 2 for rotation parameter** | ||
+ | |||
+ | if you'd like to have something not '& | ||
+ | |||
+ | in rewrites change | ||
+ | |||
+ | < | ||
+ | RewriteCond %{QUERY_STRING} ^(.+)$ | ||
+ | RewriteRule ^gallery/ | ||
+ | </ | ||
+ | |||
+ | to | ||
+ | |||
+ | < | ||
+ | RewriteCond %{QUERY_STRING} ^param=(.+)$ | ||
+ | RewriteRule ^gallery/ | ||
+ | </ | ||
+ | |||
+ | You can see ' | ||
+ | |||
+ | Don't forget about links | ||
+ | |||
+ | href="/ | ||
+ | |||
+ | |||
+ | |||
+ | **Option 3 if you want completely another style ** | ||
+ | |||
+ | Tag < | ||
+ | |||
+ | Here's an example: | ||
+ | |||
+ | < | ||
+ | |||
+ | subtemplate | ||
+ | |||
+ | $my_var = explode(' | ||
+ | |||
+ | in $my_var | ||
+ | |||
+ | Array | ||
+ | ( | ||
+ | [0] => 12 | ||
+ | [1] => 34 | ||
+ | [2] => 56 | ||
+ | ) | ||
+ | |||
+ | </ | ||
+ | |||
+ | now you can create 'your style' link | ||
+ | |||
+ | an example with acb | ||
+ | |||
+ | < | ||
+ | |||
+ | out.php? | ||
+ | |||
+ | then in common.php you have to assemble it back into a normal format, so script can understand it. | ||
+ | |||
+ | if (isset($_GET[' | ||
+ | $_GET[' | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | This way you can have any links you want. | ||
+ | |||
+ | |||
+ | ===== Quick Pagination ===== | ||
+ | |||
+ | Basic pagination looks like | ||
+ | < | ||
+ | |||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | 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' | ||
+ | |||
+ | 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. | ||
+ | |||
+ | |||
+ | < | ||
+ | |||
+ | So if there' | ||
+ | |||
+ | <?php if ('< | ||
+ | < | ||
+ | <?php } ?> | ||
+ | |||
+ | <?php if ('< | ||
+ | < | ||
+ | <?php } ?> | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | Note, that in this case we also don't have TOTAL_ITEMS (actually it will output amount of galleries on the current page) | ||
+ | |||
+ | |||
+ | ===== Suggestions Based on logged searches ===== | ||
+ | |||
+ | You can add ' | ||
+ | |||
+ | Addings JS and styles to template | ||
+ | |||
+ | < | ||
+ | |||
+ | <script type=" | ||
+ | <script type=" | ||
+ | |||
+ | |||
+ | < | ||
+ | $(document).ready(function(){ | ||
+ | $('# | ||
+ | serviceUrl: '/ | ||
+ | |||
+ | onSelect: function(suggestion, | ||
+ | | ||
+ | } | ||
+ | }); | ||
+ | }); | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | | ||
+ | | ||
+ | < | ||
+ | < | ||
+ | .autocomplete-suggestions { border: 1px solid #999; background: #FFF; cursor: default; overflow: auto; } | ||
+ | .autocomplete-suggestion { padding: 2px 5px; white-space: | ||
+ | .autocomplete-selected { background: #F0F0F0; } | ||
+ | .autocomplete-suggestions strong { font-weight: | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | and a search field | ||
+ | |||
+ | < | ||
+ | <input class=inputbox value='' | ||
+ | </ | ||
+ | |||
+ | You can notice that script requests template ' | ||
+ | |||
+ | < | ||
+ | <?php | ||
+ | header(' | ||
+ | ?>{ | ||
+ | " | ||
+ | " | ||
+ | {" | ||
+ | |||
+ | < | ||
+ | , | ||
+ | </ | ||
+ | |||
+ | ]} | ||
+ | </ | ||
+ | |||
+ | As you can see it is a regular template with a couple of new things like header -application/ | ||
+ | and a tag prefix < | ||
+ | |||
+ | |||
+ | |||
+ | ===== Suggestions : Based on regular search ===== | ||
+ | |||
+ | You can also suggest results based on existing galleries. Basically it's pretty much the same | ||
+ | |||
+ | |||
+ | styles | ||
+ | |||
+ | < | ||
+ | < | ||
+ | .autocomplete-suggestions { border: 1px solid #999; background: #FFF; cursor: default; overflow: auto; } | ||
+ | .autocomplete-suggestion { padding: 2px 5px; white-space: | ||
+ | .autocomplete-selected { background: #F0F0F0; } | ||
+ | .autocomplete-suggestions strong { font-weight: | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | a field | ||
+ | |||
+ | < | ||
+ | <input class=inputbox value='' | ||
+ | </ | ||
+ | |||
+ | |||
+ | JS code | ||
+ | |||
+ | < | ||
+ | <script type=" | ||
+ | <script type=" | ||
+ | < | ||
+ | $(document).ready(function(){ | ||
+ | |||
+ | $('# | ||
+ | serviceUrl: '/ | ||
+ | |||
+ | onSelect: function(suggestion, | ||
+ | location.href = suggestion.data; | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | |||
+ | }); | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | Another template, let's call it ' | ||
+ | |||
+ | |||
+ | < | ||
+ | <?php | ||
+ | header(' | ||
+ | ?>{ | ||
+ | " | ||
+ | " | ||
+ | {" | ||
+ | |||
+ | <thumb skip_search_log=true search=GET_QUERY num=1-10> | ||
+ | , | ||
+ | </ | ||
+ | |||
+ | ]} | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Site with main niches ===== | ||
+ | |||
+ | Let's say we'd like to create a site with 3 main niches and X additional. | ||
+ | |||
+ | Main niches: general (id 1) , gay (2) and shemale(3) | ||
+ | and for example 100 niches like ' | ||
+ | |||
+ | It's pretty obvious that if somebody wants to see ' | ||
+ | |||
+ | That's why all gallery belong to at least 2 groups: (1 2 or 3) and (4 or 5 for example). | ||
+ | |||
+ | When we show content we can limit galleries to a certain range , let's say a surfer wants to see teens and general only: | ||
+ | |||
+ | /? | ||
+ | | ||
+ | If he wants to see teen but gay we exclude groups 1 and 3 | ||
+ | |||
+ | /? | ||
+ | |||
+ | The same works for search by tag | ||
+ | |||
+ | /? | ||
+ | |||
+ | |||
+ | **Category thumbs** | ||
+ | |||
+ | Settings - System Thumbs we can setup category thumbs for each main niches | ||
+ | |||
+ | In this example we need 3 sets: for each niche 1 2 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 ids, comma separated | ||
+ | |||
+ | 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. | ||
+ | |||
+ | We we output category thumbs we can specify the set we want to show | ||
+ | |||
+ | < | ||
+ | | ||
+ | Note what you can pass set id in URL like /?set_id=2 | ||
+ | |||
+ | < | ||
+ | |||
+ | 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 | ||
+ | |||
+ | < | ||