This is not a duplicate question, I couldn't solve my issue using answers from the other threads, besides my problem is different.
I'm trying to print a URL with an appended parameter using PHP in a Smarty plugin function. The software I use is WHMCS.
Below is a sample code of my function:
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.aff.php
* Type: function
* Name: aff
* Purpose: outputs a random magic answer
* -------------------------------------------------------------
*/
function smarty_function_aff($params, &$smarty)
{
$affiliateid = $params['affiliateid'];
$refflink = 'http://example.com/aff.php?aff=' . $affiliateid .'';
print $refflink;
}
?>
In the template file, I use {aff} that supposed to print the whole URL including the appended parameter, however it prints the URL like that: http://example.com/aff.php?aff= as if the $affiliateid variable does not exist.
Now if I used the following ($affiliateid} directly in the template file, it will output the user affiliate ID. But I need to use it in the PHP function above. Writing it directly in PHP as $affiliateid doesn't seem to work.
What I'm missing here? Any suggestions please? Thank you.