Forum
PerchSession, Adding additional values
In my APP I would like to ADD a couple key/value to PerchSession.
Where is the best place to do this? (php script)
My guess is perch/addons/apps/my_app/index.php but I am wondering if there is already another way to do this?
[index.php]
<?php
# include the API
include('../../../core/inc/api.php');
$API = new PerchAPI(1.0, 'my_app');
# include your class files
include('MyApp_Parents.class.php');
include('MyApp_Parent.class.php');
# Grab an instance of the Lang class for translations
$Lang = $API->get('Lang');
# Do what you want to do before output is started
PerchSession::set('KEY','VALUE'); // <==================== Is there a better way/place for this?
include('modes/parent.list.pre.php');
# Top layout
include(PERCH_CORE . '/inc/top.php');
# Display your page
include('modes/parent.list.post.php');
# Bottom layout
include(PERCH_CORE . '/inc/btm.php');
?>
The 'pre' in the
x.pre.php
file names means pre-output. So anywhere in your pre file should be fine.