ZenphotoCMS Forum
Logs from external php file - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Logs from external php file (/thread-14049.html)



Logs from external php file - ctdlg - 06-05-2025

Hello,
I try to add some logs in an external php file.

Example, extraction.php contains :
$logHeader = "{" . time() . ":" . gmdate("D, d M Y H:i") . " GMT}";
debugLog("$logHeader\n? clvs actuelle : $clvsLine");

This php file is in /scripts
zenphoto folder is in /mutimedia
S
This file is called in image.php using the include function after < body >

Maybe extraction.php should start with

But image.php already uses this code !
admin logs page should display my variable !

Thanks in advance.




Logs from external php file - acrylian - 07-05-2025

I have no idea what "extraction.php" is

The proper usages is debuglog(&#36;yourmessage, &#36;reset) and/or additional parameters. Time and such is already handled.
https://docs.zenphoto.org/1.6.6/namespaces/default.html#function_debugLog




Logs from external php file - acrylian - 07-05-2025

Maybe extraction.php should start with

That code is to make sure the theme page is accessed in the right context. Include files should not need that. Besides it would not hurt to add it there as well in case someone really accesses that directly. But it will otherwise just fail with errors.




Logs from external php file - ctdlg - 07-05-2025

Thank you acrylian, problem solved with your help.

My theme image.php uses this line (example)
include(&#36;_SERVER['DOCUMENT_ROOT']) . '/scripts/personal-logs.php';

My personal-logs.php file contains

Zephoto debug log displays my personal logs, I can carry on on a project !
I use php and ajax to dynamicaly change some pictures without reloading special image pages.

Was the trick.




Logs from external php file - acrylian - 07-05-2025

include(&#36;_SERVER['DOCUMENT_ROOT']) . '/scripts/personal-logs.php';

So this is outside your install respectively thte theme? Otherwise the our path constants like SERVERPATH should be fitting.

If the file is within your theme's folder you should not need the path and just include 'scripts/personal-logs.php' should work (that's how some themes include header or footer files).

I don't remember when I added it but in 1.6.6 you can also create your own custom log file with debuglog() if necessary. See the arguments on the doc link above.




Logs from external php file - ctdlg - 08-05-2025

Yes,
/scripts -> my scripts
/multimedia -> zenphoto
/multimedia/themes/ctdlg ->my zenphoto theme folder.

I will upgrade from 1.6.5 to 1.6.6 very soon, and, of course, test your new custom log file option !!