PDA

View Full Version : Not passing variables?



Joel
01-27-07, 01:58 PM
Ok, this seems to be a Smarty/PHP problem. It's driving me nuts.

I've got a custom page that is called from the account details page. In the custom.php, I'm setting the variables like this:


$details['test'] = "Testing";
$details['id'] = $_POST['id'];
$details['domain'] = $_POST['domainname'];
$smarty->assign('details', $details);

If I do a print_r on $details right here, all the data is there. But...

In my custom.tpl, I have this:




{$details.id}</p>


{$details.test}</p>


{$details.domain}</p>

Only $details.test is displayed. When I load the page in my browser, all I get is "Testing".

Debug shows this:


Array (3)
test => Testing
id => empty
domain => empty




What am I missing here? It's probably something simple, right?

welch
01-27-07, 08:11 PM
From what I understand, you are pulling the template / smarty variables to the custom.php page.

global $variables;
$var1 = $variables->get_template_vars('var1');
$var2 = $variables->get_template_vars('var2');

Joel
01-29-07, 10:56 AM
Thanks, but that's not what I'm looking for.

I'm using POST to send the ID & domain name to my custom.php. And it gets there just fine. I can manipulate the vales within custom.php.

The problem is that when I assign those values to a new variable, they don't make it to the custom.tpl. Also, the following command returns false for some reason:

isset($_POST['id'])

Again, I can echo (or print) the POST data, but it never reaches the custom.tpl.

By the way, this works if I switch from POST to GET. But I'd rather not do that.

Matt
01-29-07, 11:32 AM
I can't see any errors in your code so not sure why it wouldn't be working. Maybe try posting about the issue on the Smarty forums?