NATS4 Custom Program and Campaign Selection Pages
New pages in NATS can let affiliates select a program, campaign and site and provide the corresponding NATS link code. They will act similar to the the adtools page or linkcodes page. Use the following template functions to configure the pages.
{list_campaigns}
For more details, see the nats_list_campaigns article.
Returns a set of campaigns in the {$campaign} variable that you can use to build a drop down box. For example:
{list_campaigns} <select name="campaignid">{html_options options=$campaign}</select>
{list_programs}
For more details, see the nats_list_programs article.
Return a set of programs for the affiliate in into the {$programs} variable that you can use to build a drop down box. For example:
{list_programs} <select name="programid">{html_options options=$programs}</select>
{list_sites program=$smarty.request.programid}
For more details, see the nats_list_sites article.
Wants the numeric ID number of a program be passed to the program parameter. Returns the variable, {$sites}, with a set of sites in that program. You can loop through sites with the following example code.
{list_sites program=$smarty.request.programid} {foreach from=$sites item="site"} {$site.id} :: {$site.name} {/foreach}
{nats_encode campaignid=$smarty.request.campaignid programid=$smarty.request.programid siteid=$site.id}
For more details, see the nats_encode article.
Wants three parameters: campaignid, programid and siteid. Returns the encoded NATS link code in the {$encoded} variable.
Example
A sample template using all three template functions:
<form method="get" action="internal.php"> <input type="hidden" name="page" value="thispage"> {list_campaigns} Select Campaign: <select name="campaignid">{html_options options=$campaign}</select> <input type="submit" value=" Go "> </form> {if $smarty.request.campaignid} <form method="get" action="internal.php"> <input type="hidden" name="page" value="thispage"> <input type="hidden" name="campaignid" value="{$smarty.request.campaignid}"> {list_programs} Select Programid: <select name="programid">{html_options options=$programs}</select> <input type="submit" value=" Go "> </form> {if $smarty.request.programid} {list_sites program=$smarty.request.programid} {foreach from=$sites item="site"} {nats_encode programid=$smarty.request.programid siteid=$site.id campaignid=$smarty.request.campaignid} {$site.id} :: {$site.name} :: {$encoded} {/foreach} {/if} {/if}
The NATS linkcode code is inside the {foreach} ... {/foreach} loop; change the code to display the linkcode however you'd like.