Using defaultCodeblocks

Hello,

There is one option I do not use right now : defaultCodeblocks
I searched zenphoto.org, and did not find useful information about this feature.

Can someone explain me the use of these codeblocks. Could I get an example of valid code ?

Thanks in advance.

Comments

  • acrylian Administrator

    Codeblocks are special fields on the backend for all item types (images, albums, Zenpage news articles and page) that let you enter short PHP code snippets (for more extensive things it is recommended to do that on the theme itself)

    If the theme used is setup for codeblocks (e.g. using the codeblock functions) the code will be executed on the site.

    On the backend you can add more codeblocks than one default one and the defaultCodeblocks plugin lets you predefine a specific number. It's not really an important plugin.

  • sbillard Member
    edited May 9

    Actually, this plugin provides a means to supply codeblock text for theme pages that is "global" in context whereas normally you would have to insert the text into each and every object.

    So you can, for instance, define a default codeblock 1 for "news articles" and all your news articles will display that block. It can be overridden for an individual news article by setting codeblock 1 for that article.

    It really has NOTHING to do with the number of codeblocks used--that is strictly a theme choice. There are two steps to using a codeblock. First, the theme has to have the printCodeblock() function call with the chosen codeblock number. Then for something to print there must be codeblock text supplied for the codeblock. This either by editing a particular object or by defining a "global" value for the codeblock.

    The number of codeblocks is unlimited. You just add the codeblock ad needed. There can be a different number for each object and/or for the global defaults. But of course if the theme does not use them....

  • acrylian Administrator

    My mistake.

  • ctdlg Member

    Thank you sbillard and acrylian.

    I have to add the printCodeblock() function to my theme as this kind of code can be very helpfull !

  • ctdlg Member

    It does work !
    Great option !

    I've added one printCodeblock() before footer.
    I can change it's content without editing my theme.
    And if needed, now, I know how to add more code blocks.

    Again, thank you.

Sign In or Register to comment.