php - Is it OK for users to be able to open template files directly? -


i have folder php template files in (like header.php, , call them scripts).

i know can use define('in_app', true) , in template files use if (!defined('in_app')) { exit; } if people browse these template files directly, blank page (or error message if prefer).

yes strange seeing bit of unformatted data , "undefined variable" errors, users have go out of way manually view these files, problem?

is worth defining in_app , checking if it's defined every time template file called? seems waste of processing power (even if unnoticeable)

another option put these files above root directory. may want create dir structure like:

includes    - templates wwwroot    - index.php    - images 

in case users not have access under includes.


Comments