Sitelok php button

This might be really simple or just not doable.
I just started using sitelok on my site. Im trying to add a sitelok - Stripe button to my RW page.
The code provided is this…

<?php echo sl_get_stripe_button(array("pid"=>"AllAccessY","objid"=>"OBJECTID","page"=>"autoregister","bill_address"=>"","bill_city"=>"","bill_state"=>"","bill_zip"=>"","bill_country"=>"")); ?>

When I add this to an html stack or as piece of code in the body this appears when the page is published…

Fatal error: Call to undefined function sl_get_stripe_button() in /private/var/folders/gk/h23smb_x73sg7g0z6grs7fsr0000gp/T/com.realmacsoftware.rapidweaver/RapidWeaver/3253/document-0x6000003fe800/RWDocumentPagePreview/register.php on line 196

When I add the code to the PHP page with a text editor and upload the button works.

Is there s simple way to add the code in RW?

Drew: I’m guessing a little bit because I don’t use the Stripe button. But I use Sitelok all the time. All my code is placed either in the Prefix section of the HTML Code area (see Page Inspector) or sometimes with something like the Disqus plugin with Sitelok there’s a portion I additionally put in the Head section.

My guess is your entire code goes in the Prefix section.

Unfortunately that doesn’t work. I get the same error when I add it in prefix head or body.

Did you actually publish the page? Some php won’t show in preview.
Is the page set to php?

I don’t use siteLok, but from a PHP perspective, you are using a function that does not exist. Do you need to add something like a
require_once()
With a sitelok library in the ()?
Perhaps @vibralogix can explain.

Yeah I have tried publishing and get this error and nothing else on the page…

Fatal error: Call to undefined function sl_get_stripe_button() in /home/n6x9t2/public_html/themacu/register.php on line 1

As far as being set to php the page name is register.php. Is there something else I should do to change it?

Why would it work when I just paste it into the page with a text editor then?

This is not a standard PHP function, As I said I don’t know sitelok but that function would need to be defined in an include library ahead of using it.

It might be the location you are pasting.

Where did you get this code from? I’m looking at the Stripe manual for Sitelok and I’m seeing no such code. As Doug mentioned, there seems to be something very off about the code you are using.

For example in the manual it mentions this with OBJECTID:

In this case you need to replace OBJECTID in the button code with the id of the html object.

So at the very least your use of OjbectID seems to be incomplete.

The developer lives in England but I would email him directly. He is fantastic with support. To my untrained eye (since I don’t use the Stripe plugin) the code you are using looks both incomplete and incorrect. But I haven’t the foggiest about how to help you out. And, of course, I may be wrong.

It gets produced on the stripe plugin page in sitelok. Its set up for a specific membership plan on stripe. Screenshot attached.
The code works when I paste it into the right spot of the page with a text editor. Thats the weird thing.

Have you tried highlighting all of your code in the HTML stack and selecting Format -> Ignore Formatting?

3 Likes

That worked!! Great call, I knew it was going to be something stupid like that!

Thanks!

4 Likes