Table of Contents
New Rotation Templates
Each template consists of 2 parts: template itself and subtemplate (sometime just 'sub' to be short). Template is a regular html page with special tags, so script takes your template, replace tags with actual content (lets say replace <!–DESCRIPTION–> tag with an actual description of a gallery), saves results to cache and shows it to user.
All templates (except header and footer) usually have at least 1 subtemplate. Basically subtemplate is a little template to output each thumb at this page.
<a href="/gallery/<!--GALLERY_SLUG-->/index.html" title="<!--ALT-->"> <img src="<!--THUMB_URL-->" class="t_img" alt="" /></a>
Places to show thumbs:
<thumb template=default num=1></thumb> - output thumb 1 using subtemplate default if you don't mention template - it will use default anyway so <thumb template=default num=1></thumb> = <thumb num=1></thumb>
a range of numbers
<thumb num=1-5></thumb>
outputs first 5 thumbs
You can also add filters inside the tag <thumb
<thumb num=1-10></thumb>
this way you have 10 best thumbs
<thumb sponsor=Myspon num=1-10></thumb> or if you have space in name <thumb sponsor="My spon" num=1-10></thumb> or you can use id <thumb sponsor_id=5 num=1-10></thumb> or a couple of ids <thumb sponsor_id=5,10 num=1-10></thumb>
Outputs first 10 thumbs limited by sponsor. The same works for cateegories
<thumb group=Mygroup num=1-10></thumb> <thumb group_id=5 num=1-10></thumb> or you can exclude groups <thumb skip_group=Mygroup,other_group num=1-10></thumb> or <thumb skip_group_id=1,2,3 num=1-10></thumb>
Sorting
<thumb order=date group=Mygroup num=1-10></thumb>
content limit
<thumb content_type=image num=1-10></thumb> You can also use : flash, movie_only and movie - outputs both flash and movies
You can also mix parameters, for example
<thumb group=Mygroup sponsor=mysponsor num=1-10></thumb>
You can also have a subtemplate right in main template
<thumb group=Mygroup sponsor=mysponsor num=1-10> <a href='/gallery/<!--GALLERY_SLUG-->/index.html'><!--THUMB_URL--> <--- this is a subtemplate </thumb>
Note, that <thumb filters are added to filters we get from url, for example
/category/super_name using mod_rewrite we change it to /?group_name=super_name in template we have <thumb num=1-10></thumb> script will output 10 thumb from the group 'super_name' because we have it in url parameters SO if you use for example <thumb sponsor_id=5 num=1-10></thumb> script will output thumbs using 2 filters: group 'super_name' AND sponsor_id = 5. if you need another group at this page - you can override url parameters in tag like <thumb sponsor_id=5 group=mygroup num=1-10></thumb>
Duration limit
<thumb duration_min=10 duration_max=90 num=1-10> <!--ID--> <!--DURATION--> <br> </thumb> or use can use the same in url domain/scj/tube/?duration_min=10&duration_max=90 and the tag will be just <thumb num=1-10> <!--ID--> <!--DURATION--> <br> </thumb>
Group limit
<thumb group_id=.. or <thumb skip_group_id=..
Sponsor limit
<thumb sponsor_id=123 or sponsor=sponsor_name or <thumb skip_sponsor_id=123 or skip_sponsor=sponsor_name
Date
&date_start=2012-01-01&date_end=2013-01-02
there are some presets
&date_limit=today (yesterday, this_week, this_month)
Template variables
<!--URL--> = <!--GAL_URL--> - gallery URL <!--THUMB_URL--> <!--EXTRA_THUMB_URL--> <!--DESCRIPTION--> <!--DESCRIPTION_40--> description cutted to 40 chars <!--SAFE_DESC--> safe description w\o special chars <!--ALT--> also known as title <!--ALT_30--> - title sutted to 40 chars <!--TAG1--> first tag of gallery's tags <!--TAG2--> <!--SOURCE_URL--> <!--MAIN_GROUP--> <!--MAIN_GROUP_ID--> <!--GALLERY_ID--> <!--GALLERY_SLUG--> <!--SAFE_DESC--> <!--ACTIVATION_DATE--> <!--ACTIVATION_DATETIME--> <!--DURATION--> <!--EMBED_CODE--> <!--CUSTOM_VAR1--> <!--CUSTOM_VAR2--> <!--CUSTOM_VAR3--> for flash galleries (when sponsor gives you url to flv) <!--FLV_WIDTH--> <!--FLV_HEIGHT--> <!--FLV_THUMB_URL--> <!--FLV_URL--> With update 48 models were added <!--MODEL_NAME--> <!--MODEL_SLUG--> <!--MODEL_DESCRIPTION--> <!--MODEL_CUSTOM_VAR1--> <!--MODEL_CUSTOM_VAR2--> <!--MODEL_CUSTOM_VAR3--> if gallery has more then 1 model <!--MODEL_1_NAME--> <!--MODEL_1_SLUG--> <!--MODEL_2_NAME--> <!--MODEL_2_SLUG--> and so on
For categories (groups) pages
<!--CATEGORY_NAME--> = <!--GROUP_NAME--> <!--CATEGORY_ID--> = <!--GROUP_ID--> <!--CATEGORY_DESCRIPTION--> <!--CATEGORY_KEYWORDS--> <!--TOTAL_ITEMS--> <!--CATEGORY_CUSTOM_VAR1--> <!--CATEGORY_CUSTOM_VAR2--> <!--CATEGORY_CUSTOM_VAR3--> For search <!--SEARCH_QUERY--> <!--SEARCH_TYPE-->
For custom galleries
<!--IMG_1_IMAGE--> <!--IMG_1_THUMB--> <!--IMG_1_THUMB_X--> <!--IMG_1_THUMB_Y--> <!--IMG_2_IMAGE--> <!--IMG_2_THUMB--> <!--IMG_2_THUMB_X--> <!--IMG_2_THUMB_Y--> and so on <!--SPONSOR_NAME--> <!--SPONSOR_SITE--> <!--SPONSOR_SITE_URL--> <!--SPONSOR_TRIAL_URL--> <!--SPONSOR_JOIN_URL--> <!--SPONSOR_TITLE--> <!--SPONSOR_DESCRIPTION--> <!--SPONSOR_PAYMENT_OPTIONS--> <!--SPONSOR_SEO_NAME--> <!--SPONSOR_LOGO--> <!--SPONSOR_BANNER1--> <!--SPONSOR_BANNER2--> <!--CUSTOM_VAR1--> <!--CUSTOM_VAR2--> <!--CUSTOM_VAR3--> example of IF statement <!--IF IMG_6--> <a href='<!--IMG_6_IMAGE-->'><img src='<!--IMG_6_THUMB-->'></a> <!--END IF-->
You have to mark places where you want to output thumbs:
<thumb num=1></thumb> or <!--default_1--> - means output first thumb using subtemplate default or <!--default_1-5--> - means output first 5 thumbs using subtemplate default
Navigation (Pagination)
let's say you have 100 thumbs per page and 1 000 thumbs - that's why you need 10 pages , and here's code example
<navigation> <li><a href="/category/<!--CATEGORY_ID-->/<!--CATEGORY_NAME-->/<!--SORT_ORDER-->/<!--PAGE_NUM-->/" title="<!--PAGE_NUM-->"><!--PAGE_NUM--></a></li> </navigation>
Other parameters for pagination
- skip_href_deletion=true - do not delete hraf tag from current page
- active_link_style=act_pg and link_style=not_act_page - adds styles for current\non-current pages
For example you have following code <navigation skip_href_deletion=true active_link_style=act_page link_style=not_act_page> <li><a href="/?page=<!--PAGE_NUM-->" title="<!--PAGE_NUM-->" style='<!--LINK_STYLE-->' ><!--PAGE_NUM--></a></li> </navigation> Let's say we are on the 2nd page of total 3 pages <li><a href="/?page=1" title="1" style='not_act_page' >1</a></li> <li><a href="/?page=2" title="2" style='act_page' >2</a></li> <li><a href="/?page=3" title="3" style='not_act_page' >3</a></li> w\o skip_href_deletion=true it would be like <li><a href="/?page=1" title="1" style='not_act_page' >1</a></li> <li>2</li> <li><a href="/?page=3" title="3" style='not_act_page' >3</a></li> Or Prev \ Next example <?php if ('<!--PREV_PAGE-->') { ?> <li><a href="/category/<!--CATEGORY_ID-->/<!--CATEGORY_NAME-->/<!--SORT_ORDER-->/<!--PREV_PAGE-->/" title="<!--PREV_PAGE-->"><!--PREV_PAGE--></a></li> <?php } ?> <?php if ('<!--NEXT_PAGE-->') { ?> <li><a href="/category/<!--CATEGORY_ID-->/<!--CATEGORY_NAME-->/<!--SORT_ORDER-->/<!--NEXT_PAGE-->/" title="<!--NEXT_PAGE-->"><!--NEXT_PAGE--></a></li> <?php } ?>
List of categories
<category order=alphabet num=1-5> <li><a href="/category/<!--CATEGORY_ID-->/<!--CATEGORY_NAME-->/ctr/1/"><!--CATEGORY_NAME--></a></li> </category>
* num - numbers like 1-5 mean from 1 to 5. * order - can be alphabet and clicks. * min_gallery_count limit by amount of galleries in сategory * set - you can you 2 sets of category thumbs * first_letter=... output categories with names starting with this letter only
Include template
You can include one template into another, for example, good idea to include header and footer in other templates.
<!--INCLUDE_TEMPLATE_header-->
Also with update 48 you can include local and even remote file
<!--INCLUDE_FILE_/path/to/some/file--> <!--INCLUDE_FILE_http://remotehost//file-->
Tag Cloud
<tag_cloud order=alphabet> <a href="/tag/<!--TAG_NAME-->/"><font size='<!--TAG_RANK-->'><!--TAG_NAME--> <!--TAG_HITS--></font></a> </tag_cloud> You can also limit amount of tags displayed <tag_cloud order=alphabet num=1-10> <a href="/tag/<!--TAG_NAME-->/"><font size='<!--TAG_RANK-->'><!--TAG_NAME--> <!--TAG_HITS--></font></a> </tag_cloud> and sort them based on amount if galleries by this tag <tag_cloud order=tag_hits num=1-10> <a href="/tag/<!--TAG_NAME-->/"><font size='<!--TAG_RANK-->'><!--TAG_NAME--> <!--TAG_HITS--></font></a> </tag_cloud>
Tag cloud is created every 30 minutes and stored into the cache. So if you clear up the cache - tag cloud will be unavailable some time.
Starting with update 49 you can create tag cloud with thumbs
<tag_cloud order=tag_hits (or clicks) num=1-10> <a href="/tag/<!--TAG_NAME-->/?<!--THUMB_LINK-->"><!--TAG_NAME--> <!--THUMB_URL--></a> </tag_cloud>
Creating of the best thumb for each tag is off by default because it adds some load, you can turn it on in Rotation - Settings.
Category Thumbs
The script selects the best thumb for each category (Rotation Settings - System Thumbs). You can have 2 sets of sp called category thumbs.
Here's an example how
<category order=alphabet num=1-5> <li><a href="/category/<!--CATEGORY_SLUG-->/ctr/1/"><!--CATEGORY_NAME--></a> (<!--TOTAL_ITEMS-->) (<!--THUMB_URL-->) </li> </category>
Parameters:
- num - limit amount
- min_gallery_count - limit amount of galleries in a category ( for example min_gallery_count=10)
- set - byfault set in 1, but you cat have set=2, for example <category order=alphabet num=1-5 set=2>
- first_letter=… , # - means any number
- custom_name_first_letter = …
- category_custom_var1 category_custom_var2 category_custom_var3 - limit by custom vars
- filter_field= and filter_value - unified filter for example filter_field=custom_name filter_value=GET_somevar where GET_somevar - means &somevar=… in the URL
- sort_field = sort by this field category_name, category_custom_name, category_custom_var1 (2, 3) )
- sort_order - asc, desc
- order - alphabet, clicks (same as ctr), amount of galleries (total_items) , random
- parent_id
- name=“cat1,cat2” limit by category name
- category_id= limit by category id
There are some test vars
- <!–CATEGORY_TOP_THUMBS_LIST–> <!–CATEGORY_TOP_THUMBS_LIST5–> - top 5 category thumbs separated by comma, in case if you want to “roll” thumbs at your page
Tag prefix
You can use PHP code in your templates to play with variables, let's say you want to make the first letter - uppercase
<?php ucfirst('<!--DESCRIPTION-->'); ?>
If a description has a quote you'll get an error, so you have to “escape” quotes
<?php ucfirst('<!--ESCAPED_DESCRIPTION-->'); ?>
Here's another example
Let's say <!--ALT--> becomes <!--ESCAPED_ALT--> and so on
At present moment we have following prefixes
1. Escape
As an example <!--ALT--> becomes <!--ESCAPED_ALT-->
2. HTMLENTITY to replace special html characters like & ⇒ &
'&' (ampersand) becomes '&' '"' (double quote) becomes '"' when ENT_NOQUOTES is not set. ''' (single quote) becomes ''' only when ENT_QUOTES is set. '<' (less than) becomes '<' '>' (greater than) becomes '>' example: <!--ALT--> becomes <!--HTMLENTITY_ALT-->
3. URLENCODE to replace URL variaиду (a space becomes +)
<!--TAG_1--> becomes <!--URLENCODE_TAG_1--> and so on
Basically http://www.php.net/manual/en/function.urlencode.php
4. RAWURLENCODE
<!--TAG_1--> becomes <!--RAWURLENCODE_TAG_1-->
Basically http://www.php.net/manual/en/function.rawurlencode.php
Don't forget you can combine <!–GET.. (variables you get from URL, for example ?search=… is <!–GET_SEARCH–>) and prefixes , for example
<!--ESCAPED_GET_SEARCH--> - you'll get escaped ?search=...
5. STRIP_SPECIAL_CHARS_ to delete special characters like !$@ and so on
Exactly it's : trim(preg_replace('|[\\\,\|\,<\.>\/\?;:\'\“\[\{\]\}\`~@#\$%\^&\*\(\)\-_=\+]*|i', ”“, $var))
Example: <!--STRIP_SPECIAL_CHARS_DESCRIPTION-->
<tag_list and <group_list
Outputs all the data for the current gallery. An example shows it better then a thousand words
<tag_list num=1-3><!--TAG--> </tag_list> and for groups <group_list num=1-3><!--GROUP_NAME--> </group_list> and models <model_list num=1-3><!--MODEL_NAME--> </model_list>
Note that if you have something like this
<group_list ><!--GROUP_NAME--> </group_list>
you'll get a result like this “group1,group2,group3,” with 1 obsolete comma at the end
That;'s why we have one more tag
<group_list separator=”,“ ><!–GROUP_NAME–> </group_list>
which gives you better result like this “group1,group2,group3”
Search log
if you have a search form like (domain/?search=…) - those search requests are being logged. You can output a list of these requests later http://domain/scj/tube/?search_log=all and template 'search_log' is used.
Default rewrite - http://domain/search_log/1/ (you can change it)
You can also output that list at any page
<search_log=all num=1-10> <!--SEARCH_QUERY--> </search_log>
<search_log num=1-10 > ........ </search_log> order=hits - also can be : alphabet, date date_limit=today - yesterday, this_week, this_month date_start= date_end= min_results= with at least X results min_hits= surfers looked up this term at least X times search= filter results by this keyword
so called “syntax sugar”
search= CURRENT_CATEGORY_NAME or CURRENT_TAG_NAME
basicaly the same as search=GET_category_name and search=GET_tag_name (ie take the keyword from URL (GET parameters)
exclude_search_query= exclude from search results
most likely it's gonna be exclude_search_query=GET_search - ie exclude current search keyword
We log every search request with the best gallery ID found, for example, a surfer looks for 'car' so we log 'car - gallery id 12345' , later you can list search queries along with the best gallery for each , for example
<search_log num=1-10> <!--SEARCH_QUERY--> Best gallery: <!--THUMB_URL--> <!--GALLERY_ID--> </search_log>
If you don't want to log search request at some pages you can do
separator
<search_log num=1-10 separator=", "> <!--SEARCH_QUERY--> </search_log>
Rows and Cols
There are settings for rows ans cols, it doesnt affect template, it's for Cell Stats
Custom Templates
You can have as many custom template as you want. For example, default template for custom image galleries - content_custom_pic, but you can create for example my_sponsor1_pic and set it as a template for selected galleries (in Import or later Massedit).
But you can do more. Basic template of index page - index (yeap, it's easy :) ) But if you want separate template for trader trd.com you can create template index_trd (any name actually) and after that you have 3 options to use it.
- ask trader to send traffic to http://your_domain.com/?force_template=index_trd
- create rewrite for link1
- create file trd.php and set it as personal page for this trader
content of trd.php
<?php $_GET['force_template'] = 'index_trd'; include('./scj/tube/index.php');
Developer Mode
Sometimes it's easier to edit template on FTP, not in admin. If you set Developer Mode ON - script will search in scj/tube/default_templates for file with names *.tpl and replace existing templates in DB with content of those files. For example, content_list.tpl - for template content_list, and so on. Make sure you turn OFF this option on high traffic.
Cache
Actually cache options are located under Rotation -Settings menu, but I think it worth mention here. When script processes template and replaces tags with actual data - it saves result into cache so next time, when another surfer loads the same page, script doesnt have to process it again. You can see Cache time in Rotation - Settings. It's in seconds, 900 by default. It means that if surfer visits your index page at 10:00, this pages will be saved in cache till 10:15. This saves server resources so set cache time based on server resources.
Version 1.X Notes
- For version 1.X you have to add some special tags 1), while for version 2.X you don't have to add any special tags.
- Links should be like <a href=”/gallery/<!–GALLERY_SLUG–>/index.html?<!–THUMB_LINK–>“ title=”<!–ALT–>“> … ie You can have as many templates as you want, but 99% of site uses 1 per page. Note, script uses parameter <!–THUMB_LINK–> to count clicks, so you must have it too.
- You can use old style formatting
format: <!--subtemplatename_thumbnum--> for example <!--default_1-->
<!--default_1-5--> is the same as <thumb num=1-5></thumb>