Step 3: Separating Viewing & Editing Mode

Example file: example3.php.

Then we check, if $edit=’y’, we include GridlessBuilder.js script for editing. If not, we just need to include Gridless CSS framework for viewing (see the comparison between scripts required for viewing and editing in the previous step). Here we implement the checking:

<?php if($edit=='y'){ ?>
<link href="dist/gridlessbuilder.css" rel="stylesheet" type="text/css" />
<?php } ?>
<?php if($edit=='y'){ ?>
<script src="assets/lang/en.js"></script> 
<script src="dist/gridlessbuilder.min.js"></script>
...
<?php } ?>

For the complete code and to try the example, please open in your browser: example3.php.

After editing, we should be able to see the result and leave the editing mode, so we need to separate the viewing and editing mode. For this, we will use the same page with viewing mode as the default and use a querystring ?edit=y to enter the editing mode.

We can read the querystring using:

$edit = $_GET['edit'];

http://localhost/mysite/example3.php

http://localhost/mysite/example3.php?edit=y

About | Privacy | Delivery & Return

Copyright © 2021 Insite Mitra Inovindo. All Rights Reserved.