User Tools

Site Tools


Translations of this page:

Sidebar

Documentation index

en:new_rotation_templates

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 actual description of a gallery), saves results to cache and shows it ro user.

Each template MUST have hidden image rot_in and include <!–SCJ_INCLUDE–>, if you dont have it - script will not count thumb shows

<img src="/scj/cgi/rot_in.php?crc=<!--PAGE_CRC-->" border=0 width=0 height=0 style="position: absolute; top: -100; left: -100">
<!--SCJ_INCLUDE-->

All templates (except header and footer) should 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?<!--THUMB_LINK-->" title="<!--ALT-->">
<img src="<!--THUMB_URL-->" class="t_img" alt="" /></a> 

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.

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>

There's a sort form if you want

  format: <!--subtemplatename_thumbnum-->
  for example 
  <!--default_1--> 

a range of numbers

<thumb num=1-5></thumb>
аналогично
<!--default_1-5--> 

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> 

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-->
  <!--THUMB_LINK--> - important parameter for click counting 
  <!--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--> 
  <!--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

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 href 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.

<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”

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.

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.

en/new_rotation_templates.txt · Last modified: 2016/05/31 07:57 by admin