Paypal donate example

Re: Adding a PayPal donate button

Alternatively, you can do this:

In Page_Controller class, add this:


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

 

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


These two functions allow you to enter $Paypal anywhere in the content editors within the CMS. It gives more flexibility instead of being dumped directly into the templates, if for example, you wanted the paypal button to come between 2 paragraphs of content.

 

It just string replaces $Paypal with the HTML of the PayPal html. It works for anything really, including adverts if you wanted to throw them straight into the content (separate from the templates). Ideally it's good for little 'snippets' of external html or javascript.

$PayPalForm can be called in the templates, as well as in the content editor (WYSIYWG editor in the SS CMS).

Hope this helps!

Sean

 

Last edited: 14 August 2007 at 5:37pm