RPeraltaJr
3/10/2017 - 8:14 PM

Testing/Preview URL by Setting Custom URL

testing/preview url environment by setting custom url

<?php 

if( stripos($_SERVER['REQUEST_URI'], "?test") !== false ):
  ini_set('display_errors', 1);
  ini_set('display_startup_errors', 1);
  error_reporting(E_ALL);
endif;
<!-- Append ?demo to each link on the page -->
<?php if( stripos($_SERVER['REQUEST_URI'], "?demo") !== false ): ?>
    <script>
        $(document).ready(function() {
            $('a').each(function() {
                let value = $(this).attr('href');
                let updatedLink = value + '?demo';
                $(this).attr('href', updatedLink);
            });
        });
    </script>
<?php endif; ?>