• 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

Senpai

Formerly RamzanHD
#1
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
 

wang

Well-known member
#2
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?
 

Senpai

Formerly RamzanHD
#3
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?
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
 

James

Well-known member
#4
Is that all thats in the file? You have no actual code running there, all you've done is begin to create a function.
 

wang

Well-known member
#5
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 $hookParams, XenForo_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.
 

Senpai

Formerly RamzanHD
#6
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 $hookParams, XenForo_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.
im trying to make a addon that will let people upload images as badges
 

wang

Well-known member
#9
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
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.
 

Senpai

Formerly RamzanHD
#13
c[1][Ramzan/c]
Do you mean my code sir? It does nothing. I merely pointed out the error cause in your code, in response to your OP.
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
 

wang

Well-known member
#15
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
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.
 

wang

Well-known member
#18
where do i learn the code from
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.