nats_list_linkcodes

Prints a list of linkcodes matching a query.

Article Topics: Smarty, Customization

To create a single linkcode, please see the nats_encode article.

Parameters

(Required parameters in bold)

Parameter
Description
Possible Values
Default Value
Example

tpl

Template used to display output

Any valid template

The template, function_list_linkcodes

tpl="mytemplate"

code_only

Displays the linkcode as either a complete or relative URL

0 or 1 (exclusive)

0: displays entire URL

code_only="1"

campaigns

Return only linkcodes available to a list of campaigns. If set, ignores campaign and use_default_campaign below

An array reference (see Notes section below)

None.

campaigns="$my_array"

campaign

Return only linkcodes available to a single campaign. If set, ignores use_default_campaign below

Any valid campaign number

The user's current default campaign

campaign="123"

use_default_campaign

Return only linkcodes available to the database's stored default campaign for the current user. (See notes for arguments, campaign and campaigns, above)

0 or 1 (exclusive)

None.

use_default_campaign="1"

userid

The user ID number to get the default campaign from

Any valid user ID number

The currently logged in user.

userid="123"

programs

Return only linkcodes available to a list of programs If set, ignores program below

An array reference (see Notes section below)

None.

programs="$my_array"

program

Returns only linkcodes available to a single program. If set, ignores use_default_program below

Any valid program ID number

The user's default program

program="123"

use_default_program

Returns only linkcodes available to the database's stored default program for the current user. (See notes for arguments, program and programs, above)

0 or 1 (exclusive)

None. The default in program will apply (see program above)

use_default_campaign="1"

sites

Return only linkcodes available to a list of sites. If set, ignores site and use_default_site below

An array reference (see Notes section below)

None.

sites="$my_array"

site

Return only linkcodes available to a particular site. If set, ignores use_default_site below

Any valid site ID number

The user's default site

site="123"

use_default_site

Returns only linkcodes available to the database's stored default site for current user. (See notes for arguments site and sites, above)

0 or 1 (exclusive)

None. The default site will apply (see site above)

use_default_site="1"

tour

Return only linkcodes available to a particular tour. (See note in tours below)

Any valid tour ID number

All tours unless tours, below, is used

tour="123"

tours

Return only linkcodes available to a list of tours. If set, overwrites tour above

An array reference (see Notes section below)

All tours unless tour, above, is used

tours="$my_array"

adtool

Return only linkcodes available to a particular adtool. (See note in adtools below)

Any valid adtool ID number

All adtools unless adtools, below, is used

adtool="123"

adtools

Return only linkcodes available to a list of adtools. If set, overwrites adtool above

An array reference (see Notes section below)

All adtools unless adtool, above, is used

adtools="$my_array"

subid1

Return only linkcodes available to a particular first subid (See note in subids1 below)

Any valid first sub ID number

All first subids unless subids1, below, is used

subid1="123"

subids1

Return only linkcodes available to a list of first subids If set, overwrites subid1 above

An array reference (see Notes section below)

All subids unless subid1, above, is used

subids1="$my_array"

subid2

Return only linkcodes available to a particular second subid. (See note in subids2 below)

Any valid second sub ID number

All second subids unless subid2, below, is used

subid2="123"

subids2

Return only linkcodes available to a list of second subids. If set, overwrites subid2 above

An array reference (see Notes section below)

All second subids unless subid2, above, is used

subids2="$my_array"

count

Max number of linkcodes to display

Any whole number greater than zero

None. Displays all matching linkcodes

count="10"

Prefix output variables with this word. (Click link for details)

Any valid Smarty variable name

None. (No prefix is used)

assign_prefix="myvar"

Set variables but don't display the template

1

None. The template is displayed.

data_only=1

show_hidden

Show link codes for hidden sites.

0 or 1 (exclusive)

None. Do not show hidden sites

show_hidden="1"

order

Change the ordering of the link codes returned by the template function

(see Notes section below)

s.name, t.name

order="s.name, t.name"

Output

By default, displays a list of link codes using the template function_list_linkcodes. and places the linkcodes in the {$linkcodes} array. The linkcodes array contains six associatives:

  1. program I.D.

  2. site I.D.

  3. tour I.D.

  4. adtool I.D.

  5. sub I.D #1

  6. sub I.D. #2

Each linkcode will always have a program I.D., site I.D., and tour I.D.; they may have adtool and sub I.D.s. For example, the following variable contains the linkcode for the program one, site two, and tour three:

{$linkcodes.1.2.3.0.0.0}

Examples

Listing Linkcodes in an Email

Each affiliateAffiliate that receives an email with the following function call will get their linkcodes for the program and site you specify.

{nats_list_linkcodes userid=$loginid data_only=1 program=program_number site=site_number}

Replace program_number with the program I.D. number. Replace site_number with the site I.D. number.

Each affiliate that receives an email with the following text and Smarty code will get the link to the tour with their natscode embedded in the URL:

URL?nats={nats_list_linkcodes userid=$toid program=program_number site=site_number 
  tour=tour_number data_only=1 code_only=1}{$linkcodes.program_number.site_number.tour_number.0.0.0}

Replace URL with the URL to the tour. Replace program_number with the program I.D. number. Replace site_number with the site I.D. number. Replace tour_number with the tour I.D. number. For a tour on example.com/tour, program number one, site number two, and tour number three, the code looks like:

http://example.com/tour?nats={nats_list_linkcodes userid=$toid program=1 site=2 tour=3 data_only=1 code_only=1}{$linkcodes.1.2.3.0.0.0}

Notes

Please Note: If you are looking to add a NATS code to Ad Tool links in an e-mail then we recommend using the nats_encode template function.

(To create a single linkcode, please see the nats_encode page.)

To make an array reference, create the array using the nats_add_to_array function.

You can order the link codes by site, tour and program. You can select which fields you wish to order by based on the columns available within the database table. To order by a column within the site table, you must prefix the column with 's.' (Example: order="s.siteid"). To order by the tour table, you must prefix the column with 't.' and the program table by 'p.'.

See Also

nats_encode

Last updated

Was this helpful?