ZenphotoCMS Forum
How to use codeblocks? - 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: How to use codeblocks? (/thread-9619.html)



How to use codeblocks? - janwessel - 2012-02-11

I am new to Zenphoto, so plz forgive me if I ask the wrong question.

I have installed Zenphoto (versionZenphoto Setup v1.4.1.6[8326]), and using the Default theme.
I created albums and put pics in.
Now on the page for 1 specific photo I want to add some code that will start playing an MP3.

As I understood I should be able to use codeblocks (codeblock1) for that.
But I am not grasping how it works.

Do I have to put HTML code, or PHP code?
Do I have turn using code blocks on somewhere?
Is there maybe somewhere a step by step instruction on how to this?

Regards,

Jan




How to use codeblocks? - acrylian - 2012-02-11

Note that 1.4.1.6 is not the current version.

Regardless of that, you can enter basically enter any kind of code within a code block, so html or PHP or even javascript.

If code blocks work and where they are output depends on how the theme you are using is setup. If your theme does not support code blocks at all or does use them in not fitting places you need to modify the theme used.
Some of the standard themes do have at least partly support (you can see that in the source of the theme),

Info on theming on the tutorial of the same name, code blocks are documented on the functions documentation:
http://www.zenphoto.org/news/category/theming-templating




How to use codeblocks? - sbillard - 2012-02-11

Quote:Some of the standard themes do have at least partly support (you can see that in the source of the theme
Supporting themes are Effervescence+, Garland, and Zenpage. So there is no support in Default and you would have to add it. Note: we recommend you make a copy of the theme and modify the copy, not the distributed theme.




How to use codeblocks? - janwessel - 2012-02-14

Thanks for the quick replies, sorry for my late response.
Will upgrade and then check and try your suggestions,




How to use codeblocks? - janwessel - 2012-02-17

Hello all,

As follow up I have done the following:

  • downloaded the latest version (1.4.2.1)

  • checked if I knew my admin user and password

  • installed locally on my computer (index.php, themes and core-zp)

  • executed the setup

  • choose a theme that supports the execution of codeblocks (in my case the garland theme)

  • went to zenphoto/themes/garland

  • found image.php

  • searched for codeblock and found ""

  • then went to the admin panels, and went to the image I wanted extra code to be executed

  • added the code I wanted to be executed under the tab codeblock 2 (under show more fields)

  • tried it, and it worked. So now I understand how it works.

  • now I choose in the admin panels again the theme that I want for the site (in my case the theme default)

  • went to zenphoto/themes/default

  • copied image.php to image.org

  • copied the code I found () into image.php

  • tried it, and it worked. The exact place in the image.php where you put the code has to be somewhere where the image is being displayed.

  • checked if I knew my admin user and password on the server of my provider

  • then copied the index.php, themes and core-zp folder to server of my provider

  • ran the setup

  • then copied the zenphoto/themes/default/image.php and image.org from my local computer to the server of my provider

  • tried it and it worked…..

This all, because on my photo site there is picture of my father (who died some years ago) and I wanted to play an MP3 file when showing this image.

Thanks for the software and the support-forum.

Regard

Jan Wessel




How to use codeblocks? - sbillard - 2012-02-18

Glad all this worked. But I think you did miss a small point of my post. If you did leave all this in the themes/default folder then when you install a new version of Zenphoto it will overrite your work.

Instead make a new folder with the files with a different name. Then when you update Zenphoto your changes will not be touched. You can also at that point compare your theme with the current version of the default theme to see what changes have happened that you might want to apply to your version.




How to use codeblocks? - janwessel - 2012-02-18

You are so right.
Couple of hours after I finished, I realized this.
So I made a copy of the themes/default folder, renamed it and uploaded it.
Hmmm, didn't show the new name I gave in the list of themes to choose.
Then I noticed the "duplicate" button.
Used that, and now activated the duplicated theme.
Restored the original image.php in the theme/default folder.

I am blushing, cause as a configuration manager I should have realized from the beginning... :-)

Thanks for pointing this out.

Regards,

Jan




How to use codeblocks? - Wete - 2012-02-18

Maybe you wanna edit your theme by using a tool like Notepad++. In this case it can be impossible to edit the files because of the owner - it's set to your php instance, because the ZenPhoto script generated the new files. Then it's better to download the default theme folder (or which theme you want to edit) via ftp and upload it in a new folder. Then you can edit the files without using the ZenPhoto built-in editor. The title of your new theme, description and so on are set in theme_description.php and you can upload a different theme icon by overwriting theme.png in your theme folder. ZenPhoto admin panel recognizes new themes when there is a new folder in /themes/ and it shows the theme title that is set in theme_description.php. Edit this file, then you can tell your theme from the original.

Wete




How to use codeblocks? - acrylian - 2012-02-18

On Mac I recommend the free TextWrangler btw.




How to use codeblocks? - janwessel - 2012-02-18

@Wete
That was indeed my next task, search where this information is kept.
Thanks for pointing it out.

@acrylian
I installed Komodo Edit, but I'll keep your suggestion in mind.

Further, I like to do my playing around with the code and settings locally.
Then when I am satisfied I upload to the server.
But indeed I must check ownership and such very cautiously.




How to use codeblocks? - acrylian - 2012-02-18

Komodo Edit being an IDE is a little more than just an text editor. But surely fitting (I use Eclipse as an IDE). For the quick "edit in-between" especially for html and css it is a little too huge at times.




How to use codeblocks? - janwessel - 2012-02-18

I have installed only the free open source editor Komodo Edit
http://www.activestate.com/komodo-edit

It' big brother is the Komodo IDE 7.

I will see how I like it, and then maybe switch to something else.




How to use codeblocks? - acrylian - 2012-02-18

Right, confused it with the IDE. There are numerous good tools…:-)