zenphoto forums » Plugins

zen photo plugin creation [first steps]

(9 posts)
  • Started 4 years ago by schwingel
  • Latest reply from dyeshurun
  1. schwingel

    Junior
    Joined: Feb '09
    Posts: 5

    Hi. Recently I started studying zenphoto plugins, My attempt is to integrate zenphoto with zencart,

    Well but, i'm already blocked in the first steps of this process. because when I tried to create an example plugin I'm facing a problem. Probably i'm jumping some important step in the basics of plugin creation.

    My problem is: after created, included in the directory plugins, my plugin file zenCart.php is discovered by zenphoto and appears in the configuration page. Bu when i tried to enable it (i clicked in the checkbox. etc. ) everything appear to be ok, but in fact it`s not enabled. when i execute an reload the checkbox appears unchecked again.

    somebody can help me, please.

    Regards from Brazil.

    A.

    Posted 4 years ago #
  2. Zenphoto development team
    acrylian

    Developer
    Joined: Jul '07
    Posts: 13,490

    Did you check the error log? Anyway, without a code example of your plugin we can't really help.

    Don't forget to read the Forum rules and usage resources
    Posted 4 years ago #
  3. schwingel

    Junior
    Joined: Feb '09
    Posts: 5

    Hi Acrylian. Thanks for the response.

    In the server logs I didn't find any useful info.

    I'm didn't checked the zenphoto logs. Actually... has it logs? I tried to find it, but I can't.

    Well, my code started getting the paypal plugin and exchanged every point where i have an 'paypal' string to 'zenCart' string. The file names are modified too. It was my first attempt and didn't work.

    Then I started cutting the code. And did tests with the same paypal modified files cutting all the code mantaining only the headers with plugin informarmation (author, version, etc). Didn't work too. after save checking the plugin option it dissapeared after a page reload.

    In my last test I just created a new file zenCart.php in the plugin directorie and tried to check and save the configuration. failed too. :(

    Do you know if there are a plugin template? an skeleton to be used to plugin developers?

    thanks in advance.

    A.

    Posted 4 years ago #
  4. Zenphoto development team
    acrylian

    Developer
    Joined: Jul '07
    Posts: 13,490

    There is no template, you could look at some of the included plugins but I guess you did already. Additionally we have a tutorial on our site.

    Don't forget to read the Forum rules and usage resources
    Posted 4 years ago #
  5. schwingel

    Junior
    Joined: Feb '09
    Posts: 5

    Yes. I did it. I checked the documentation found in this link too: http://www.zenphoto.org/2008/04/zenphoto-plugin-architecture/

    here's a sample (very simple) of the code from zenCart.php. With this example I have the option to enable the plugin, but after the the option is saved and a reload in the page is done the checkbox appears unchecked.

    <?php

    $plugin_description = gettext("zenCart Integration Plugin");
    $plugin_author = "Anderson Astor Schwingel";
    $plugin_version = '0.1';
    $plugin_URL = "";

    $option_interface = new zenCartShowOptions();

    /**
    * Plugin option handling class
    *
    */
    class zenCartShowOptions{

    function zenCartShowOptions() {

    }
    }
    ?>

    Posted 4 years ago #
  6. schwingel

    Junior
    Joined: Feb '09
    Posts: 5

    Hi acrylian. I discovered the cause of the problem. I used another name to de plugin... a large one. Like zenCartPlugin and then it worked.

    I'm not sure why it do not work with the short name zenCart.

    Tryed with other names... like abc.php and worked well to. Just the zenCart appear to fail. :(

    Anyway, thanks for the help. Regards

    Posted 4 years ago #
  7. schwingel

    Junior
    Joined: Feb '09
    Posts: 5

    Hi acrylian. I discovered the cause of the problem. I used another name to de plugin... a large one. Like zenCartPlugin and then it worked.

    I'm not sure why it do not work with the short name zenCart.

    Tryed with other names... like abc.php and worked well to. Just the zenCart appear to fail. :(

    Anyway, thanks for the help. Regards

    Posted 4 years ago #
  8. Zenphoto development team
    acrylian

    Developer
    Joined: Jul '07
    Posts: 13,490

    You need the following setup for options:

    class zencart {
          functions zencart() {
            (...)
          }
         function getOptionsSupported() {
          (...)
         }
    
         function handleOption($option, $currentValue) { // optional
        }
    } // class end
    // here follow your actual plugin functions

    Take a look at some simpler plugins like paged_thumbs for example.

    Edit: Ok, glad you managed it.

    Don't forget to read the Forum rules and usage resources
    Posted 4 years ago #
  9. dyeshurun

    Apprentice
    Joined: Feb '09
    Posts: 1

    I am having the same problem with any plugin, also "official plugins".
    I check a plugin, click save and when I come back to the plugins page it is unchecked again. I didn't find anything in the server log.
    Ideas?

    Posted 4 years ago #

RSS feed for this topic

Reply

You must log in to post.