Member
Member
ctdlg   16-06-2024, 14:28
#1

I try to understand Zenphotos macros.

Following this page
https://www.zenphoto.org/news/content-macros/
I wrote a php macro file, enabled it in the extensions admin page.

I get a blank page because of line
'owner'=>'mymacro.php';

and with
'owner'=>'mymacro.php',
My Hello World is not displayed (using [ HELLOWORLD My ] )
End of page is not displayed too.

Using [ HELLOWORLD ] displays in red 1 parameter is missing, but page is fully displayed.

[ HELLOWORLD 'My' ] does not work too.
So, I am a bit lost.

Administrator
Administrator
acrylian   16-06-2024, 16:29
#2

Without the full code it will be hard to tell. What does the debuglog say? (that is the first you have to look!).

If you have the spaces before/after the brackets it is probably just that. Those are only there in the doc - as noted - to make sure ZP does not exectute them. So [HELLOWORLD My].

I referenced it on the other topic but this is a quite simple macro plugin you also can use as a guide:
https://github.com/acrylian/zp_mapembed

Member
Member
ctdlg   16-06-2024, 18:23
#3

My php file is a copy of code found here :
https://www.zenphoto.org/news/content-macros/ :
[code]

[/code]
And error log :
[code]
{885:Sun, 16 Jun 2024 18:14:18 GMT} Zenphoto v1.6.3
AVERTISSEMENT : Undefined variable $_zp_db dans /DonneesMsi/Sites/clatique/multimedia/zp-core/functions/functions.php à la ligne 2727
applyMacros called from getCodeblock (template-functions.php [4365])
from printCodeblock (template-functions.php [4379])
from include (pages-aide.php [33])
from include (index.php [128])
from index.php [56]
{885:Sun, 16 Jun 2024 18:14:18 GMT}
ERREUR : Call to a member function quote() on null dans /DonneesMsi/Sites/clatique/multimedia/zp-core/functions/functions.php à la ligne 2727
[/code]

Your macros are ok :
[code]
[ZENPHOTO_VERSION]
[CODEBLOCK 2]
[/code]
work as expected

Administrator
Administrator
acrylian   17-06-2024, 07:13
#4

The code looks actually correct, althouth the macro class probably should be "function" instead of "expression".

Thanks you just found an error. There was a globla declaration missing. Should be fixed in the 1.6.4 support build. 1.6.4 will probably be release later today.

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.