new_rotation_templates
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| new_rotation_templates [2024/01/31 09:45] – [Search log] admin | new_rotation_templates [2026/04/20 13:54] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== New Rotation Templates ====== | ====== New Rotation Templates ====== | ||
| - | Each template | + | The template is standard HTML with special tags indicating where and how to display thumbs. Templates are stored in the database, the results are cached for the time specified by you in the settings, either in the template |
| + | Template editing includes cols & rows fields. These fields do not affect rotation itself; they are only used to make cell statistics easier to review in [[Cell Stats]]. | ||
| - | 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="/ | + | The name of the template has nothing to do with what tags can be used there, for example, the category is displayed by default using the content_list template, but you can add & |
| - | <img src="< | + | |
| - | Places to show thumbs: | + | All templates must have at least one subtemplate. A subtemplate defines how each thumb is displayed. For example: |
| < | < | ||
| - | | + | <a |
| - | | + | href="/gallery/< |
| - | <thumb template=default num=1></thumb> = <thumb num=1></thumb> | + | ?<!--THUMB_LINK-->" |
| + | | ||
| + | > | ||
| + | <img | ||
| + | src="<!--THUMB_URL-->" | ||
| + | class=" | ||
| + | alt="" | ||
| + | /> | ||
| + | </ | ||
| + | </code> | ||
| + | There can be any number of subtemplates. Note that: | ||
| + | |||
| + | 1. Physically, the path / | ||
| + | |||
| + | 2. In this example, the script counts clicks using the < | ||
| + | |||
| + | Places to output thumbs in the template are specified as follows. | ||
| + | For example, | ||
| + | |||
| + | < | ||
| + | <thumb template=default num=1></ | ||
| + | - display thumb number 1 here | ||
| + | using the default subtemplate | ||
| + | |||
| + | if you do not specify a subtemplate, | ||
| + | the default subtemplate will be used | ||
| + | |||
| + | <thumb template=default num=1></ | ||
| + | equals | ||
| + | <thumb num=1></ | ||
| </ | </ | ||
| - | a range of numbers | + | You can specify numeric ranges, for example |
| - | | + | < |
| + | <thumb num=1-5></ | ||
| + | </code> | ||
| - | outputs | + | This will display the first 5 thumbs. |
| - | You can also add filters | + | You can also specify |
| - | | + | < |
| + | <thumb num=1-10></ | ||
| + | </ | ||
| + | |||
| + | then you will get the first 10 thumbs by CTR from all categories. | ||
| + | |||
| + | To filter by sponsor: | ||
| + | |||
| + | < | ||
| + | <thumb sponsor=Myspon num=1-10></ | ||
| + | <thumb sponsor=" | ||
| + | <thumb sponsor_id=5 num=1-10></ | ||
| + | <thumb sponsor_id=5, | ||
| + | </ | ||
| + | |||
| + | If the sponsor name contains spaces, use quotes. You can also filter by one ID or by several IDs. | ||
| + | |||
| + | This will display the first 10 thumbs for the selected sponsor. In the same way, you can specify a group (category): | ||
| + | |||
| + | < | ||
| + | <thumb category=Mycategory num=1-10></ | ||
| + | <thumb category_id=5 num=1-10></ | ||
| + | <thumb skip_category=Mycat, | ||
| + | </ | ||
| + | |||
| + | You can filter by category name, by category ID, or exclude categories with skip_category. | ||
| + | |||
| + | Sorting: | ||
| + | |||
| + | < | ||
| + | <thumb order=date category=Mycategory num=1-10></ | ||
| + | </ | ||
| + | |||
| + | And content type limitation: | ||
| + | |||
| + | < | ||
| + | <thumb content_type=image num=1-10></ | ||
| + | </ | ||
| + | |||
| + | This will display only items with the image content type | ||
| + | (it can also be movie, which outputs both movies and flash; | ||
| + | flash, which outputs flash only; | ||
| + | movie_only, which outputs movies only). | ||
| + | |||
| + | And of course they can be combined, for example | ||
| + | |||
| + | < | ||
| + | <thumb category=Mycategory sponsor=mysponsor num=1-10></ | ||
| + | </ | ||
| + | |||
| + | Please note that the subtemplate can be specified directly in the main template, which is often very convenient, for example | ||
| + | |||
| + | < | ||
| + | <thumb category=Mycategory sponsor=mysponsor num=1-10> | ||
| + | <a href='/ | ||
| + | < | ||
| + | </a> <--- this is the subtemplate | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | One important detail about these tag filters is that they are applied in addition to any filters already present in the request. For example, the category page / | ||
| + | |||
| + | By default, the template contains only | ||
| + | |||
| + | < | ||
| + | <thumb num=1-10></ | ||
| + | </ | ||
| + | |||
| + | Since the request already contains the category_name filter, thumbs from the super_name group will still be displayed even though the <thumb tag itself does not specify a category filter. | ||
| + | |||
| + | So if you write in the template | ||
| + | |||
| + | < | ||
| + | <thumb sponsor_id=5 num=1-10></ | ||
| + | </ | ||
| + | |||
| + | this tag will apply two filters at once: thumbs from the super_name group that also belong to sponsor ID 5. | ||
| + | |||
| + | If you need to override the group that came from the URL, then you must specify the group explicitly in the tag: | ||
| + | |||
| + | < | ||
| + | <thumb sponsor_id=5 category=mycategory num=1-10></ | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | **Subtemplates** | ||
| + | As a quick reminder: | ||
| + | |||
| + | < | ||
| + | <thumb sponsor_id=5 num=1-10></ | ||
| + | </ | ||
| + | |||
| + | will display thumbs using the default subtemplate, | ||
| + | |||
| + | < | ||
| + | <thumb sponsor_id=5 num=1-10 template=my_tpl></ | ||
| + | </ | ||
| + | |||
| + | or by entering the subtemplate directly in the tag: | ||
| + | |||
| + | < | ||
| + | <thumb sponsor_id=5 num=1-10> | ||
| + | <a href=...> | ||
| + | img src=< | ||
| + | </ | ||
| + | </ | ||
| + | </code> | ||
| | | ||
| - | this way you have 10 best thumbs | + | If there is no default subtemplate and no subtemplate is specified anywhere, which subtemplate should be used to display thumbs? |
| + | |||
| + | |||
| + | **Duration limitation** | ||
| + | |||
| + | < | ||
| + | <thumb duration_min=10 duration_max=90 num=1-10> | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | This is equivalent to having the following in the template | ||
| + | |||
| + | < | ||
| + | <thumb num=1-10> | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | with the URL domain/ | ||
| + | |||
| + | |||
| + | Parameters can be passed in any supported | ||
| + | http:// | ||
| + | |||
| + | |||
| + | **Limitation by group ID** | ||
| + | |||
| + | The skip_category_id parameter can be passed either in the URL or in the <thumb ...> tag. It simply excludes thumbs from the specified groups. | ||
| + | |||
| + | |||
| + | **Limitation by sponsor** | ||
| + | |||
| + | < | ||
| + | <thumb sponsor_id=5 num=1-10> | ||
| + | <thumb sponsor=" | ||
| + | <thumb sponsor_slug=" | ||
| + | </ | ||
| + | |||
| + | |||
| + | Include all sites for one sponsor. Sponsors have two fields, Sponsor name and Sponsor Site, so one sponsor can have several sites. In Rotation - Sponsor they are combined in the menu. You can display all sites for one sponsor like this: | ||
| + | |||
| + | < | ||
| + | <thumb sponsor_name=" | ||
| + | </ | ||
| + | |||
| + | |||
| + | Exclude sponsors | ||
| + | |||
| + | < | ||
| + | <thumb skip_sponsor_id=5 num=1-10> | ||
| + | <thumb skip_sponsor=" | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | **Date restriction** | ||
| + | |||
| + | < | ||
| + | & | ||
| + | </ | ||
| + | |||
| + | This will exclude thumbs from the specified time period. You can use one start date and one end date. | ||
| + | |||
| + | There are also several presets: | ||
| + | < | ||
| + | & | ||
| + | - which will automatically substitute | ||
| + | the required dates | ||
| + | </ | ||
| + | |||
| + | ** | ||
| + | And by the duration of the movie (in seconds)** | ||
| + | |||
| + | < | ||
| + | & | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | **General tags for templates** | ||
| + | |||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | |||
| + | **Repeatability gallery - allow_dupes** | ||
| + | |||
| + | If you conditionally | ||
| + | <thumb num=1-10></ | ||
| + | |||
| + | and you will enter somewhere in the template <thumb num=1-5></ | ||
| + | |||
| + | However, if the tags are different, for example the following tag | ||
| + | |||
| + | <thumb num=1-10 order=date></ | ||
| + | <thumb num=1-10 sponsor_id=5></ | ||
| + | |||
| + | etc., then when selecting for this tag, the gallery that was found in the first tag will be excluded. | ||
| + | |||
| + | This behavior can be avoided by adding <thumb allow_dupes=true num=1-10></ | ||
| + | |||
| + | **Num modifiers** | ||
| + | |||
| + | Usually the number is set in the <thumb num=1-10 tag, but in certain situations you can add parameters that will automatically change the numbers. | ||
| + | |||
| + | |||
| + | **num_range_shift** - for example <thumb num=1-10 num_range_shift=1-5 will display a set of 1-10, 11-20, etc., increasing num by 1-5 times. This will give variety to a similar tag. | ||
| + | |||
| + | |||
| + | |||
| + | **zero_items_return_404** | ||
| + | |||
| + | There is a setting called “URLs with 0 result | ||
| + | |||
| + | <thumb num=1-10 zero_items_return_404=off ... | ||
| + | |||
| + | |||
| + | **skip_test_thumbs** | ||
| + | |||
| + | It happens that for some reason there is no need to display test thumbs in a block, for example, you are instructed to display test thumbs in places 10-15, but you just want to display 15 thumbs by CTR without test ones | ||
| + | |||
| + | <thumb skip_test_thumbs=true num=1-15 | ||
| + | |||
| + | ===== Inline thumbs ===== | ||
| + | |||
| + | Useful tag for native advertising. | ||
| + | |||
| + | For example, we have a standard tag | ||
| + | |||
| + | < | ||
| + | <thumb num=1-100> | ||
| + | </ | ||
| + | |||
| + | and we want to mix in as an advertising sponsor. Normally it would look like | ||
| + | |||
| + | < | ||
| + | <thumb num=1-50> | ||
| + | |||
| + | <a href=' | ||
| + | |||
| + | <thumb num=51-100> | ||
| + | </ | ||
| + | |||
| + | we need to manually indicate where exactly the gap is in the real thumb and the link to the sponsor. | ||
| + | |||
| + | |||
| + | in the new tag it is much more convenient to do this | ||
| + | |||
| + | 1. create a subtemplate for example sponsor_thumbs | ||
| + | |||
| + | < | ||
| + | <a href=' | ||
| + | </ | ||
| + | |||
| + | 2. write in the page as | ||
| + | |||
| + | < | ||
| + | <thumb num=1-100 **inline_thumbs=5 inline_thumbs_subtemplate=sponsor_thumbs**> | ||
| + | <a href='/ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | then, out of those 100 thumbs, some random positions will display not <a href='/ | ||
| + | |||
| + | |||
| + | Please note that you can specify several subs, for example inline_thumbs_subtemplate=subtemplate1, | ||
| + | |||
| + | |||
| + | |||
| + | **Inline** also works for modelsb sponsor, search_log | ||
| + | |||
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Thumb status ===== | ||
| + | |||
| + | By default, the script displays only active galleries, but in some cases you may also want to display inactive ones. To do that, use the gallery_status=inactive parameter in the <thumb macro. | ||
| + | |||
| + | |||
| + | ===== Thumb sort ===== | ||
| + | |||
| + | By default, thumbs are sorted by CTR. But you can sort in a different order: | ||
| + | |||
| + | < | ||
| + | date | ||
| + | date_asc | ||
| + | duration | ||
| + | rating | ||
| + | total_shows | ||
| + | gallery_id | ||
| + | no_order (what the database will output is what it outputs, actually by ID) | ||
| + | random , note that random is slow on large databases | ||
| + | easy_random - pseudo random, it is recommended to use this option on large | ||
| + | databases | ||
| + | comments_count - by number of comments (slow on large databases) | ||
| + | </ | ||
| + | |||
| + | As noted above, the parameters from the URL go into the tag, unless otherwise specified. | ||
| + | |||
| + | The & | ||
| + | |||
| + | You can also sort by custom var gallery for example | ||
| - | < | + | <thumb num=1-10 |
| - | or if you have space in name | + | |
| - | <thumb sponsor="My spon" num=1-10></ | + | |
| - | | + | |
| - | <thumb sponsor_id=5 num=1-10></ | + | |
| - | or a couple of ids | + | |
| - | <thumb sponsor_id=5, | + | |
| | | ||
| - | Outputs first 10 thumbs limited | + | but here we must remember that by default there is no index on these fields, and sorting on large databases by these fields can be slow. If you understand what you are doing, it makes sense to add an index to this field. |
| - | | + | |
| - | <thumb group_id=5 num=1-10></ | + | You can also set a gap for custom fields by adding the words from & to , for example |
| + | |||
| + | | ||
| | | ||
| - | or you can exclude groups | ||
| - | <thumb skip_group=Mygroup, | ||
| - | or | ||
| - | <thumb skip_group_id=1, | ||
| | | ||
| + | Here you will need to pay attention that mysql can sort numbers and letters in different ways and different options have their own nuances. Therefore, if the selection does not work as expected, post on the forum with details of what types of data are filtered/ | ||
| - | Sorting | + | ===== fixed_num ===== |
| - | | + | As stated above, thumb is output per page, those <thumb num=1-10 |
| - | content limit | + | If you need to display the same set of thumbs on all pages, for example in a header with the top 5 category thumbs, then you can fix num |
| - | < | + | <thumb num=1-10 |
| - | You can also use : flash, movie_only and movie - outputs both flash and movies | + | |
| + | and on all pages it will display exactly 1-10 | ||
| + | ===== Unset parameter ===== | ||
| + | |||
| + | Inheritance works in parameters: this means that the parameters from the URL are added to the parameters from the tag, so for example in your template | ||
| + | |||
| + | <thumb num=1-10 | ||
| | | ||
| - | You can also mix parameters, for example | + | but on the category page it displays 10 thumbs from the category, in fact it turns out to be a tag |
| - | | + | <thumb num=1-10 |
| | | ||
| - | You can also have a subtemplate right in main template | + | and for example on the model page the same tag displays the thumb of the model, so it turns out |
| - | | + | <thumb num=1-10 |
| - | Note, that < | + | This is convenient, but sometimes you need to display, for example, random thumbs on a category page. If done simply |
| + | |||
| + | |||
| + | <thumb num=1-10 order=easy_random | ||
| + | |||
| + | |||
| + | then as described above it will work out | ||
| + | |||
| + | <thumb num=1-10 order=easy_random category_id=... | ||
| + | |||
| + | therefore, it is for this tag that you need to remove the category parameter and it will look like | ||
| + | |||
| + | | ||
| + | |||
| + | However, we removed the category_id parameter, which would have been included in the tag from the URL. | ||
| + | |||
| + | Another example: you have a search page, tag | ||
| + | |||
| + | <thumb num=1-10 | ||
| + | which in fact | ||
| + | |||
| + | <thumb num=1-10 search=... (from URL) | ||
| + | |||
| + | to display 10 random ones on this page you need to do | ||
| + | |||
| + | <thumb num=1-10 search="" | ||
| + | |||
| + | |||
| + | ===== GET parameters ===== | ||
| + | |||
| + | Sometimes in the tag itself you need to set a parameter depending on the page. Typically, variables from the URL are used for this, which are properly called GET variables. For example, we want to display models | ||
| + | |||
| + | <models first_letter=a | ||
| + | |||
| + | will display fixed models for the letter A. but creating a template for each letter is inconvenient, | ||
| + | |||
| + | <models first_letter=GET_someletter | ||
| + | |||
| + | what does it mean to take the first letter | ||
| + | |||
| + | /? | ||
| + | |||
| + | |||
| + | **For tags** there is one small detail. Normally a tag is passed in the URL as & | ||
| + | |||
| + | Sometimes it is necessary to make a clarification for the search, when a tag must be present or, on the contrary, must be absent, for example, car, but even if there were no tag blue - & | ||
| + | |||
| + | Similarly, if on the contrary, the tag must be present, in this case there must be a + (plus) before the tag. Here you need to pay attention that according to the URL standard, plus is a reserved character that replaces a space, so plus you need to make the url encoded, namely %2B those URLs will be & | ||
| + | |||
| + | |||
| + | |||
| + | ===== gallery_id example ===== | ||
| + | |||
| + | For example, you need to display the thumb of a certain gallery in the first line of the page (for example, with this thumb you are sending from another site) | ||
| + | |||
| + | It turns out, for example, the test template | ||
| < | < | ||
| - | /category/ | + | <thumb num=1-10 gallery_id=GET_gal_id> |
| + | < | ||
| + | </thumb> | ||
| - | in template we have | + | <thumb num=1-5> |
| + | < | ||
| + | </ | ||
| + | </ | ||
| - | <thumb num=1-10></ | ||
| - | script will output 10 thumb from the group ' | + | gallery_id=GET_gal_id here we take the gallery ID from the gal_id parameter from the URL, so if you open the page as domain/? |
| - | SO if you use for example | ||
| - | <thumb sponsor_id=5 num=1-10></ | + | ===== Cache parameter ===== |
| - | script | + | By default, we cache the site page for the time specified in the settings (Cache time, seconds) by default 600, this means that the page will be generated 1 time and then will be shown in this form for 600 seconds, even if the data changes, this allows you to relieve the server and not generate the page for each visit. |
| - | if you need another group at this page - you can override url parameters | + | Next, you can adjust the cache for each page: in page editing there is also a field Cache time, seconds, this parameter is more important than the general one. |
| - | < | + | But you can regulate even deeper - in a tag, for example |
| + | |||
| + | But there is another deeper parameter - count_total_cache_time | ||
| + | |||
| + | The idea is simple: when we calculate thumb output for category A, we need two values - the first N thumbs to display and, if pagination is enabled, the total number of matching thumbs after applying category, sponsor, disabled-group, | ||
| + | |||
| + | But there is a moment where correct counting is more important than saving - for example, for the favorites template: here it would be necessary to immediately show the current number after adding new videos. | ||
| + | |||
| + | To do this we can do < | ||
| + | |||
| + | And this request will be cached for 1 second, which is enough to keep the information always up to date. | ||
| + | |||
| + | ===== Custom cache ===== | ||
| + | |||
| + | Note - this is only for those who understand PHP. | ||
| + | |||
| + | Maybe the situation is that you are performing some actions in PHP in the template and these actions are heavy on the processor. In this case you can cache your results using a cache script, for example: | ||
| + | |||
| + | <code> | ||
| + | if (false === ( | ||
| + | $cache_result = Cache:: | ||
| + | )) { | ||
| + | $cache_result = 'some of your calculations, | ||
| + | |||
| + | Cache:: | ||
| + | |||
| + | } | ||
| + | |||
| + | display $cache_result | ||
| + | (it’s definitely there: | ||
| + | either from cache, | ||
| + | or calculated if there was no cache) | ||
| </ | </ | ||
| + | ===== Page main tag ===== | ||
| + | Problem: we have some kind of page with 2 tags: | ||
| - | **Duration limit** | + | <thumb category=A num=1-10 |
| + | and | ||
| + | <thumb category=B num=1-10 | ||
| + | |||
| + | A problem appears with pagination because it is not clear which tag should be used to calculate the total number of pages. To solve this, the page_main_tag parameter was added. For example, <thumb category=B num=1-10 page_main_tag=true> | ||
| + | |||
| + | The second problem is show 404 when 0 items. | ||
| + | |||
| + | < | ||
| + | and | ||
| + | <thumb category=B num=1-10 | ||
| + | |||
| + | |||
| + | In this case, search_log is empty, the tag returns 0 galleries, and the script assumes it should show a 404 page. But if the main content of the page is actually produced by < | ||
| + | |||
| + | |||
| + | < | ||
| + | and | ||
| + | <thumb category=B num=1-10 page_main_tag=true | ||
| + | |||
| + | ===== do_not_count_shows ===== | ||
| + | |||
| + | If for some reason you don’t need to count impressions for some thumbs on the page, then just add the do_not_count_shows parameter to the tag | ||
| + | |||
| + | <thumb do_not_count_shows=true | ||
| + | |||
| + | Please note that thumb showing is counted 1 time. For example, on the page | ||
| + | |||
| + | <meta ... <thumb num=1-10> | ||
| + | |||
| + | and later on the page again | ||
| + | <thumb num=1-10>< | ||
| + | |||
| + | despite the fact that it is displayed 2 times, only 1 impression will be counted. | ||
| + | |||
| + | |||
| + | This also works for system thumbs, for example category thumbs. It is useful when you only display a list of categories without outputting a thumb itself, and therefore do not want to add +1 impression to the category thumb. | ||
| < | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| - | <thumb duration_min=10 duration_max=90 num=1-10> | ||
| - | or use can use the same in url | ||
| - | domain/ | + | ===== Mobile Templates ===== |
| - | and the tag will be just | + | If you want a separate design for mobile devices, then any template can be duplicated by a template with the same name, but with **mobile_ at the beginning**, |
| - | <thumb num=1-10> | + | For example, we have index, mobile_index and content_custom_pic (mobile_content_custom_pic was not created). |
| + | The mobile surfer came to the index - the mobile_index template will show him. | ||
| + | Then he got to the gallery - content_custom_pic will be shown to him, because there is no mobile_content_custom_pic. | ||
| + | **NOTE** If for some reason you want to allow the user to disable this functionality, | ||
| + | |||
| + | |||
| + | |||
| + | ===== Related Galleries | ||
| + | |||
| + | For a custom gallery it is possible to display related galleries, by default this is a gallery from the same category, but can be changed in the tag | ||
| + | |||
| + | < | ||
| + | Examples | ||
| + | |||
| + | <thumb category=CURRENT_ITEM_GROUP num=1-5> | ||
| + | some template | ||
| + | </ | ||
| + | |||
| + | <thumb sponsor=CURRENT_ITEM_SPONSOR category="" | ||
| + | some template | ||
| + | </ | ||
| + | |||
| + | <thumb model=CURRENT_ITEM_MODEL category="" | ||
| + | some template | ||
| + | </ | ||
| + | |||
| + | <thumb tag=CURRENT_ITEM_TAG num=1-5> | ||
| + | some template | ||
| + | </ | ||
| + | |||
| + | <thumb tag=CURRENT_ITEM_TAGS_COMBINED num=1-5> | ||
| + | some template | ||
| + | </ | ||
| + | |||
| + | <thumb model=CURRENT_ITEM_MODEL | ||
| + | | ||
| + | exclude the current gallery from the results | ||
| + | |||
| + | These options are more complex (they load the database more) than the options | ||
| + | above | ||
| + | |||
| + | <thumb tag=CURRENT_ITEM_TAGS_INTERSECTION num=1-5> | ||
| + | display in sorting order | ||
| + | by the number of matching tags | ||
| + | (for example, 4 matching tags | ||
| + | is better than 3 matching tags) | ||
| + | </ | ||
| + | |||
| + | <thumb category=CURRENT_ITEM_GROUPS_INTERSECTION num=1-5> | ||
| + | display in order of sorting by the number of matching groups | ||
| + | </ | ||
| + | |||
| + | you can also skip sponsor, for example | ||
| + | |||
| + | <thumb num=1-10 skip_sponsor_id=THIS_ITEM_SPONSOR_ID> | ||
| + | < | ||
| + | </ | ||
| </ | </ | ||
| - | **Group limit** | + | Please note that CURRENT_ITEM_TAG and CURRENT_ITEM_GROUP take a random group\tag for sampling if there are several of them. CURRENT_ITEM_TAGS_COMBINED - takes all tags at once. |
| - | <thumb group_id=.. | ||
| - | or | ||
| - | <thumb skip_group_id=.. | ||
| - | **Sponsor limit** | + | ====== Special Parameters ====== |
| - | <thumb sponsor_id=123 or sponsor=sponsor_name | + | ===== THIS_CATEGORY_BEST_THUMB_ID ===== |
| - | or | + | |
| - | <thumb skip_sponsor_id=123 or skip_sponsor=sponsor_name | + | |
| + | <thumb first_thumb_id=THIS_CATEGORY_BEST_THUMB_ID order=ctr num=1-10> | ||
| + | | ||
| + | | ||
| + | By default, a category thumb is the best thumb in that category. But imagine one thumb belongs to 5 categories and is extremely popular. Once it becomes the category thumb for category A, it will no longer be used as the category thumb for category B, to avoid duplicates on the index. As a result, category B may use the second-best thumb by CTR. However, when a surfer opens category B, they may expect to see the strongest thumb first. The displayed tag forces category thumbs to appear first. | ||
| - | **Date** | + | Test parameter, see how it works for you. |
| + | |||
| + | ====== Subtemplate tags ====== | ||
| + | |||
| + | Things that can be used in subtemplate | ||
| < | < | ||
| - | & | + | < |
| + | < | ||
| + | < | ||
| + | < | ||
| + | (the so-called rotation parameter; | ||
| + | if it is not there, clicks on thumb | ||
| + | will not be counted in CTR) | ||
| + | |||
| + | < | ||
| + | |||
| + | < | ||
| + | < | ||
| + | where DE and IT are language codes | ||
| + | if you need to display a slug | ||
| + | in another language | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | for rotation, this tag will display all of them | ||
| + | separated by commas | ||
| + | |||
| + | < | ||
| + | etc. | ||
| + | < | ||
| + | (old style < | ||
| + | all group variables can also be displayed | ||
| + | in the form GROUP_1_group_variable | ||
| + | |||
| + | < | ||
| + | gallery groups | ||
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | |||
| + | < | ||
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | |||
| + | < | ||
| + | you can display all gallery models in a loop | ||
| + | |||
| + | < | ||
| + | within the gallery to which | ||
| + | the current rotating thumb belongs | ||
| + | |||
| + | < | ||
| + | |||
| + | < | ||
| + | |||
| + | < | ||
| + | if the gallery was created from something else, | ||
| + | for example embed code | ||
| + | or content uploaded manually | ||
| </ | </ | ||
| + | More information about video preview - [[rotation_crop_profiles# | ||
| - | there are some presets | + | |
| + | For example, imagine you grabbed a gallery with 10 pictures, and 5 of those pictures were added to rotation. Now you want a surfer to go from thumb rotation, for example from a category page, directly to the page with the exact picture behind the selected thumb. Suppose the best rotating thumb is number 3, and that thumb corresponds to picture number 6 inside the custom gallery. In that case, < | ||
| + | |||
| + | |||
| + | **Output of category variables** | ||
| + | |||
| + | |||
| + | For example, on a category page you may want to display < | ||
| + | |||
| + | |||
| + | |||
| + | **Small clarification about the THUMB_LINK parameter.** | ||
| + | |||
| + | The idea is simple: originally &link= was a generic link-tracking parameter. For example, if one block uses & | ||
| + | |||
| + | Later, rotation started using this parameter in the form images/ | ||
| + | |||
| + | After rewrites were added, gallery URLs started to look like / | ||
| + | |||
| + | So a URL like / | ||
| + | |||
| + | Because rotation historically uses the &link= tracking parameter, you cannot use that same parameter again for ordinary block tracking on rotating links. That is why the &link2= parameter was added. It has the same meaning as &link= for block tracking, but it allows URLs like out.php? | ||
| + | |||
| + | |||
| + | ===== category_list separator | ||
| + | |||
| + | The < | ||
| < | < | ||
| - | & | + | The issue is that if you display groups like this: |
| + | |||
| + | < | ||
| + | |||
| + | then you could get something like " | ||
| + | |||
| + | the trailing comma looks messy. | ||
| + | |||
| + | Now you can do | ||
| + | |||
| + | < | ||
| + | |||
| + | and the output will be " | ||
| </ | </ | ||
| + | ===== category_list ===== | ||
| - | ===== Template variables ===== | + | Let's imagine that we have 2 main categories: cars (1) and motorcycles (2), and each of them contains subcategories (for example, the colors red, blue, etc.) |
| + | |||
| + | It turns out that any gallery actually has at least 2 categories, for example “car” and “blue”. We display only cars in the template, for example | ||
| < | < | ||
| + | <thumb num=1-5 order=ctr category_id=1> | ||
| + | < | ||
| + | separator=" | ||
| + | </ | ||
| + | </ | ||
| - | | + | In this case, <category_list will output these two categories: cars (the root category) and blue (the subcategory). |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| + | If you want to display only subcategories, | ||
| - | <!--GALLERY_ID--> | + | <code> |
| - | <!--GALLERY_SLUG--> | + | <category_list skip_parent_category=true num=1-5 |
| - | < | + | separator=" |
| - | <!--ACTIVATION_DATE--> | + | > |
| - | <!--ACTIVATION_DATETIME--> | + | <!--CATEGORY_NAME--> |
| - | <!--DURATION--> | + | </ |
| - | < | + | </code> |
| + | |||
| + | |||
| + | ===== tag_list ===== | ||
| - | <!--CUSTOM_VAR1--> | + | Templates can iterate over all gallery tags with <tag_list ...> <!--TAG--> </tag_list>. |
| - | <!--CUSTOM_VAR2--> | + | |
| - | <!--CUSTOM_VAR3--> | + | |
| + | < | ||
| + | < | ||
| + | </ | ||
| - | for flash galleries (when sponsor gives you url to flv) | + | additional options |
| - | < | + | order=alphabet, |
| - | < | + | |
| - | < | + | |
| - | <!--FLV_URL--> | + | tag_status=wait \ active |
| + | </code> | ||
| - | With update 48 models were added | ||
| - | < | + | **Tag languages** |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| + | If your site supports multiple languages, tags can be translated accordingly. For example, on the /de page the tags can be displayed in German: | ||
| - | if gallery has more then 1 model | + | < |
| + | |||
| - | < | + | Usually tags are linked to a page in the gallery listing by this tag, for example |
| - | < | + | |
| - | <!--MODEL_2_NAME--> | + | |
| - | <!--MODEL_2_SLUG--> | + | <a href='/ |
| + | </ | ||
| - | and so on | ||
| + | In that case, the tag in the URL will also be written in German. If you want links to stay in the main language, for example English, you need to change the output language: | ||
| + | |||
| + | < | ||
| + | <a href='/ | ||
| + | < | ||
| + | </a> | ||
| + | (other lng < | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Language Modifiers ===== | ||
| + | |||
| + | If you have several languages on your site, then you can access any data in another language by adding ::LNG at the end of the tag, for example on the /de page | ||
| + | |||
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | ===== Comments ===== | ||
| + | |||
| + | On the gallery page you can display comments about it | ||
| + | |||
| + | < | ||
| + | < | ||
| + | |||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | And comment pagination | ||
| + | |||
| + | < | ||
| + | < | ||
| + | </ | ||
| </ | </ | ||
| - | For categories | + | Options |
| + | |||
| + | < | ||
| + | order = date | ||
| + | sort = asc\desc | ||
| + | </ | ||
| + | |||
| + | ====== Page tags ====== | ||
| + | |||
| + | Each page has a number of its own tags. | ||
| + | |||
| + | |||
| + | **Relevant for everyone** | ||
| + | |||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | **For category page** | ||
| < | < | ||
| - | < | + | < |
| - | < | + | < |
| + | < | ||
| < | < | ||
| < | < | ||
| - | < | + | < |
| < | < | ||
| < | < | ||
| < | < | ||
| + | </ | ||
| - | For search | + | **For model page** |
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | **For search** | ||
| + | |||
| + | < | ||
| < | < | ||
| < | < | ||
| + | </ | ||
| + | |||
| + | **Sponsor page** | ||
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| </ | </ | ||
| - | For custom | + | **For custom |
| + | Basically, the same tags that are available inside a subtemplate are also available on a custom gallery page. If thumb 1 has the description “super pic” and that value is displayed in the subtemplate with < | ||
| + | |||
| + | The same applies to tags by sponsor; if sponsor is 1, then all sponsor tags, for example < | ||
| + | |||
| + | But there are several tags that are relevant specifically for custom gallery pages. | ||
| + | |||
| + | **For embed gallery the same applies** | ||
| < | < | ||
| - | | + | <!--EMBED_CODE--> |
| - | <!--IMG_1_THUMB--> | + | </code> |
| - | < | + | |
| - | < | + | |
| - | | + | |
| - | | + | |
| - | <!--IMG_2_THUMB--> | + | **Relevant for flv gallery** |
| - | <!--IMG_2_THUMB_X--> | + | |
| - | <!--IMG_2_THUMB_Y--> | + | < |
| - | + | <!--FLV_WIDTH--> | |
| - | | + | < |
| + | < | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | |||
| + | **For picture\movie galleries** | ||
| + | |||
| + | |||
| + | |||
| + | < | ||
| + | < | ||
| + | <!--ITEM_NUM--> | ||
| + | <!--IMAGE--> | ||
| + | <!--THUMB--> | ||
| + | | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | Can be limited by content type | ||
| + | |||
| + | < | ||
| + | movie, flash | ||
| + | (although flash is mostly only relevant | ||
| + | | ||
| < | < | ||
| Line 249: | Line 1023: | ||
| < | < | ||
| < | < | ||
| - | < | + | < |
| - | + | ||
| < | < | ||
| < | < | ||
| Line 257: | Line 1031: | ||
| < | < | ||
| < | < | ||
| - | | + | </ |
| - | example of IF statement | + | |
| + | The old version of content output is supported, but it is better to use the one indicated above | ||
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | |||
| + | IMG_2_ IMG_3... and so on | ||
| + | |||
| + | Please note: | ||
| + | starting from version 49, | ||
| + | content inside a custom gallery | ||
| + | is split by content type, | ||
| + | so you can create mixed custom galleries, | ||
| + | for example | ||
| + | |||
| + | For the first image it will be | ||
| + | < | ||
| + | < | ||
| + | |||
| + | For the first movie it will be | ||
| + | < | ||
| + | < | ||
| + | |||
| + | For the first flash item it will be | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | |||
| + | and also < | ||
| + | from the gallery that was used | ||
| + | to create this custom gallery. | ||
| + | You can edit this text in Edit any gallery. | ||
| + | |||
| + | And common variables for a custom gallery | ||
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | |||
| + | as well as an example of checking the presence | ||
| - | <!--IF IMG_6--> | + | <? if ('<!--IMG_6_IMAGE-->') { ?> |
| <a href='< | <a href='< | ||
| - | <!--END IF--> | + | <? } ?> |
| + | For comments | ||
| + | |||
| + | < | ||
| + | |||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | For single_page_item | ||
| + | |||
| + | < | ||
| + | < | ||
| + | |||
| + | < | ||
| + | < | ||
| </ | </ | ||
| | | ||
| + | ====== Tag prefix ====== | ||
| + | |||
| + | There are prefixes for standard modifications of variables. For example, you want to do | ||
| + | |||
| + | < | ||
| + | <?php ucfirst('< | ||
| + | </ | ||
| + | |||
| + | If there is a quotation mark in the description, | ||
| | | ||
| - | You have to mark places where you want to output thumbs: | + | <?php ucfirst(' |
| + | |||
| + | As it is not difficult | ||
| - | <thumb num=1></thumb> | + | <?php ucfirst(' |
| - | or | + | |
| - | <!--default_1--> | + | It looks like replacing a regular tag with a tag with a prefix |
| - | or | + | |
| - | | + | For example, this is how <!--ALT--> |
| + | |||
| + | <?php ucfirst(' | ||
| + | |||
| + | which will be executed without errors. | ||
| | | ||
| - | ===== Navigation (Pagination) ===== | + | Currently the following prefixes exist: |
| - | 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 | + | **1. Escaping quotes** |
| - | < | + | For example, this is how <!--ALT--> |
| - | < | + | |
| - | </ | + | |
| + | **2. HTMLENTITY to replace html special characters such as & with &** | ||
| - | 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, this is how < | ||
| + | with all tags. | ||
| + | </ | ||
| + | |||
| + | **3. URLENCODE for special characters in the URL, such as space, +, etc. ** | ||
| < | < | ||
| - | For example | + | For example, |
| + | < | ||
| + | and so on with all tags. | ||
| + | </code> | ||
| - | < | + | Actually http://www.php.net/manual/en/ |
| - | < | + | |
| - | </navigation> | + | |
| - | Let's say we are on the 2nd page of total 3 pages | + | **4. RAWURLENCODE for special characters in the URL, for example space at %20, etc. ** |
| + | < | ||
| + | For example, | ||
| + | < | ||
| + | and so on with all tags. | ||
| + | </ | ||
| - | < | + | Actually http://www.php.net/manual/en/function.rawurlencode.php |
| - | < | + | |
| - | < | + | |
| + | And there is also < | ||
| + | < | ||
| - | w\o skip_href_deletion=true | ||
| - | < | + | **5. STRIP_SPECIAL_CHARS_ to remove all special characters !$@, etc. ** |
| - | < | + | |
| - | < | + | |
| + | Currently replace looks like trim(preg_replace(' | ||
| + | For example < | ||
| + | | ||
| + | **6. URLSAFE_ ** | ||
| - | Or Prev \ Next example | + | replaces spaces and other things with dashes to make the URL look better |
| - | <?php if ('< | + | ** More ** |
| - | < | + | |
| - | <?php } ?> | + | |
| - | <?php if ('< | + | UPPERCASE_ |
| - | < | + | |
| - | <?php } ?> | + | |
| - | </ | + | LOWERCASE_ - all in small letters |
| + | UCFIRST_ the first letter in the sentence is capital | ||
| + | CUT20_ - trim leaving only the first 20 characters | ||
| - | ===== List of categories | + | WORDCUT20_ - trim leaving only the first 20 characters, taking into account the end of words, they do not cut off the word in half |
| + | ====== Tag prefix - why important ====== | ||
| - | < | + | As you probably know, templates can contain PHP code. There is no need to cover every PHP edge case here, but one simple example is enough. Suppose you want to output the description tag <!--DESCRIPTION--> |
| - | < | + | |
| - | </ | + | change |
| | | ||
| + | However, there is one important caveat here: if the description contains a quotation mark, you will end up with something like <?php echo strtoupper(' | ||
| + | |||
| + | < | ||
| + | An example with < | ||
| + | |||
| + | <?php echo strtoupper('< | ||
| + | </ | ||
| + | |||
| + | |||
| + | **Example with SEARCH_QUERY** | ||
| + | |||
| + | The user is looking for /? | ||
| + | |||
| + | |||
| + | For example, you have | ||
| + | Search was <? | ||
| | | ||
| - | * num - numbers like 1-5 mean from 1 to 5. | + | it turns out the code |
| - | * order - can be alphabet and clicks. | + | |
| - | * min_gallery_count | + | |
| - | * set - you can you 2 sets of category thumbs | + | |
| - | * first_letter=... output categories with names starting with this letter only | + | |
| + | Search was <? | ||
| + | | ||
| + | which crashes with an error | ||
| - | ===== Include template ===== | + | it’s even worse if the URL contains a hacking code, for example |
| - | You can include one template into another, for example, good idea to include header and footer in other templates. | + | /? |
| - | | + | |
| + | and it is executed in your template. | ||
| + | |||
| + | Therefore, it is very important to escape all user input | ||
| + | |||
| + | |||
| + | Search was <? | ||
| + | | ||
| | | ||
| - | Also with update 48 you can include local and even remote file | + | |
| - | < | ||
| - | < | ||
| + | ====== Pagination ====== | ||
| - | ===== Tag Cloud ===== | + | Since there are usually many thumbs, you need page navigation. For example: |
| < | < | ||
| - | <tag_cloud order=alphabet> | + | <pagination first_pages=3 adjustment=1 last_pages=3 |
| - | <a href="/ | + | range_separator=" |
| - | </tag_cloud> | + | > |
| + | < | ||
| + | | ||
| + | | ||
| + | < | ||
| + | | ||
| + | | ||
| + | title=" | ||
| + | > | ||
| + | | ||
| + | | ||
| + | </ | ||
| + | </ | ||
| + | </code> | ||
| + | * skip_href_deletion=true By default the script deletes an href from the current page, with this option it will not delete. | ||
| + | * active_link_style=act_pg and link_style=not_act_page sets the appropriate styles for the active and inactive pages | ||
| + | * max_pages limit the maximum number of pages. It’s useful if you have a very large database; real people still don’t go to the very end. | ||
| - | You can also limit amount of tags displayed | ||
| - | <tag_cloud order=alphabet num=1-10> | + | <code> |
| - | <a href="/ | + | For example, our navigation code is like this: |
| - | </ | + | |
| - | and sort them based on amount if galleries by this tag | + | < |
| + | link_style=not_act_page> | ||
| + | < | ||
| + | <a href="/? | ||
| + | | ||
| + | | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| - | < | + | Assume you are on page 2 and there are 3 pages total. |
| - | <a href="/ | + | |
| - | </ | + | |
| + | the script will output: | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | |||
| + | without skip_href_deletion=true it would look like this | ||
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
| </ | </ | ||
| - | 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 | + | more examples: |
| + | |||
| + | 1. explicitly setting the style attribute to html tags | ||
| + | |||
| + | Assume | ||
| < | < | ||
| + | < | ||
| + | link_style=" | ||
| + | <li> | ||
| + | <a href="/? | ||
| + | | ||
| + | | ||
| + | < | ||
| + | </a> | ||
| + | </li> | ||
| + | </ | ||
| + | </ | ||
| - | < | + | the script will output: |
| - | | + | < |
| + | <li><a href="/ | ||
| + | < | ||
| + | <li><a href="/? | ||
| + | </ | ||
| - | </ | + | 2. setting the values of data attributes depending on the current page: |
| + | < | ||
| + | < | ||
| + | skip_href_deletion=true> | ||
| + | <li data-page-ptr="< | ||
| + | <a href="/? | ||
| + | </li> | ||
| + | </ | ||
| + | </ | ||
| + | for a request ?page=**2** will generate HTML markup like: | ||
| + | |||
| + | < | ||
| + | <li data-page-ptr=" | ||
| + | <li data-page-ptr=" | ||
| + | <li data-page-ptr=" | ||
| + | </ | ||
| + | |||
| + | 3. setting a separate css class for the current page: | ||
| + | |||
| + | < | ||
| + | < | ||
| + | skip_href_deletion=false> | ||
| + | <li class=" | ||
| + | <a href="/? | ||
| + | </li> | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | for a request ?page=**3** will generate HTML markup like: | ||
| + | < | ||
| + | <li class=" | ||
| + | <li class=" | ||
| + | <li class=" | ||
| + | </ | ||
| + | |||
| + | 4. setting a separate css class for the current page with tag replacement: | ||
| + | |||
| + | < | ||
| + | < | ||
| + | skip_href_deletion=false | ||
| + | > | ||
| + | <li class=" | ||
| + | <?php if ('< | ||
| + | < | ||
| + | <?php else: ?> | ||
| + | <a href="/? | ||
| + | <?php endif; ?> | ||
| + | </li> | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | for a request ?page=**2** will generate HTML markup like: | ||
| + | < | ||
| + | <li class=" | ||
| + | <li class=" | ||
| + | <li class=" | ||
| + | </ | ||
| + | |||
| + | |||
| + | **List all the pages** | ||
| + | |||
| + | If you need to display all pagination pages | ||
| + | |||
| + | < | ||
| + | | ||
| + | then we will output not 1 2 3 ... 70 71, but precisely the entire sheet 1 2 3 4 5 6 7 and so on until the end | ||
| + | | ||
| + | |||
| + | |||
| + | |||
| + | **There is also an option with Prev Next** | ||
| + | if you do not use < | ||
| + | |||
| + | |||
| + | < | ||
| + | < | ||
| + | |||
| + | < | ||
| + | </ | ||
| + | |||
| + | |||
| + | Please note that pagination shows pages for thumb rotation. | ||
| + | |||
| + | For category thumbs, since their number is usually fixed, there is no point in recalculating them every time you create pages. Therefore, if you need pagination for category thumbs, then the best way to do it is like this | ||
| + | |||
| + | < | ||
| + | < | ||
| + | Here you need to pay attention: | ||
| + | this will display the categories | ||
| + | taking into account the current page, | ||
| + | because by default on any page | ||
| + | you still want to see the top categories. | ||
| </ | </ | ||
| - | 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. | + | adding links |
| + | <a href=" | ||
| + | <a href=" | ||
| + | etc. | ||
| + | I think it’s not difficult to calculate how many links you need depending on the number of categories you have. | ||
| + | And we get navigation for categories. | ||
| ====== Category Thumbs ====== | ====== Category Thumbs ====== | ||
| - | The script | + | The script |
| - | Here's an example how | + | To display a list of categories |
| < | < | ||
| - | < | + | <li> |
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| </ | </ | ||
| Parameters: | Parameters: | ||
| - | * num - limit amount | + | * num which numbers to display (in this example, from 1st to 5th from the list). |
| - | * min_gallery_count | + | * min_gallery_count limit on the number |
| - | * set - byfault | + | * set - select a set of category thumbs, default is 1, but you can make set=2 for example < |
| - | * first_letter=... , # - means any number | + | * first_letter=... |
| - | * custom_name_first_letter = ... | + | * custom_name_first_letter = ... displaying categories whose custom name begins with such and such a letter |
| - | * category_custom_var1 category_custom_var2 category_custom_var3 - limit by custom | + | * category_custom_var1 category_custom_var2 category_custom_var3 - by custom |
| - | * filter_field= and filter_value - unified | + | * filter_field= and immediately |
| - | | + | * sort_order - relative to sort_field (asc, desc) |
| - | * sort_order - asc, desc | + | * order - sorting the list of categories alphabetically (alphabet), by popularity |
| - | * order - alphabet, | + | Technically, |
| - | * parent_id | + | category_custom_name, |
| - | * name=" | + | * parent_id |
| - | * category_id= | + | * name=" |
| + | * category_id= | ||
| - | There are some test vars | + | Additional tags for the list of categories: |
| - | | + | * < |
| + | ===== Category Pagination ===== | ||
| - | ====== Tag prefix ====== | + | By default, if we display categories, then on all pages we should display just a list of categories without shift, if you have a page header for example |
| - | You can use PHP code in your templates | + | < |
| + | |||
| + | |||
| + | then you need to display the first 20 categories, okay if the URL contains ? | ||
| - | <?php ucfirst('< | + | To do this, the category tag itself is displayed as |
| - | If a description has a quote you'll get an error, so you have to " | + | < |
| + | (here you need to add adjust_num_to_page) | ||
| + | < | ||
| + | </ | ||
| - | <?php ucfirst('< | + | And to this you can add pagination specifically for category thumbs |
| - | Here's another example | + | < |
| + | (note the type=pagination parameter) | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | |||
| + | Previous and next pages | ||
| + | |||
| + | < | ||
| + | < | ||
| + | prev = < | ||
| + | </ | ||
| - | Let's say <!--ALT--> becomes | + | <category link_type=" |
| + | Next = <!--NEXT_PAGE--> | ||
| + | </ | ||
| + | </ | ||
| - | At present moment we have following prefixes | ||
| - | **1. Escape ** | + | Here you should pay attention everywhere that the tags are almost the same, but if you have only 100 categories then |
| - | As an example | + | <code> |
| + | < | ||
| + | Next = <!--NEXT_PAGE--> | ||
| + | </ | ||
| + | </code> | ||
| - | **2. HTMLENTITY to replace special html characters like & => & | + | |
| + | |||
| + | will print next on the 4th page, and if you do | ||
| + | |||
| + | < | ||
| + | Next = < | ||
| + | </ | ||
| + | |||
| + | then there will be no next on the 4th page. | ||
| + | ====== adjust_num_to_page ====== | ||
| + | |||
| + | By default, category thumbs and models are displayed without | ||
| < | < | ||
| - | '&' | + | < |
| - | '"' | + | |
| - | ''' | + | |
| - | '<' | + | |
| - | '>' | + | |
| + | <thumb num=1-10 | ||
| + | </ | ||
| - | | + | then on the first page it will display the first 10 categories and the first 10 thumbs. |
| + | |||
| + | But there are options when you still need to “move” the list of categories across pages. In this case, the adjust_num_to_page=true parameter is useful, for example | ||
| + | |||
| + | |||
| + | < | ||
| + | |||
| + | |||
| + | in this case, categories 11-20 will be displayed on the 2nd page | ||
| + | |||
| + | |||
| + | |||
| + | ====== Language list ====== | ||
| + | |||
| + | You can list available translations using the tag | ||
| + | |||
| + | < | ||
| + | < | ||
| + | | ||
| + | </ | ||
| </ | </ | ||
| + | ====== Include template ====== | ||
| - | **3. URLENCODE | + | |
| + | You can connect any template, for example, place the site header in the header template and, in order not to duplicate the beginning of each page, connect it in the desired template | ||
| + | |||
| + | < | ||
| + | |||
| + | Similarly, you can connect any other template. | ||
| + | |||
| + | |||
| + | ====== INCLUDE_FILE ====== | ||
| + | |||
| + | Templates often include external files, for example, | ||
| + | |||
| + | This can be done via | ||
| + | |||
| + | < | ||
| + | |||
| + | it's practically analogous | ||
| + | |||
| + | <? include('/ | ||
| + | |||
| + | The difference is that in the first option the file is included once and placed in the cache. In the 2nd option, the file is included every time the page is loaded. In principle, for local files we can say that there is no difference. | ||
| + | |||
| + | |||
| + | If the file is on a remote server, then you need to do this: | ||
| + | |||
| + | < | ||
| + | |||
| + | |||
| + | **DO NOT** do this | ||
| + | |||
| + | <? include(' | ||
| + | |||
| + | |||
| + | |||
| + | To make it easier to transfer templates between domains, you can use the option | ||
| + | |||
| + | < | ||
| + | |||
| + | |||
| + | where BASE_DIR is taken from common.php and, accordingly, | ||
| + | ====== Tag Cloud ====== | ||
| < | < | ||
| - | | + | < |
| + | <a href="/ | ||
| + | <font size='<!--TAG_RANK-->'> | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | You can also limit the number of tags | ||
| + | |||
| + | < | ||
| + | <a href="/ | ||
| + | <font size='< | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | and sort by the number of gallery in the tag | ||
| + | |||
| + | < | ||
| + | <a href="/ | ||
| + | <font size='< | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| </ | </ | ||
| - | Basically | + | Other tag parameters < |
| + | < | ||
| + | gallery_count_min - minimum number of galleries to display | ||
| + | first_letter - tag starts with this letter | ||
| + | filter - the tag contains this word, in addition you can use | ||
| + | filter_type = exact_search for exact match | ||
| + | filter_type = fulltext_search - if FULLTEXT index is added | ||
| - | **4. RAWURLENCODE | + | status=all by default < |
| + | if you need to display everything, you can add status=all | ||
| + | |||
| + | tag_has_thumb - only those tags for which there is a thumb tag | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | Output of the best thumb for a given tag | ||
| < | < | ||
| - | | + | < |
| + | |||
| + | <!--TAG_NAME--> | ||
| + | for example | ||
| + | |||
| + | </ | ||
| </ | </ | ||
| - | Basically | + | By default, the selection of the best thumb for each tag is disabled as this loads the server to a certain extent. The settings are located in Rotation - Tube - Settings. |
| - | Don't forget you can combine < | ||
| - | < | ||
| + | ====== Model List ====== | ||
| - | **5. STRIP_SPECIAL_CHARS_ to delete special characters like !$@ and so on ** | + | You can display all available models |
| - | Exactly it's : trim(preg_replace(' | + | <code> |
| + | <models num=1-10> | ||
| + | < | ||
| + | </ | ||
| + | available parameters for model tag | ||
| - | Example: | + | <models first_letter=a> models with " |
| - | ===== <tag_list and <group_list ===== | + | <models min_gallery_count=20> minimum 20 gallery |
| + | <models order=count_galleries> | ||
| + | <models order=model_ctr> | ||
| + | <models order=ctr >- CTR thumb | ||
| + | <models order=random > | ||
| + | <models model_has_photos=true > | ||
| + | displays only those models | ||
| + | that have a photo | ||
| + | (uploaded manually) | ||
| + | <models model_has_thumb=true > displays only those models that have | ||
| + | automatically selected model thumb (selected in Rotation Settings - model | ||
| + | thumbs) | ||
| + | <models model_custom_var1=" | ||
| + | (model_custom_var1=" | ||
| + | <models model_custom_var1=not_empty > output of those whose customware is not | ||
| + | empty | ||
| - | Outputs all the data for the current gallery. An example shows it better then a thousand words | + | <models model_name=" |
| + | <models model_id=" | ||
| + | |||
| + | skip_model_id - skip id, comma separated enumeration if you need to skip | ||
| + | several ids | ||
| + | </ | ||
| + | |||
| + | ===== Model Thumbs ===== | ||
| + | |||
| + | There are 2 options | ||
| + | |||
| + | **model thumbs** | ||
| < | < | ||
| - | <tag_list | + | <models |
| + | <!--MODEL_NAME--> | ||
| + | model. | ||
| + | </ | ||
| + | </code> | ||
| - | and for groups | ||
| - | < | + | Example rewrite for models |
| - | and models | + | < |
| + | RewriteCond %{QUERY_STRING} ^(.+)$ | ||
| + | RewriteRule ^model/ | ||
| + | / | ||
| + | & | ||
| + | & | ||
| + | RewriteRule ^model/ | ||
| + | / | ||
| + | </ | ||
| - | < | ||
| + | Display model thumbs (gallery_count_min=1 was added to display only those models for which model thumbs could be created, and for this you need at least one gallery for the model) | ||
| + | |||
| + | < | ||
| + | <models num=1-10 gallery_count_min=1 order=ctr> | ||
| + | <a href='/ | ||
| + | < | ||
| + | </a> <br> | ||
| + | </ | ||
| </ | </ | ||
| - | Note that if you have something like this | ||
| - | < | + | ===== Model Photos ===== |
| - | you'll get a result like this " | + | Models can also have their own photos. These are the model photos added in the admin panel, not gallery thumbs where this model appears. Photo output: |
| - | That;' | ||
| - | <group_list separator="," | + | <code> |
| + | <models | ||
| - | which gives you better result like this " | + | < |
| + | < | ||
| + | <br> | ||
| + | </ | ||
| + | </ | ||
| + | ===== Model Pagination ===== | ||
| + | You can add pagination for models | ||
| - | ====== Search log ====== | + | < |
| + | <models num=1-12 type=pagination> | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| - | if you have a search form like (domain/? | ||
| - | Default rewrite - http:// | ||
| - | You can also output that list at any page | + | ====== Sponsors List ====== |
| - | < | + | You can also display a list of sponsors. |
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | Options | ||
| + | |||
| + | order= alphabet, ctr, sponsor_name, | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Sponsor URLS ===== | ||
| + | |||
| + | In Rotation - Sponsors, you can define several URLs for each sponsor: site_url, trial_url, and join_url. | ||
| + | |||
| + | On the gallery page, you can output these URLs with the appropriate tags. However, that means the surfer will see the sponsor URL together with your ref link, and the resulting URL is not always very clean. By default, the script includes a rewrite like http:// | ||
| + | |||
| + | Can be added to rewrite | ||
| < | < | ||
| + | RewriteRule ^go/ | ||
| + | [L] | ||
| + | and use URL | ||
| + | http:// | ||
| + | http:// | ||
| + | |||
| + | to send to other sponsor URLs. | ||
| + | </ | ||
| + | |||
| + | ====== Search log ====== | ||
| + | |||
| + | If you have a search form on your site (domain/? | ||
| + | |||
| + | But you can also display a log of these requests on any page, for example | ||
| + | |||
| + | < | ||
| + | |||
| + | |||
| + | Please note that when logging search queries, the field from the Banned words setting is also taken into account and if someone searches for a word from the list, it will not be logged. | ||
| + | |||
| + | < | ||
| < | < | ||
| - | order=hits - also can be : alphabet, date | + | order=hits - can also be alphabet, date, if not specified, sort by number of |
| + | hits. | ||
| - | date_limit=today - yesterday, this_week, this_month | + | sort=ASC (DESC) in addition to the tags above to sort in a different order |
| - | date_start= date_end= | + | date_limit=today - can also be yesterday, this_week, this_month |
| - | min_results= with at least X results | + | date_start=date date_end=date |
| - | min_hits= surfers looked up this term at least X times | + | min_results= where there were more than X results from the search results |
| - | search= filter results by this keyword | + | min_hits= this has been searched at least X times |
| + | search= filter search queries for this word | ||
| </ | </ | ||
| - | so called | + | there is "syntactic |
| - | | + | search= CURRENT_CATEGORY_NAME or CURRENT_TAG_NAME |
| - | basicaly | + | which is the same as search=GET_category_name and search=GET_tag_name (we take search words from the URL) |
| - | | + | exclude_search_query= exclude from results |
| | | ||
| + | 99% will exclude_search_query=GET_search - those excluding the current request | ||
| - | 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 ' | ||
| + | When a user searches on the site, we log the query itself, for example “car”, along with the gallery ID that was first for that query. This means we can display not only the search phrases themselves, but also the gallery thumb associated with them. For example: | ||
| < | < | ||
| - | < | + | < |
| - | < | + | < |
| - | Best gallery: < | + | Best gallery: < |
| + | etc. gallery data, which was the first for this request | ||
| + | </ | ||
| + | </code> | ||
| + | |||
| + | You can specify not to save search queries to the log | ||
| + | |||
| + | < | ||
| + | < | ||
| + | |||
| + | < | ||
| + | for this request | ||
| </ | </ | ||
| </ | </ | ||
| + | ====== Search log : allow_dupes ====== | ||
| - | If you don't want to log search | + | each search remembers the first gallery based on the results of this search, you can display it as |
| < | < | ||
| - | < | + | < |
| + | < | ||
| + | </ | ||
| + | </code> | ||
| - | < | + | however, there is a possibility that for different searches the first gallery will be the same gallery, so by default it does not display duplicates. If you display only the search phrase, without gallery, then such duplication is not important to you and you can do it |
| + | < | ||
| + | < | ||
| + | < | ||
| </ | </ | ||
| </ | </ | ||
| + | ====== Related Search log ====== | ||
| + | For example, a user searched for “car” on our website, and then searched for “gasoline” or “trailer”; | ||
| - | ===== Rows and Cols ===== | + | If we remember this, we will be able to display such queries in the future, for example, the user searches for “car”, |
| - | There are settings for rows ans cols, it doesnt affect template, it's for [[Cell Stats]] | + | For tracking, you need to change the links on the site so that the search query looks like |
| - | ===== Custom Templates ===== | + | /?search=....& |
| + | |||
| + | where ref_search_query= is the previous query. | ||
| - | You can have as many custom template as you want. For example, | + | For example, in the search form |
| - | 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. | + | < |
| + | <form method=GET> | ||
| + | <input type=text | ||
| + | <input | ||
| + | type=hidden | ||
| + | name=" | ||
| + | value="< | ||
| + | <input type=submit > | ||
| + | </ | ||
| + | </ | ||
| - | * ask trader | + | to then display related queries |
| - | * create rewrite for link1 | + | |
| - | * create file trd.php and set it as personal page for this trader | + | |
| - | content | + | < |
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | That is, in ref_search_query we look for records that match GET_search. | ||
| + | ====== Search log - approved ====== | ||
| + | |||
| + | By default, all search queries are saved to the database and marked as new. Also, by default, the < | ||
| + | |||
| + | If you are likely to have such a situation, you can do the following: | ||
| + | |||
| + | < | ||
| + | |||
| + | and will display only those search phrases that you approved in the admin panel. | ||
| + | |||
| + | ====== Syntactic Sugar ====== | ||
| + | |||
| + | For convenience, | ||
| + | |||
| + | < | ||
| + | |||
| + | this syntactic sugar works in all tags | ||
| + | |||
| + | currently added | ||
| + | |||
| + | CURRENT_CATEGORY_NAME | ||
| + | CURRENT_TAG_NAME | ||
| + | |||
| + | |||
| + | It is planned to add all the data, if you need something more, write on the forum and it will be added. | ||
| + | |||
| + | ===== Search log pagination===== | ||
| + | |||
| + | Solved by adding type=pagination to the tag | ||
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | |||
| + | Please note that the pagination tag must be the same as the " | ||
| + | |||
| + | < | ||
| + | |||
| + | that means there should be pagination | ||
| + | |||
| + | < | ||
| + | |||
| + | In this way, you can make, for example, 2 < | ||
| + | ===== Search log filter ===== | ||
| + | |||
| + | You can also display a log of search queries, for example | ||
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | |||
| + | you can filter it taking into account the current search For example, a surfer is looking for domain.com/? | ||
| + | |||
| + | < | ||
| + | thumb output for search results | ||
| + | <thumb num=1-10> | ||
| + | |||
| + | and output of search queries | ||
| + | |||
| + | < | ||
| + | |||
| + | where GET_search is the search parameter from GET (those URLs) | ||
| + | </ | ||
| + | |||
| + | **Filtering note** | ||
| + | |||
| + | By default, MySQL searches by full phrase. For example, if the query is "test car", it will filter by the full occurrence. In that case, a phrase like “test bus” will not be shown. | ||
| + | |||
| + | If you use MySQL 5.6 or newer, the field is automatically converted to full-text search, and then you do not need to do anything special: the script will automatically search by individual words, so “test bus” will also be included in the results. | ||
| + | |||
| + | But if you have mysql up to 5.6 OR the number of search queries is very large (100k+), then you need to use sphinx for search. We index search queries (see Sphinx wiki article) and set Sphinx Search Log Index in settings. | ||
| + | ===== Search query limit ===== | ||
| + | |||
| + | There may be a lot of options for limiting search on a site, for example | ||
| + | |||
| + | /? | ||
| + | could turn into | ||
| + | /? | ||
| + | or | ||
| + | /? | ||
| + | |||
| + | and so on, the options can be different and combined, so the free parameter & | ||
| + | |||
| + | For example, we are searching for the group teen. | ||
| + | Add search_query_limit=teen to the URL, for example /? | ||
| + | |||
| + | when outputting < | ||
| + | |||
| + | < | ||
| + | |||
| + | You can substitute & | ||
| + | |||
| + | < | ||
| + | |||
| + | **Language search** | ||
| + | Similarly, you can divide the search by language so that it can be displayed in the corresponding languages. The script itself does not determine what language a particular sentence is written in, but this can be taken from the URL, for example, add a parameter with the current language & | ||
| + | |||
| + | |||
| + | domain/? | ||
| + | domain/? | ||
| + | domain/? | ||
| + | domain/? | ||
| + | |||
| + | |||
| + | Thus, in our database for each search it will be noted in what language it was made. Adding a parameter is easy right in the template, for example <input type=hidden name=search_query_limit value=' | ||
| + | |||
| + | In the template we add | ||
| + | |||
| + | < | ||
| + | |||
| + | and open the page as domain/? | ||
| + | |||
| + | test, | ||
| + | |||
| + | |||
| + | maybe they are marked lng_en | ||
| + | |||
| + | |||
| + | Please note that you can manually add searches to the database (Add Search requests) in the format " | ||
| + | ====== Toplist ====== | ||
| + | |||
| + | A familiar scheme for many is a toplist of traders in a separate file and included in the template. It’s better to skip the moment of creating a separate file and add top traders directly to the template, and you can, for example, mix them in. | ||
| + | |||
| + | < | ||
| + | <thumb num=1-3></ | ||
| + | trader thumb | ||
| + | <thumb num=3-6></ | ||
| + | 2 more trader thumbs, etc. | ||
| + | </ | ||
| + | |||
| + | This way you don’t have to make a dedicated toplist and even set it to 100. | ||
| + | |||
| + | Previously, if you wanted to show 1 or 2 trader thumbs, you had to create many separate top templates and include them in the right place. Now traders can be displayed directly in the template in the required quantity. | ||
| + | |||
| + | < | ||
| + | <thumb num=1-3></ | ||
| + | |||
| + | <trader num=1> < | ||
| + | |||
| + | <thumb num=3-6></ | ||
| + | |||
| + | <trader num=2-3> < | ||
| + | </ | ||
| + | |||
| + | |||
| + | You can specify a random number of thumbs, for example | ||
| + | < | ||
| + | <trader num=random random_start=1 random_end=10 random_items=3 | ||
| + | </ | ||
| + | |||
| + | will bring out 3 traders who are somewhere in positions between 1 and 10 | ||
| + | |||
| + | |||
| + | |||
| + | Total inside the <trader tag you can use | ||
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | and so on | ||
| + | if you have more than one thumb | ||
| + | for each trader | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | editing a trade) | ||
| + | </ | ||
| + | |||
| + | |||
| + | There is one small detail about per-group descriptions. Suppose trader A belongs to group 1. | ||
| + | The trader’s regular description is “test”, while the description for group 1 is “super test”. If we output the | ||
| + | |||
| + | macro | ||
| + | |||
| + | <trader num=1-10> | ||
| + | |||
| + | this displays all traders, including trader A. Since no group is specified here, < | ||
| + | |||
| + | |||
| + | <trader group=new num=1-10> | ||
| + | |||
| + | then < | ||
| + | |||
| + | |||
| + | |||
| + | Possible parameters for the tag | ||
| + | |||
| + | < | ||
| + | <trader num=1 .... > | ||
| + | num = trader number, there can be a range for example 1-5 | ||
| + | |||
| + | order = sorting, options uniques, raws, priority, clicks, random by default - | ||
| + | uniques. | ||
| + | |||
| + | group= group of traders | ||
| + | |||
| + | skip_group= skip group | ||
| + | |||
| + | unique_hits_limit=2-100 - limit on the number of hits of traders | ||
| + | </ | ||
| + | |||
| + | The priority sorting option is mainly useful for trading: traders that should receive traffic first will appear higher in the template. | ||
| + | |||
| + | |||
| + | **Blocked countries** | ||
| + | |||
| + | If you have some countries blocked for a trader (conditionally, | ||
| + | |||
| + | <trader num=1-20 skip_blocked_countries=true> | ||
| + | |||
| + | |||
| + | This slightly increases the load because for each hit you need to check what to output, on the other hand, it distributes traffic more correctly. | ||
| + | |||
| + | **Trader thumbs** | ||
| + | |||
| + | By default, trader thumbs are created in scj/top/tt (can be changed in settings) in the form trader.com.jpg. In fact, you don’t even need < | ||
| + | < | ||
| + | |||
| + | If you specified a trader URL by category, then the thumb name will be created using the pattern trader.com.CATEGORY_NAME.jpg, | ||
| + | |||
| + | ===== Trader CRC ===== | ||
| + | |||
| + | Option to hide a domain in a link, for example | ||
| + | |||
| + | < | ||
| + | <trader num=1-2> | ||
| + | <a | ||
| + | href=" | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | That means the domain will not be visible in the link. | ||
| + | ====== Rotation Settings ====== | ||
| + | |||
| + | All rotation settings are available in templates like | ||
| + | |||
| + | < | ||
| + | < | ||
| + | for example | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | Variable names can be seen in the admin panel in the field names (F12 in the browser) | ||
| + | |||
| + | |||
| + | ====== Default templates ====== | ||
| + | |||
| + | By default, the script has preset templates. In most cases, their names and descriptions are clear. | ||
| + | These templates are not deleted from the admin panel. so as not to delete anything accidentally. | ||
| + | |||
| + | content_single_item is a template for displaying a large image with a pixel galley on a separate page. | ||
| + | |||
| + | ====== Custom Templates ====== | ||
| + | |||
| + | You can add an unlimited number of your templates and call them using ? | ||
| + | |||
| + | For example, you want a separate design for your trd.com trader | ||
| + | First, we create the trd_personal template and in it we create a template specifically for this trader. | ||
| + | |||
| + | Here are some options on how you can do this. The meaning of all these operations is the same - pass the parameter force_template= | ||
| + | |||
| + | **1.** trader can send to URL http:// | ||
| + | |||
| + | **2.** you can create a file your_domain.com/ | ||
| < | < | ||
| <?php | <?php | ||
| - | $_GET[' | + | $_GET[' |
| include(' | include(' | ||
| </ | </ | ||
| + | and register this t.php as a personal page for the trader. | ||
| - | ====== Developer Mode ====== | + | **3.** in your_domain.com/ |
| - | Sometimes it's easier to edit template on FTP, not in admin. If you set Developer Mode ON - script will search in scj/ | + | < |
| + | after | ||
| + | <?php | ||
| + | add | ||
| + | if (strstr($_SERVER[' | ||
| + | ' | ||
| + | </ | ||
| - | ====== Cache ====== | ||
| - | Actually cache options are located under Rotation | + | ====== Custom gallery |
| + | By default, captcha is used to protect comments on custom galleries from spam. There is now a second option: < | ||
| + | This is useful because the smartcj.com forum used to get a lot of spam: standard captchas have long been solved automatically, | ||
| - | ====== | + | ====== |
| + | Tags are processed first, and PHP is executed afterward. For example, suppose you have the following markup: | ||
| - | - For version | + | <thumb num=1-5> |
| - | - Links should be like <a href="/ | + | < |
| - | - You can use old style formatting | + | </thumb> |
| - | format: < | + | This means it will first expand into |
| - | for example | + | |
| - | < | + | |
| + | < | ||
| + | slug1 <?php $count++; ?> | ||
| + | slug2 <?php $count++; ?> | ||
| + | slug3 <?php $count++; ?> | ||
| + | slug4 <?php $count++; ?> | ||
| + | slug5 <?php $count++; ?> | ||
| + | </ | ||
| - | | + | and only then will PHP be executed. |
| + | |||
| + | This also means that you can’t put PHP into the tag itself, for example | ||
| + | |||
| + | <thumb num=$my_var> | ||
| + | |||
| + | because tags are processed before PHP. | ||
| + | |||
| + | Data can be passed into a tag, for example from URL GET_ variables or predefined vars such as CURRENT_ITEM_... | ||
| + | ====== Global Custom Vars ====== | ||
| + | |||
| + | It is often convenient to have global replacements available in all templates, for example banner slots or link-exchange blocks. For that, use **Rotation - Tube - Tpl Custom Vars**. Variables added there are available in any template. For example, if you add **my_var1**, | ||
| + | |||
| + | A custom variable can also be translated for each language. | ||
| + | |||
| + | For example, you have a main language (in which you add content) and you have added as many languages as necessary in Rotation Settings - Multilingual. Now the variable < | ||
| + | |||
| + | **Mobile** | ||
| + | |||
| + | You can change a custom variable for mobile users by adding _MOBILE | ||
| + | |||
| + | For example, assume you have a template variable MY_VAR, which is output | ||
| + | |||
| + | |||
| + | |||
| + | **Translation** | ||
| + | |||
| + | You can quickly translate from the primary language to a secondary language. In **Translation [+]**, select which variables should be translated and specify the translation URL, for example: | ||
| + | |||
| + | < | ||
| + | external:: | ||
| + | ? | ||
| + | & | ||
| + | & | ||
| + | & | ||
| + | & | ||
| + | |||
| + | The default option is Google Translate. | ||
| + | |||
| + | Pay attention to these parameters: | ||
| + | |||
| + | & | ||
| + | api_key - API key from Google | ||
| + | |||
| + | You can replace Google with any translation service you prefer. | ||
| + | During translation, | ||
| + | and {TRANSLATION_LNG} with the target language name, | ||
| + | for example it. | ||
| + | </ | ||
| + | |||
| + | |||
| + | ====== Mobile templates and Mobile Custom Vars ====== | ||
| + | |||
| + | There are 3 main approaches to templates for mobile users. | ||
| + | |||
| + | Goal: display banner_1 on desktop and banner_2 on mobile. | ||
| + | |||
| + | |||
| + | **Option 0** | ||
| + | |||
| + | Hopefully this approach is no longer used, but for completeness: | ||
| + | |||
| + | If that banner appears on more than one page, editing it means touching every page manually. | ||
| + | |||
| + | |||
| + | |||
| + | **Option 1** | ||
| + | |||
| + | Create 2 custom variables, for example banner_1 (will be displayed as < | ||
| + | |||
| + | Create two templates, index and mobile_index, | ||
| + | |||
| + | This approach makes sense if your mobile template is radically different from the desktop one. | ||
| + | |||
| + | |||
| + | **Option 2** | ||
| + | |||
| + | Recommended approach: | ||
| + | |||
| + | Create two custom variables, for example banner (displayed as < | ||
| + | |||
| + | In the index template, add only < | ||
| + | |||
| + | This is the preferred approach because templates are generally expected to adapt to the device width. | ||
| + | ====== Developer mode ====== | ||
| + | |||
| + | Templates are stored in the database, but some users prefer editing them over FTP rather than through the admin panel. For that case, there is Developer Mode: you can upload a template to scj/ | ||
| + | |||
| + | After all the templates are configured, it makes sense to disable it so that the script does not do unnecessary checks = saving server resources. | ||
| + | |||
| + | |||
| + | |||
| + | ====== User Thumbs ====== | ||
| + | |||
| + | Often, many thumbs from one video are needed not for rotation and selecting the best thumb, but for thumb rolling, that is, when the picture changes as the user hovers over the thumb. In that case, there is usually not enough traffic to rotate so many thumbs, and storing every thumb in the database would only make it larger and heavier. When content is grabbed, the script can save user thumbs only to disk in / | ||
| + | |||
| + | For example, we decided that each gallery would have 10 thumbs for rolling | ||
| + | |||
| + | **Work options in this case:** | ||
| + | |||
| + | **1. if we have thumb ready, then we import it as** | ||
| + | |||
| + | video_url|thumbs|user_thumbs | ||
| + | |||
| + | thumbs are the thumbs that will take part in rotation and be stored in the database, while user_thumbs are downloaded and saved only to disk and are not added to the database. | ||
| + | |||
| + | |||
| + | we write in the template | ||
| + | |||
| + | < | ||
| + | < | ||
| + | src="// | ||
| + | ></ | ||
| + | |||
| + | < | ||
| + | var amount_of_rolling_thumbs = 10; | ||
| + | |||
| + | $(document).ready(function() { | ||
| + | $(" | ||
| + | $(this).attr(" | ||
| + | StartSlide($(this)); | ||
| + | }).mouseleave(function() { | ||
| + | $(this).attr(" | ||
| + | |||
| + | if ($(this).attr(" | ||
| + | $(this).attr(" | ||
| + | } | ||
| + | }); | ||
| + | }); | ||
| + | |||
| + | function StartSlide(thumb) { | ||
| + | if (!thumb.attr(" | ||
| + | return false; | ||
| + | } | ||
| + | |||
| + | if (!thumb.attr(" | ||
| + | thumb.attr(" | ||
| + | } | ||
| + | |||
| + | var cur = parseInt(thumb.attr(" | ||
| + | cur = (!cur || cur == 0) ? 1 : (cur + 1); | ||
| + | |||
| + | if (cur > amount_of_rolling_thumbs) { | ||
| + | cur = 1; | ||
| + | } | ||
| + | |||
| + | thumb.attr(" | ||
| + | |||
| + | var preload = new Image(); | ||
| + | preload.src = | ||
| + | thumb.attr(" | ||
| + | |||
| + | if (thumb.attr(" | ||
| + | setTimeout( | ||
| + | " | ||
| + | 700 | ||
| + | ); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | function ChangeSRC(id, | ||
| + | if (!$("#" | ||
| + | return false; | ||
| + | } | ||
| + | |||
| + | $("#" | ||
| + | StartSlide($("#" | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | <thumb num=1-10> | ||
| + | <a href='/ | ||
| + | <img | ||
| + | id=' | ||
| + | class=' | ||
| + | src='< | ||
| + | data-rolling-thumbs-folder='< | ||
| + | > | ||
| + | </a> < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | |||
| + | Note the data-rolling-thumbs-folder='< | ||
| + | |||
| + | |||
| + | |||
| + | **2. if our thumbs are cut from videos** | ||
| + | |||
| + | |||
| + | Add it as video_url and enable the Make screenshots option. The script will download the video and make screenshots in the amount specified by How Many Thumbs from each gallery?. Then go to Preload, where you will see the thumbs cut from that video. Mark the thumbs that should be added to rotation and enable Add Unchecked as User Thumbs. The checked thumbs will be added to rotation and stored in the database, while all thumbs will also be saved as User Thumbs on disk only. They can then be used for thumb rolling with the same script shown in point 1. | ||
| + | |||
| + | ====== | ||
| + | |||
| + | How the template system works, for advanced users. | ||
| + | |||
| + | < | ||
| + | model page /? | ||
| + | |||
| + | Some pages have a default template assigned. For example: | ||
| + | |||
| + | category page /? | ||
| + | |||
| + | although template is not specified here, | ||
| + | the content_list template will be used, | ||
| + | but you can also specify your own, for example | ||
| + | |||
| + | /? | ||
| + | </code> | ||
| + | |||
| + | Thus, you can generate any URL and any templates using rewrite. | ||
| + | |||
| + | |||
| + | Template parsing happens in two steps: first the script macros are replaced, for example | ||
| + | |||
| + | Be careful with your own PHP code so you do not introduce security holes. For example, suppose you output a URL parameter with < | ||
| + | |||
| + | Now imagine the user passes not 123 but something like & | ||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | |||
| + | **Custom galleries** - by default, all content from the source gallery is grabbed, although during grabbing you can also limit it to a specific content type such as pictures, movies, or flash. The parser checks what content is available. If there is only one type of content, the appropriate template is assigned automatically, | ||
| + | |||
| + | When adding content, you can force a specific template. Usually this is unnecessary, | ||
| + | |||
| + | Basic parameters in the script | ||
| + | |||
| + | < | ||
| + | /? | ||
| + | page=... | ||
| + | order= (ctr - default, date, duration) | ||
| + | force_template | ||
| + | slug= slug gallery | ||
| + | sponsor_slug= | ||
| + | model_slug= | ||
| + | search= | ||
| + | date_start= , date_end= | ||
| + | and predefined dates date_limit=today, | ||
| + | </ | ||
| + | |||
| + | |||
| + | ====== | ||
| + | |||
| + | In the rotation settings there is an option "URLs with 0 result thumbs return 404 (content_not_found)" | ||
| + | |||
| + | If a user searches on the site and gets 0 results, then strictly speaking the page could return 404. In practice, people usually prefer a normal page saying “nothing was found for your search”, so the script was originally written not to apply this option on search pages (content_search). | ||
| + | |||
| + | But if suddenly you need to rewrite this behavior, then you need to use **zero_items_return_404=true** , for example | ||
| + | |||
| + | <thumb num=1-180 zero_items_return_404=true> | ||
| + | |||
| + | |||
| + | ====== | ||
| + | |||
| + | Especially for PHP templates, there is a global variable $GLOBALS[' | ||
| + | |||
| + | < | ||
| + | <?php | ||
| + | |||
| + | if ($GLOBALS[' | ||
| + | |||
| + | print_r($GLOBALS[' | ||
| + | |||
| + | } | ||
| + | </ | ||
| + | |||
| + | |||
| + | ====== Page track ====== | ||
| + | |||
| + | You can track which page traffic comes to and what transitions there are on the site. | ||
| + | |||
| + | In Trade - Statistics - Page Track there are 2 columns: Inbound Views (if the ref is not our site) and Local Views (if the ref is our site) | ||
| + | |||
| + | There are 2 options | ||
| + | |||
| + | 1. & | ||
| + | |||
| + | 2. in the template tag < | ||
| + | |||
| + | For example | ||
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
| + | | ||
new_rotation_templates.1706694320.txt.gz · Last modified: by admin
