Template Array Variable

From TMM Wiki
Revision as of 13:24, 19 December 2008 by Trinidadr (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
NATS 3
Skins & Templates Admin
Smarty Plugins
Skins
Editing Skins
Creating Skins
Switching Skins
Templates
nats_code
Affiliate Stats Template
Affiliate Support Template
Affiliate Login Template
custom errors.php
Template Array Variable
Detailed Stats
NATS Variables
Dialer Statistics
Affiliate Signup
Post URL Variables
Member Usernames & Passwords
Output An Affiliate's Last Paid Date
Custom Program and Campaign Selection Pages
CAPTCHA Removal
Username Recommendations
Password Retrieval
Post-Biller Templates
Geo-Target Join Options
Template Caching
Random Usernames and Passwords
Base Templates
Protecting Template Data
Mail Reseller Signup Template Variable Names
Smarty
Smarty print array
News Section Templating
Affiliate Signup Email
Getting The NATSCode
Checking for Usernames on All Sites
Adding Stats to Affiliate Pages
Affiliate Join Page Linkcodes

There are numerous arrays used in the NATS templates. If you want to display or use only one record in the array you can set it up like this:

In the template place this code:

{include_php file="../includes/getvariable.php"}
{$myVariable}

Replace getvariable.php and $myVariable with a names you'll remember.

On your server, go into the includes directory of NATS, create the getvariable.php script, and input the following code:

<?
$myVar = $this->get_template_vars('smarty array');
$this->assign('myVariable', $myVar['key of array']);
?>

Replace smarty array with the name of the array you want to get variables from; replace array key with the name of the array element you want to use in your variable.

Example

You can use the following code to automatically place the default campaign on the members_codes template.

Add the following to the members_codes template:

{include_php file="../includes/get_campaign_id.php"}
{$myCampaign}

Add the following to the includes/get_campaign_id.php file:

<?
$myCamp = array_flip($this->get_template_vars('campaigns'));
$this->assign('myCampaign', $myCamp['Default']);
?>