Welcome Guest, Not a member yet? Register   Sign In
Proposal to Combine Constants
#5

(This post was last modified: 10-08-2021, 06:38 AM by John_Betong.)

I have four sites sites (soon to be more) all calling a common CI4 application and find the following ideal for displaying the relevant constants for each domain:

file: /app/Views/incs/QQQ.php
Code:
 
<?php declare(strict_types=1);

$CI_VERSION = \CodeIgniter\CodeIgniter::CI_VERSION ;

define('QQQ', [
  'memory_get_usage()'      => number_format((float)memory_get_usage()) .' bytes',
  'memory_get_peak_usage()' => number_format(memory_get_peak_usage()).' bytes',
  'date("h:i:s")'  => date('l, jS F Y -H:i:s'),
  'base_url()'      => base_url(),
  'CI_DEBUG'        => CI_DEBUG    ? 'TRUE' : 'FALSE', 
  'APPPATH'        => APPPATH,
  'BASEURL'        => BASEURL, 
  'CI_VERSION'      => $CI_VERSION, 
  'ENVIRONMENT'    => ENVIRONMENT, 
'CI_ERROR_LOG'    => CI_ERROR_LOG,
  'FCPATH'          => FCPATH,
  'LOCALHOST'      => LOCALHOST,
  'ROOTPATH'        => ROOTPATH,
  'SYSTEMPATH'      => SYSTEMPATH,
  'TESTPATH'        => TESTPATH,
  'WRITEPATH'      => WRITEPATH,
]);

# LOCALHOST defined in index.php
if(LOCALHOST) :
# Maybe rendered in footer.php
echo tabulate((array) QQQ, $title='Table: QQQ'); 
endif;


I thought the grouping may be useful instead of separate Constants?
Reply


Messages In This Thread
Proposal to Combine Constants - by John_Betong - 10-06-2021, 06:30 AM
RE: Proposal to Combine Constants - by kenjis - 10-06-2021, 10:38 PM
RE: Proposal to Combine Constants - by InsiteFX - 10-06-2021, 11:18 PM
RE: Proposal to Combine Constants - by John_Betong - 10-08-2021, 12:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB