Using Sitelok when converting from RW Classic site to RW Elements

This post is a mini-tutorial on how to use Sitelok, a website membership product, from Vibralogix when developing a new RapidWeaver Elements site from an existing RapidWeaver Classic. The Sitelok license allows you to use it for one domain, but you can also use it on a sub-domain within your main site, so you can develop a “test” site using elements within your main domain. There have been a few posts about this on the RapidWeaver forum, and I wanted to simply share a couple solutions I’ve set up, with some excellent support from Adrian Jones from Vibralogix. The first task is to set up your sub-domain along with the RW Elements settings to publish your site to this “test” site. The second task is integrating Sitelok into your new Elements site, using the same library and database used in your main Classic domain site.

Setting up your sub-domain

This may vary by web-hosting services. I use hosting.com (formerly a2hosting.com). My main domain is mydomainname.com. To create a new sub-domain use cPanel and create a new sub-domain, say newsite.mydomainname.com (Of course, you need to specify your own domain name here, as well as your chosen sub-domain name). Contact your hosting service if you have any questions or trouble setting up this new domain. Once created, you can publish your Elements site using “Publishing setup” and under General, just enter https://newsite.mydomainname.com into the Web Address field. O

File structure for your site

Use cPanel or your favorite FTP application to examine the files in your domain and sub-domain. In my case, all the files are in a folder named “public_html”. If you already have Sitelok installed, you should have the main folder “slpw” at the root of public_html, and if you use a download files folder, it is generally at the same level, and named sl_filesXXXXXXXX where the X’s are replaced with miscellaneous letters/numbers. In order to use the same Sitelok installation in your new sub-domain, you must reference them using a relative pathname. Your sub-domain files will be normally be located at the same level as “public_html” in a folder named “newsite.mydomainname.com

Using Sitelok with Classic

In Classic, to use Sitelok on a page of your site, you must include a “call” to /slpw/sitelokpw.php at the top. Refer to the Sitelok documentation for details. You need to use the HTML tab for the page, and select the “Prefix” tab. Then insert:

<?php $groupswithaccess="PUBLIC"; require_once("../slpw/sitelokpw.php"); ?>

This one allows public access on the page, but you can restrict it to specific membership group(s). The path ../slpw specifies that the slpw folder is one folder above the current webpage. If your webpage .php file is at the same level as slpw, the path is simply slpw/. If your page is two levels down, the path is ../../slpw, etc.

Using Sitelok with Elements

Elements doesn’t have an easy way to put code in “Prefix”. But there is more elegant solution. You can download a manual and some Elements components from https://www.vibralogix.com/sitelokpw/. Look for the link “Using Sitelok with Elements”. Click this and you’ll get a manual and a elementsdevpack containing the elements you need. Adrian is planning on making these available in the Elements store (free) once it is available for third parties. Once you have installed the components, you just need to place the Sitelok Page Component at the top of your page. In the properties panel, select the following: What will be on this page? Select Members (and any others that apply to this page). Who will have access to this page? Select what applies to your page. The most important one is Other settings. This is where you specify a custom file path if slpw folder is in a different path in your site. For most of my new pages, I’m using ../../../public_html/slpw/ My files in the sub-domain are stored in newsite.mydomainname.com/category/title/webpage.php. When you go up three levels, you get to the root folder of my site that contains “public_html” and the sub-domain folder, so after that Sitelok navigates down one level to get to /public_html/slpw/. Probably could word this better, but the idea is to provide the proper relative pathname for slpw folder. If you publish this page and get no errors on the page (e.g. 404), you’ve got the path correct.

To set a link path to a download file in sl_filesXXXXXXX, you can now just set the link as you did in RapidWeaver Classic, e.g. <?php siteloklink(‘filename.pdf',1); ?> Make sure the link is Plain Text, not URL. I made that mistake the first time around. Alternatively, you could use the Sitelok Download component to set the link.

One advantage to having this Page Setup component, is you could create global(s) that would work depending on the hierarchy in the file structure. And when you’re ready to publish your site to the main domain, you could just change the globals appropriately. That’s something that you would have to do manually on every page using Classic.

1 Like