1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

can someone tell me what am i doing wrong

Discussion in 'XenForo Development Discussions' started by RamzanHD, Mar 26, 2016.

  1. RamzanHD

    RamzanHD Active Member

    Code:
    ErrorException: Fatal Error: syntax error, unexpected '}', expecting ';' or '{' - library/ImagesAsBadges/index.php:5
    Generated By: RamzanHD, 8 minutes ago
    Stack Trace
    #0 [internal function]: XenForo_Application::handleFatalError()
    #1 {main}
    Request State
    array(3) {
      ["url"] => string(60) "https://actiongamerz.com/admin.php?code-event-listeners/save"
      ["_GET"] => array(1) {
        ["code-event-listeners/save"] => string(0) ""
      }
      ["_POST"] => array(13) {
        ["event_id"] => string(13) "template_hook"
        ["hint"] => string(0) ""
        ["callback_class"] => string(20) "ImagesAsBadges_index"
        ["callback_method"] => string(13) "XenforoBadges"
        ["execute_order"] => string(2) "10"
        ["active"] => string(1) "1"
        ["description"] => string(19) "Created By RamzanHD"
        ["addon_id"] => string(20) "xenforo_images_badge"
        ["event_listener_id"] => string(1) "0"
        ["_xfToken"] => string(8) "********"
        ["_xfRequestUri"] => string(35) "/admin.php?code-event-listeners/add"
        ["_xfNoRedirect"] => string(1) "1"
        ["_xfResponseType"] => string(4) "json"
      }
    }
    
    i get this error while trying to create a addon
     
    Behnzz123 likes this.
  2. wang

    wang Well-Known Member

    Are you getting that error when you are saving your listener? Can you please post here the contents of the
    index.php file located at this path: library/ImagesAsBadges?
     
    Behnzz123 likes this.
  3. RamzanHD

    RamzanHD Active Member

    thnx for fast reply

    this is the code i putted in index.php

    Code:
    <?php
    class ImagesAsBadges_index
    {
    public static function XenforoBadges($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
    }
    this are the screen shots

    https://i.gyazo.com/1b6768e57c140a33b7a9b7cd54965ab7.png
    https://i.gyazo.com/a7a28c9c7b0a46ebad05d8f0757fa88d.png
     
    Behnzz123 likes this.
  4. James

    James Well-Known Member

    Is that all thats in the file? You have no actual code running there, all you've done is begin to create a function.
     
  5. wang

    wang Well-Known Member

    You are missing the opening and closing brackets for the function. It should be like this:

    PHP:
    <?php

    class ImagesAsBadges_index
    {
       public static function 
    XenforoBadges($hookName, &$contents, array $hookParamsXenForo_Template_Abstract $template)
       {
      
       }
    }
    But that function is empty. What is is that you are trying to do sir? More details on the subject will be very useful.
     
  6. RamzanHD

    RamzanHD Active Member

    im trying to make a addon that will let people upload images as badges
     
    Behnzz123 likes this.
  7. wang

    wang Well-Known Member

    Is that the whole code that you have?
     
  8. RamzanHD

    RamzanHD Active Member

    no no sir this is my first addon and im still learning do you have a code that i could insert and it would let members do the thing im trying to achieve
     
    Behnzz123 likes this.
  9. wang

    wang Well-Known Member

    That is something rather complex to be posted in a few lines of codes. If you can not code it yourself, I think it would be a good idea to post a request for someone to code this for you.
     
  10. Brogan

    Brogan XenForo Moderator Staff Member

    There is no pre-written code to achieve what you want - you will actually have to write it.
     
  11. RamzanHD

    RamzanHD Active Member

    im watching this but at part 3 i dont get what his code does do i have to copy it or right my own code
     
    Behnzz123 likes this.
  12. wang

    wang Well-Known Member

    Do you mean my code sir? It does nothing. I merely pointed out the error cause in your code, in response to your OP.
     
  13. RamzanHD

    RamzanHD Active Member

    c[1][Ramzan/c]
    is that your tutorial wang if it is can you please help me and teach me what does everycode men i really want to aachieve my first addon
     
    Behnzz123 likes this.
  14. RamzanHD

    RamzanHD Active Member

    Behnzz123 likes this.
  15. wang

    wang Well-Known Member

    No sir, it is not my tutorial. I had a look at it, and that tutorial will show you the way of how to put things together for your add on. But you have to write the code yourself for whatever you want your add on to accomplish.
     
  16. RamzanHD

    RamzanHD Active Member

    where do i learn the code from
     
    Behnzz123 likes this.
  17. James

    James Well-Known Member

    You need to learn PHP. A Google search will help but it's by no means an overnight task. It'll take a lot longer, like learning a new language.
     
    wang likes this.
  18. wang

    wang Well-Known Member

    There are a lot of documentations floating about online. In addition to php, you must also learn sql and the oop system, as well as getting to know the Zend framework, which is what XenForo is using, code-wise. As you learn things, you can aslo study the many documentations posted here and study the xenforo and the add ons code. It will help a lot. Good luck with it sir.
     

Share This Page