0

I'm trying to use smarty but I want to know how can I convert this php code to smarty code :s, thanks

<?php
    include_once("paypalewp.php");
    $paypal = new paypalewp();
    $paypal->setTempFileDirectory("/tmp");
    $paypal->setCertificate("my-pubcert.pem", "my-prvkey.pem");
    $paypal->setCertificateID("DFGY7654567");
    $paypal->setPayPalCertificate("paypal_cert_pem.txt");
    $parameters = array(
        "cmd" => "_xclick",
        "item_name" => "$item",
        "currency_code" => "USD",
    );
    $encryptedButton = $paypal->encryptButton($parameters);
    echo $encryptedButton; 
?>

I hope you can help me.

1
  • 3
    What do you mean "convert this php to smarty"? Smarty is a templating engine, and your current code is all backend stuff. Commented Mar 28, 2012 at 21:35

1 Answer 1

3

This code should not be put into a Smarty template at all.

You should be assigning $encryptedButton to a Smarty variable for display in your template ($smarty->assign('encryptedButton', $encryptedButton);), but the rest of the code should be good old regular PHP in a non-Smarty file.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, but what if i want to loop this?
Make $encryptedButton an array and pass it to the template.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.