Difference between revisions of "Nats display adtools"
TmmStephen (talk | contribs) |
|||
(7 intermediate revisions by 4 users not shown) | |||
Line 22: | Line 22: | ||
! Example | ! Example | ||
|- | |- | ||
− | | category | + | | '''category''' |
| The category id of the adtool | | The category id of the adtool | ||
| Any valid category id | | Any valid category id | ||
Line 40: | Line 40: | ||
| assign_prefix="myvar" | | assign_prefix="myvar" | ||
|- | |- | ||
− | | typeid | + | |'''typeid''' |
| The type of adtool | | The type of adtool | ||
| Any valid adtool type ID number | | Any valid adtool type ID number | ||
Line 51: | Line 51: | ||
| ''None'' | | ''None'' | ||
| siteid="123" | | siteid="123" | ||
+ | |- | ||
+ | | '''programid''' | ||
+ | | Only show adtools for one program | ||
+ | | Any valid program ID number | ||
+ | | ''None'' | ||
+ | | programid="1" | ||
|- | |- | ||
| start | | start | ||
Line 68: | Line 74: | ||
| Any valid order statement | | Any valid order statement | ||
| ''None.'' (No prefix is used) | | ''None.'' (No prefix is used) | ||
− | | | + | | order="published_date ASC" |
|- | |- | ||
| [[assign_prefix]] | | [[assign_prefix]] | ||
Line 74: | Line 80: | ||
| Any valid Smarty variable name | | Any valid Smarty variable name | ||
| None | | None | ||
− | | | + | | assign_prefix="myvar" |
|- | |- | ||
| [[data_only]] | | [[data_only]] | ||
Line 112: | Line 118: | ||
=== search_{$field} === | === search_{$field} === | ||
+ | '''NOTE: If you wish to use the search_ parameters, you will need to include "searchinline=1" in your list of parameters''' | ||
+ | |||
The available values for {$field} are dependent on the adtool type being searched for. | The available values for {$field} are dependent on the adtool type being searched for. | ||
for instance, FHGs have a 'type' field, with the possible values 1(pictures) 2(videos) 3(mixed) . | for instance, FHGs have a 'type' field, with the possible values 1(pictures) 2(videos) 3(mixed) . | ||
Line 171: | Line 179: | ||
<pre> | <pre> | ||
− | {display_adtools category=2 typeid=2 siteid=1} | + | {display_adtools category=2 typeid=2 siteid=1 programid=1} |
</pre> | </pre> | ||
Line 179: | Line 187: | ||
<pre> | <pre> | ||
− | {display_adtools category=2 typeid=2 siteid=1 data_only=1} | + | {display_adtools category=2 typeid=2 siteid=1 programid=1 data_only=1} |
{foreach from=$adtools item=tool key=adid name=ads} | {foreach from=$adtools item=tool key=adid name=ads} | ||
{$tool.url} | {$tool.url} | ||
Line 188: | Line 196: | ||
<pre> | <pre> | ||
− | {display_adtools category=2 siteid="2" typeid="2" data_only=1} | + | {display_adtools category=2 siteid="2" programid="1" typeid="2" data_only=1} |
{foreach from=$adtools item=tool key=adid name=ads} | {foreach from=$adtools item=tool key=adid name=ads} | ||
{nats_encode adtoolid=$adid siteid="2" programid=1} | {nats_encode adtoolid=$adid siteid="2" programid=1} | ||
Line 195: | Line 203: | ||
</pre> | </pre> | ||
− | Note that we include a separate NATS function {nats_encode} to generate the nats code needed | + | Note that we include a separate NATS function [[Nats encode|{nats_encode}]] to generate the nats code needed. {nats_endcode} will need the siteid and the program ID to generate a correct NATS code. |
Lastly, if you would like to display the adtool track link so that when members go through the link that hit is counted, you can use the following. | Lastly, if you would like to display the adtool track link so that when members go through the link that hit is counted, you can use the following. | ||
<pre> | <pre> | ||
− | {display_adtools category=2 siteid="2" typeid="2" data_only=1} | + | {display_adtools category=2 siteid="2" programid="1" typeid="2" data_only=1} |
{foreach from=$adtools item=tool key=adid name=ads} | {foreach from=$adtools item=tool key=adid name=ads} | ||
{nats_encode adtoolid=$adid siteid="2" url=1 gallery_url=$tool.url} | {nats_encode adtoolid=$adid siteid="2" url=1 gallery_url=$tool.url} | ||
Line 208: | Line 216: | ||
This code will display the gallery track link for each FHG adtool based upon the criteria set in both the {display_adtools} and {nats_encode} functions. | This code will display the gallery track link for each FHG adtool based upon the criteria set in both the {display_adtools} and {nats_encode} functions. | ||
− | |||
== See Also == | == See Also == | ||
* [[New NATS4 Affiliate Adtools]] -- NATS4 Adtools Page uses this function | * [[New NATS4 Affiliate Adtools]] -- NATS4 Adtools Page uses this function | ||
+ | |||
+ | [[Category:NATS4 Template Functions]] |
Latest revision as of 19:21, 29 May 2013
Applies to NATS 4.0.25 and greater.
searchinline feature applies to NATS 4.0.66 and greater.
nats_display_adtools
Displays adtools with a particular type ID number.
Alias: display_adtools
Parameters
(Required parameters in bold)
Parameter | Description | Possible Values | Default Value | Example |
---|---|---|---|---|
category | The category id of the adtool | Any valid category id | The category ID from the request | category=1 |
tpl | Template used to display output | Any valid template | The template, function_display_adtools | tpl="mytemplate" |
assign_prefix | Prefix output variable names with this word | Any valid Smarty variable name | Empty | assign_prefix="myvar" |
typeid | The type of adtool | Any valid adtool type ID number | The type ID from the request | typeid="123" |
siteid | Only show adtools for one site | Any valid site ID number | None | siteid="123" |
programid | Only show adtools for one program | Any valid program ID number | None | programid="1" |
start | Skip this many adtools | Any whole number greater than, or equal to, zero | 0. Skips no adtools | start="10" |
count | Display this many adtools | Any whole number greater than zero | 20. Displays 20 adtools | count="10" |
order | Set the order the adtools will be returned | Any valid order statement | None. (No prefix is used) | order="published_date ASC" |
assign_prefix | Prefix output variables with this word. (Click link for details) | Any valid Smarty variable name | None | assign_prefix="myvar" |
data_only | Set variables but don't display the template | 1 | None. The template is displayed. | data_only=1 |
searchinline | Allows searching through params | 1 or 0 (exclusive) | 0 do not check params for search vars | searchinline=1 |
search_{field} | limitation when using searchinline | {search_setting}:{setting} (see below) | none | search_type = '5:2' |
Output
A list of adtools matching an adtool type ID number. Also outputs several variables; variables are prefixed with the argument to the assign_prefix parameter described above.
- .type
- .type_details
- .field_assoc
- .adtools
- .adcount
- .typeid
- .start
- .count
Notes
search_{$field}
NOTE: If you wish to use the search_ parameters, you will need to include "searchinline=1" in your list of parameters
The available values for {$field} are dependent on the adtool type being searched for. for instance, FHGs have a 'type' field, with the possible values 1(pictures) 2(videos) 3(mixed) .
search_type = '5:2'
Is a limit on this type field. 5 means = (see below) and 2 is the value we are limiting to. This returns any adtools adtoolfield type=2 For FHGs, this means videos.
search_type = '4:2'
Would search for adtools with type <= 2. For FHGs that returns pictures and videos (but not mixed).
search_width = '1:50'
Searches for an adtools with width > 50
You can get the exact field names and possible values from the adtools admin (edit type) or by doing a search on the affiliate side and using the search[] variables from the resulting URL.
Default Categories
Category | Name |
1 | Banners |
2 | Hosted Adtools ( FHGs ) |
3 | Downloadable ( content zips ) |
Search Settings
Setting | Value |
1 | > |
2 | >= |
3 | < |
4 | <= |
5 | = |
6 | != |
Using {display_adtools} to display adtools in an Email
As an example, if you are looking to send all FHGs out in an email through the NATS 4 Mailing admin you can do the following:
{display_adtools category=2 typeid=2 siteid=1 programid=1}
This will display adtools found in NATS displayed under the criteria of Category 2, Typeid 2, and Siteid 1. The information will be displayed according to what is set in the "function_display_adtools" template.
By adding "data_only=1" to the function call, the template is not used and you can display any information found in $adtools array of information. The following code uses a smarty foreach loop to loop through the $adtools array and list out the URL of all adtools.
{display_adtools category=2 typeid=2 siteid=1 programid=1 data_only=1} {foreach from=$adtools item=tool key=adid name=ads} {$tool.url} {/foreach}
If you would like to display the link with a trailing nats code, the following code will do just that,
{display_adtools category=2 siteid="2" programid="1" typeid="2" data_only=1} {foreach from=$adtools item=tool key=adid name=ads} {nats_encode adtoolid=$adid siteid="2" programid=1} {$tool.url}?nats={$encoded} {/foreach}
Note that we include a separate NATS function {nats_encode} to generate the nats code needed. {nats_endcode} will need the siteid and the program ID to generate a correct NATS code.
Lastly, if you would like to display the adtool track link so that when members go through the link that hit is counted, you can use the following.
{display_adtools category=2 siteid="2" programid="1" typeid="2" data_only=1} {foreach from=$adtools item=tool key=adid name=ads} {nats_encode adtoolid=$adid siteid="2" url=1 gallery_url=$tool.url} {$encoded} {/foreach}
This code will display the gallery track link for each FHG adtool based upon the criteria set in both the {display_adtools} and {nats_encode} functions.
See Also
- New NATS4 Affiliate Adtools -- NATS4 Adtools Page uses this function