Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Adding a PayPal donate button


Go to End
Reply


12 Posts   4969 Views

Avatar
Briohny

Community Member, 199 Posts

7 October 2008 at 3:37am

Edited: 07/10/2008 3:37am

What about if you have different paypal buttons? i.e. buttons with different payment amounts.

I thought that perhaps the following code would work, but it didn't. :(

function Content() {
   return str_replace('$PayPal1', $this->PayPal1(), $this->Content);
   return str_replace('$PayPal2', $this->PayPal2(), $this->Content);
   }

   function PayPal1() {
   return 'replace me with paypal form html here!';
   }
   
   function PayPal2() {
   return 'replace me with paypal form html here!';
}

Any thoughts?

Avatar
Briohny

Community Member, 199 Posts

11 October 2008 at 2:57am

bump bump :)

Any ideas anyone? I just want to be able to have a few different paypal buttons throughout the site.

Cheers,
Briohny

Avatar
banal

Community Member, 901 Posts

11 October 2008 at 3:26am

@Briohny
A "return" statement always leaves the method. That means your custom Content() method will finish after the first return statement.

You should write something like that:

function Content() {
$tmp = str_replace('$PayPal1', $this->PayPal1(), $this->Content);
return str_replace('$PayPal2', $this->PayPal2(), $tmp);
}

Avatar
Briohny

Community Member, 199 Posts

12 October 2008 at 12:29am

Edited: 12/10/2008 12:39am

Thanks that worked for two different buttons... what if i have more buttons though?

Go to Top