acctman
acctman

Reputation: 4349

Can't echo variable

I'm thinking it's the smarty templates setup that is preventing me from echo'ing the $setlnk variable elsewhere on the page. Or, am i'm doing something else wrong. Is there another method I could use?

<?php
$setlnk = "<img src='/files/pvtexp.php?mid=" . $set[2] . "&iid=" . $set[3] . "&idat=" . $set[4] . "/" . $set[5] . "&sec=" . $set[6] . "'>";       

echo $setlnk; // works
?>

..... html code

<?=$setlnk;?> // doesn't work
<?php echo $setlnk; ?> // doesn't work

Upvotes: 0

Views: 461

Answers (1)

Zathrus Writer
Zathrus Writer

Reputation: 4331

if this is a smarty template, you need to do the following:

  • PHP file: $template->assign('setlnk', $setlnk); // template is the SMARTY template object
  • TPL file (smarty template): {$setlnk}

Upvotes: 2

Related Questions