Work in Progress - Sitelok

It was relatively straight forward? :slightly_smiling_face:

I used the documention on the Sitelok site.

I currently use Sitelok on one of my sites which is Foundry 3 based and use Joe Workman’s Visilok set of stacks to control it. Vibralogix provide full documentation on how to set it up manually, so you don’t have to use a Sitelok specific stack but it makes it easier. I am trying to replicate that ease in Elements.

I had to wait for the latest beta for the php fix and after that it was fairly easy. One of the things I identified in the post - Custom Component & Template Areas - is that the following typical php code needs to be added at the start of every page that wants to control logins:

<?php
require_once("slpw/slloginform.php");
$loginpage=$slpagename;
$logoutpage=$slpagename;
$loginredirect=0;
$groupswithaccess="CLIENT";
require_once("slpw/sitelokpw.php");
?>

and in the page header area:

<?php if (function_exists('sl_loginformhead')) sl_loginformhead(7,false); ?>

The $groupswithaccess can change or have more than one group and the 7 in the sl_loginformhead(7,false); refers to the id of the login form that might not always be 7.

This means if anything changes then these areas need to be edited for every page.

If there was an Elements capability to add a global Custom Component to every page, that would be named something like Sitelok Initialisation, then it would be a simple matter to setup properies for the variable sections of this code. The the Custom Component could invoke an API to have te code posted into the appropriate section.

The other thing referenced in this post - @dropzone Identification - so that areas can be clearly seen, not just when the mouse is over them. Also having the capability to have the dropzone namee as in @dropzone(“name”) shown on the page woud be helpful. So in this case it would identify the Logged In and the Logged Out dropzone.

As far as using Tailwind’s CSS, the login panel is generated by Sitelok, it has a login form dialogue where you can configure the look and fields required. It is possible, I think, to generate a minimalist form where you can use your own CSS (or Elements, which would make sense). I haven’t got as far as investigating that yet as I wanted to get the basics to work.

The Sitelok Control Custom Component has the following template:

<?php
if ({{displayMode}}$slpublicaccess) {
?>
@dropzone("content")
<?php
}
elseif ("{{elseMode}}" == "else") {
?>
@if(elseMode)
@dropzone("content_else")
@endif
<?php
}
?>

and properties:

{
    "groups": [
            {
      "title": "Sitelok Content Control",
      "icon": "key",
      "properties": [
          {
          "information": {},
          "title": "Display content when ..."
        },
   
        {
          "title": "Logged In",
          "property": "displayMode",
          "switch": {
            "trueValue": "!",
            "falseValue": "",
            "default": true
          }
        },

        {
    "information": {},
    "title": "[^ Displays when Logged In]",
    "visible": "displayMode == true"
    },

        {
    "information": {},
    "title": "[^ Displays when Logged Out]",
    "visible": "displayMode == false"
    },

    {
    "information": {},
    "title": "... else display alternate content."
    },

        {
          "title": "Else",
          "property": "elseMode",
          "switch": {
            "trueValue": "else",
            "falseValue": "",
            "default": false
          }
        },

            {
    "information": {},
    "title": "[^ Displays when Logged In]",
    "visible": "elseMode == true && displayMode == false"
    },

        {
    "information": {},
    "title": "[^ Displays when Logged Out]",
    "visible": "elseMode == true && displayMode == true"
    },
  ]
        
    }
    ]
}

In summary, if we could get on top of some of the things listed above, then I think it would be quite simple to package this up as a solution for an Elelemnts Sitelok implementation that would be easy to use.

I would be happy to discuss offline if that would help?

1 Like