Nats fhg (NATS3)
fhg retrieves a listing of your hosted ad tools you can use in NATS emails to your affiliates. Only the free hosted ad tools available to a particular affiliate are sent to that affiliate.
Example
{fhg siteid="2, 4-6, 9-13" added_before="april" added_after="2007-10-14" not_adid="250-344"}
The example above retrieves information about all hosted adtools added before April of this year -- but after 10 October 2007. The output is further restricted to ad tools that belong to any of the following sites: 2, 4, 5, 6, 9, 10, 11, 12, or 13. Also, any ad tool with an adid between 250-344 will be excluded from the results. If you use the Build Your Anything Module (BYOA), this function also considers whether or not the affiliate is authorized to see that particular ad tool.
Parameters
All parameters are optional.
- siteid = any comma separated numeric list, ranges okay (examples: "1, 2, 7" or "2-5, 23")
- not_siteid = any comma separated numeric list, ranges okay (examples: "1, 2, 7" or "2-5, 23")
- url = any partial or complete URL
- name = any part of the name of the adtool
- added_before = any PHP valid date format
- added_after = any PHP valid date format
- group = comma separated list, no ranges
- not_group = comma separated list, no ranges
- adid = any comma separated numeric list, ranges okay (examples: "1, 2, 7" or "2-5, 23")
- not_adid = any comma separated numeric list, ranges okay (examples: "1, 2, 7" or "2-5, 23")
- type = any comma separated numeric list, ranges okay (examples: "1, 2, 7" or "2-5, 23")
- The following numbers represent the following types:
- 1 = Gallery (Pics)
- 2 = Gallery (Movies)
- 3 = Free Site
- 4 = Console
- 5 = GB Template (Pics)
- 6 = GB Template (Movies)
- 7 = (reserved for future use)
- 8 = Gallery (Mixed)
- not_type = any comma separated numeric list, ranges okay (examples: "1, 2, 7" or "2-5, 23") (see above for further explanation)
- thumb2 = filter by second thumb field. comma separated list, no ranges
- not_thumb2 = exclude by second thumb field. comma separated list, no ranges
- thumb3 = filter by third thumb field. comma separated list, no ranges
- not_thumb3 = exclude by third thumb field. comma separated list, no ranges
- thumb4 = filter by fourth thumb field. comma separated list, no ranges
- not_thumb4 = exclude by fourth thumb field. comma separated list, no ranges
- thumb5 = filter by fifth thumb field. comma separated list, no ranges
- not_thumb5 = exclude by fifth thumb field. comma separated list, no ranges
- desc2 = filter by second description field. comma separated list, no ranges
- not_desc2 = exclude by second description field. comma separated list, no ranges
- desc3 = filter by third description field. comma separated list, no ranges
- not_desc3 = exclude by third description field. comma separated list, no ranges
- desc4 = filter by fourth description field. comma separated list, no ranges
- not_desc4 = exclude by fourth description field. comma separated list, no ranges
- desc5 = filter by fifth description field. comma separated list, no ranges
- not_desc5 = exclude by fifth description field. comma separated list, no ranges
- num = limit by the number of items in the gallery. comma separated list of numeric values, ranges okay
- order_by = a comma separated list of any of the following values: (siteid, type, date_added, id, url, num, thumb, name, groups). For each entry in the list, the format is the field to sort by followed by a space and either the words ASC or DESC, to indicate ascending or descending. (example: order_by="siteid ASC, groups DESC")
Output
$fhg = an array of adtools, each with the following sub-fields:
- id - the adid of the adtool
- date_added - the date the adtool was added
- url - the URL of the FHG itself
- type - the type number of the hosted adtool
- num - the number of clips in the gallery
- thumb - the thumbnail url of the adtool
- name - the primary name of the adtool
- groups - the group the adtool belongs in
- description - an extended description of the adtool
- byo_owner - the owner's loginid (only applies to BYOA module)
- byo_program - the program the BYOA adtool belongs to (only applies to BYOA module)
- byo_owner_only - flag that indicates only the BYOA owner can use this adtool
- desc2 - a second description of the adtool
- desc3 - third description of the adtool
- desc4 - fourth description of the adtool
- desc5 - fifth description of the adtool
- thumb2 - a second thumbnail for the adtool
- thumb3 - a third thumbnail for the adtool
- thumb4 - a fourth thumbnail for the adtool
- thumb5 - a fifth thumbnail for the adtool
- siteid - the site this adtool belongs to
Example
To get the URL of the fifth adtool retrieved by the function, put {$fhg[4].url} in your template.
Extended Example
This code is tabulated to show the flow of the code; if sending text emails, you'll want to remove the tabulation.
Variables in this example:
- $program the id of the program you want to be used in affiliate link codes
- $sitelist a comma-delimited list of each site you want to show fhgs for
For each of the sites chosen, this code will show first picture galleries, then movie galleries. For each gallery, it will show the date it was added, and the url (with the affiliate's nats code attached).
{assign var=program value=1} {*program to use for reseller link codes*} {assign var=sitelist value="1,2,3,4"}{*sites to show*} {assign var=sites value=$sitelist|explode:','} {foreach from=$sites item=site} {fhg siteid=$site type="1"} {*site $site, picture galleries*} {if $fhg && $fhg|@count} Picture Galleries {foreach item=gallery from=$fhg} {$gallery.date_added} {$gallery.url}?nats={$nats_code[$program][$site]} {/foreach} {/if} {fhg siteid=$site type="2"} {*site $site, movie galleries*} {if $fhg && $fhg|@count} Movie Galleries {foreach item=gallery from=$fhg} {$gallery.date_added} {$gallery.url}?nats={$nats_code[$program][$site]} {/foreach} {/if} {/foreach}