====== New Rotation Hints ====== ===== 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 template. For example /scj/tube/index.php?group_name=phones outputs all images from 'phones' group, 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 In this example /scj/tube/index.php?group_name=phones - group_name=phones is a GET parameter. 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. **Option 1** Direct url to /scj/tube/index.php?group_name=phones . **2 - 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 Rewrite 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. **3 - file ** The same task for /scj/tube/index.php?group_name=phones&force_template=super_template. Create file super_phone.php and you get URL like http://yourdomain/super_phones.php ===== Different titles ===== 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/ Site order by CTR Site order by date Default order (default = by ctr ) ===== Rating ===== Add styles Add JS script to make stars selectable adding stars ..

Rate this movie:

> 0) echo 'checked' ?> > > 1) echo 'checked' ?> > > 2) echo 'checked' ?> > > 3) echo 'checked' ?> > > 4) echo 'checked' ?> >
That's it. PS To output rating use - it's a number so you can show in any way you want it. for example > 0) echo '*' ?> > 1) echo '*' ?> > 2) echo '*' ?> > 3) echo '*' ?> > 4) echo '*' ?> ===== 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 "dislike", and 2 - "like". So if average is 1.5 that means 50% of visitors like it. 1.75 - means 75% like, 25 dislike. It should be clear. What to do: Add JS script Adding vote buttons
current rating = == 0) ? 'not rated' : round( ( - 1) * 100 ) . '%'?>
rate it: +1 ............................ -1
+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://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]]. How to do it * add JS code into your template , it rotates thumbs with id starting with 'rot_' * adding rot_ id to thumbs (changing subtemplate) notice 2 points here id='rot' - script rotates only those thumbs that has id starting with 'rot' rel="" - here script enumerates all available thumbs for this gallery ===== 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 'languages' with set of words like 'Most popular', 'order_by_date' => 'Order By Date', and so on ); $my_keywords['es'] = array( 'most_popular' => 'Lo más leído', 'order_by_date' => 'Ordenar por Fecha', and so on ); $my_keywords['de'] = array( 'most_popular' => 'Populärste', 'order_by_date' => 'Sortiert nach Datum', 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['HTTP_ACCEPT_LANGUAGE'], 'es')) { $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') { $lang = $my_keywords['es']; } elseif ($_SERVER['GEOIP_COUNTRY_CODE'] =='DE') { $lang = $my_keywords['de']; } else $lang = $my_keywords['en']; Hopefully those examples are pretty self explaining at the ens of template you can add a cookie if ($_GET['set_lng'] and isset($my_keywords[$_GET['set_lng']])) { setcookie('force_lng', $_GET['set_lng'], time() + 86400); $lang = $my_keywords['en']; } elseif ($_COOKIE['force_lng'] and isset($my_keywords[$_COOKIE['force_lng']])){ $lang = $my_keywords[$_COOKIE['force_lng']]; } 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://domain/?force_lng=de (and so on any language based on your language array $my_keywords['de']) That's it.