Page 1 of 3 123 LastLast
Results 1 to 10 of 30
  1. #1
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Adding an editor... question about the documentation

    I tried adding a new editor and was getting nowhere. So I made a carbon copy of the ckeditor and called it bkeditor and it STILL wouldn't show up. I did a universal search/replace so that baffled me.

    Then I finally noticed in /admin/includes/init_includes/init_html_editor.php that three, and only three, editors are somewhat "hardcoded" into the system (htmlarea, ckeditor, and tinymce). I also noticed on the same file where it says:

    Code:
    /**
     * List of potential editors apps
     *
     * CONSTANTS are used for language-specific display names, and are defined in /YOUR_ADMIN_FOLDER/includes/languages/extra_definitions/editor_EDITORNAME.php
     *
     * To add additional editors, add your own entries to the $editors_list array by creating a NEW FILE in /YOUR_ADMIN_FOLDER/includes/extra_functions/editor_EDITORNAME.php containing just one line of PHP:
     *    <?php  $editors_list['NAME_OF_EDITOR']  = array('desc' => EDITOR_CONSTANT,  'handler' => 'editorhandlerfilename.php',  'special_needs' => '');
     *
     *
     * NOTE: THERE SHOULD BE NO NEED TO EDIT ANYTHING BELOW THIS LINE:
     */
    I followed that and still got no love for my editor so now I'm here asking if there's a typo on that, and for better clarification. Should:

    Code:
    /YOUR_ADMIN_FOLDER/includes/languages/extra_definitions/editor_EDITORNAME.php
    actually say:
    Code:
    /YOUR_ADMIN_FOLDER/includes/languages/YOUR_LANGUAGE/extra_definitions/editor_EDITORNAME.php
    or is it correct?

    Should my replacement for EDITORNAME be in all caps for some reason, or is that just to indicate I'm supposed to replace that with my own info? And is the name arbitrary, or should it match some other define?

    Should "editorhandlerfilename.php" be replaced with something? I imagine so, but a) it isn't all-caps like I suppose it would be if that were the case and b) there's no indication of which php file, exactly, it is referring to.


    Thank you.

  2. #2
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: Adding an editor... question about the documentation

    First of all it would help to know to which version of ZC this editor is being installed. Second what editor package was tried? (Ie, from where did it come?)

    As to renaming, there is no need to rename the editor file(s) for a "bkeditor" as if nothing else the next time it needs to be updated, the same modification will be necessary or the previous removed...

    Regarding placing in a language directory, then will need to 1) apply an editor (which is already pretty much language free) to each available language and 2) may still need a base file (location directed to install).

    As to the all caps, yes that is an indicator typically used to denote the need to replace that text with the appropriate text that is typically all lowercase.

    The editorhandlerfilename.php content should be replaced with the filename that handles the editor. In a ckedtor package provided in the plugins of this site for ZC, such an additional fileset should already contain the necessary file handler and associated files to address this issue.

    In most cases the problem with installing the editor comes from incorrect placement of the files. The next is the adjustment in the admin configuration my store area to indicate the use of an html editor...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: Adding an editor... question about the documentation

    Quote Originally Posted by mc12345678 View Post
    First of all it would help to know to which version of ZC this editor is being installed.
    1.5.4 fresh install
    Quote Originally Posted by mc12345678 View Post
    Second what editor package was tried? (Ie, from where did it come?)
    None. Brand new. Starting from scratch and just trying to figure out the structure, which obviously isn't as described in that file. At the very least, it mis-placed the extra_functions folder and I'm wondering what else is wrong.

    Quote Originally Posted by mc12345678 View Post
    As to renaming, there is no need to rename the editor file(s) for a "bkeditor" as if nothing else the next time it needs to be updated, the same modification will be necessary or the previous removed...
    Sorry, I'm really not following what you mean in that sentence. My "bkeditor" was just a temporary thing to try to get it to show up differently from the ckeditor. My point was that I did a complete search/replace on the ckeditor package, changing every instance and filename from "ck" to "bk" just to prove the directory structure was sound for a new editor. When even THAT didn't work, I investigated and saw that ck (among with 2 others) is somewhat hard coded in, along with the [flawed] instruction on how to add more.
    Quote Originally Posted by mc12345678 View Post
    Regarding placing in a language directory, then will need to 1) apply an editor (which is already pretty much language free) to each available language and 2) may still need a base file (location directed to install).
    Huh? I really don't think you're understanding my questions. It says to put it in /languages/extra_definitions, but I really think it means /languages/english/extra_definitions (assuming english). That would be consistent with the typo that says /extra_functions when it should be /functions/extra_functions. I suspect this "documentation" has carried over from a previous version.

  4. #4
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: Adding an editor... question about the documentation

    Quote Originally Posted by mc12345678 View Post
    In most cases the problem with installing the editor comes from incorrect placement of the files.
    That's really my point. The documentation clearly isn't correct, so I need to know what the proper placement is! I can't use the ckeditor plugin as a model because it gets special treatement, as per that hardcoding.

    So really my question is how do I add a brand new editor?

  5. #5
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: Adding an editor... question about the documentation

    Well, based on the above that "starting from scratch" may I suggest using the following ckeditor "designed" for ZC: https://www.zen-cart.com/downloads.php?do=file&id=1098
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: Adding an editor... question about the documentation

    really? :)

    As I said, you CANT use ckeditor as a basis because there is special coding in the core files for allowing specific use of ckeditor (as well as htmledit and tinymce). That's MY WHOLE POINT... even if you take that exact contrib and make an exact copy of it but change every instance (both filename and inside the files) from ckeditor to bkeditor... bkeditor DOES NOT SHOW UP. I know, as I said, because that's what I did. I found one other contrib relating to editors (that wasn't one of the above 3) and it isn't applicable past 1.5.0.

    Again, as I said, there are some instructions on how to add a different editor, but those instructions are not correct. That's why I'm here.

  7. #7
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: Adding an editor... question about the documentation

    I now have it so I can see my new editor in the drop-down list, but it shows as the constant, not the defined value (ie. "EDITOR_TEST")

    I put the define where the instructions say to, even though I think that is flawed:

    Code:
    <?php
      define('EDITOR_TEST', 'Test');
    @ admin\includes\languages\extra_definitions\test.php

    I also tried where I think it should go @ includes\languages\english\extra_definitions\test.php
    I also tried calling it testeditor.php (similar to ckeditor) and editor_test.php as the comments seem to suggest, but neither did anything.

    Can someone familiar with the relevant code please tell me how to get my define read in?

    I even tried to put the define inside the ckeditor language file because I know that file is being read, but it still shows up as "EDITOR_TEST"

  8. #8
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: Adding an editor... question about the documentation

    I have confirmed (via simple echo test) that init_languages.php is, in fact, accepting my define. It is also available to init_html_editor.php

    So I'm really confused right now why it isn't making it into that drop down. Hmm..

  9. #9
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: Adding an editor... question about the documentation

    The point of suggesting the existing software that works when installed was to use it as a basis from which to expand.

    So, sorry.. I was wrong you were right... Okay let's move on.

    The more recent ZC files already include the some of the assignments for ckeditor in the inclusion/assignment of

    Code:
    $editors_list['CKEDITOR'] = array('desc' => EDITOR_CKEDITOR, 'handler' => 'ckeditor.php', 'special_needs' => '');
    in admin\includes\init_includes\init_html_editor.php

    as pointed out to be loaded if the directory ckeditor exists where the editors are located in the catalog, typically the folder where the store is and a subfolder of editors. ie: /usr/x/y/z/public_html/editors

    So, if a new/different editor is to be added (in the same location) it needs to be added to the $editors_list array. By creating a file in the admin area (which is the side of the store considered applicable to have/need html editing) such that the array is populated with the applicable references before the the above init_includes has been loaded (thus being added to the resulting pulldown). So, the new file should follow a format similar to the above. The key value of the editors_list array variable is used in the dropdown when the editor has been loaded to the system (may require logging out and logging in, or logging out, clearing cache and then logging in for it to display as a selection.) The portion on the right side provides further information for display (a "friendly name of the editor rather than an all caps listing) and other action.

    So, the EDITOR_CKEDITOR is a constant that *IS/EXPECTED TO BE* defined in the admin/includes/languages/english/extra_definitions/ckeditor.php file (or the filename of your choosing. The suggestion is to prefix the filename for clarity that it is in fact an editor that has some extra definition.) Looking through the admin/index.php and subsequently called files, definitions in that directory will be called to load the information used in that file. The content of that file as described is the friendly name of the editor used for display.

    Then there is the "handler" that handler without further change of the path in the handler key is to be located in the admin/includes directory... For ckeditor, this handler is a javascript related file that loads jquery if it hasn't been already and then identifies that the editor has its own javascript file to load and calls it. Additional script goes through and identifies if/where the editor is to be applied. Where it is to be applied it is "replaces" the existing content and the accessibility of the plugin takes over...

    All of that was gleaned from a search in the ZC code for ckeditor (which revealed the one file that was previously posted in part) and no other specific reference to it. The main power of the editor though now comes from whatever the handler references/loads (hence the handler) and so the result can be displayed... In this case, ckeditor has a javascript file that does a lot of processing/control to pull all of the loaded/identified elements together to provide what is used/shown.

    So what does it take? Give information to ZC about the identity of the editor, what is to be displayed to the user when "selecting" from the list of editors, and tell ZC where the handler file is located with the handler taking the action necessary to display/integrate the editor into the areas needed/desired and the editor providing functionality as loaded by the handler. The rest is really basically just common usage information to keep things "similar". Hopefully whatever editor you're either developing or planning to incorporate may be worth providing back to the community and that you consider packaging it for others as a plugin.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  10. #10
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: Adding an editor... question about the documentation

    The problem seems to be that \includes\functions\extra_functions\editor_test.php is included before the define is recognized. When I do an echo test of that define in that file, it fails.

    Short term solution is to hard code the language in that funtion, which is bad.

    I'm thinking now this isn't my not knowing where to put something... I think it is a bug.


    For example, in the above mentioned file if I put:

    Code:
    <?php
    echo EDITOR_TEST;
     $editors_list['TEST']  = array('desc' => EDITOR_TEST,  'handler' => 'test.php',  'special_needs' => '');
    I see the literal "EDITOR_TEST" instead of what is defined in the language file. So that literal is being passed on to the drop down rather than the string that literal should represent. Does that make sense?

    You're getting ahead of me. At this point, ALL I'm trying to do is create the shell and get my friendly name to show up in the drop-down.
    Last edited by s_mack; 23 Jul 2015 at 03:20 AM.

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. Replies: 2
    Last Post: 23 Jul 2015, 04:47 AM
  2. Question about adding products to my cart from the shopping cart page
    By audleman in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 31 Aug 2010, 07:37 AM
  3. question about the language adding
    By bluetrack in forum General Questions
    Replies: 1
    Last Post: 20 May 2006, 08:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg