Code Event Listener - Tutorial Possible?

Cupara

Well-known member
Is there a tutorial available that shows how to use each code event listener as it is meant to be used? I think a tut of it would save me a lot of questions and confusion.
 
Code Event Listeners are basically used to extend classes, through the $extend[] = 'Your_Class_Here'; I really see nothing else as being what they are used for.
 
I know that I meant a tut for how they are built such as:
PHP:
class XXX
{
public function Blah (&$params)
{
$this->fake();
}
private function BeBlah
{
$this->alsoFake();
}
}

Not really how to use them but how the file should be built.
 
I'm confused on what your asking. If your class is meant to tie in / overwrite functionality, it always extends XFCP_yourclassname. And XenForo sets the correct class. The structure depends on what you want to do. What ARE you trying to accomplish that you aren't grasping how to set up our file?

It you want examples go and download any of my add one as they all (except shorten URL) make use of this. SFS extends the register controller, overwrites a function to perform validation, then sends it back to XenForo. BB Code Manager extends a function to define a variable for a template.
 
The one code event I'm trying to grasp is the FrontController_Pre_View

But I will take a look at your addons for sure.
 
I'm unable to help you with more than theory at the moment, but my suggestion is to look at a class that'd be extending there, and see what methods, variables, etc. are available.
 
Code Event Listeners are basically used to extend classes, through the $extend[] = 'Your_Class_Here'; I really see nothing else as being what they are used for.
No, they are not only used for extending;)

They are also used to "include" own vars into classes (for example navbar, visotor setup,..)
I'm also using a own code event, for a interface for 3rd party developers, to be able to include own classes in the forumconnector
 
It seems so:P That's not nice, that somebody who want to sell commercial mods have no clue:P *scnr*

What's exactly your problem?
 
ok^^
i thought you mean the way, xenforo is extending the "dynamic/proxy classes"
 
Steve, can you tell us what exactly you are trying to do?

From what I can understand, you want to fetch the latest threads (globally, or on a per-node basis) and display them in a separate "portal" page. If that's it, you don't need to use the "front_controller_pre_view" event listener. A model, a view, a controller and a registered route prefix is all you need.
 
Shadab, I want to fetch the latest threads of all forums and by node id that I specify. Exactly how can I do that and avoid the event listener? The thread list will display in a block on my portal page.
 
I have a feeling your View file (xPortal_ViewPublic_Portal) is at fault. You are creating template objects (via the createTemplateObject() method) but not passing them any parameters.

If possible, can you send over the complete source for your mod (via PC) so I can look closely?
 
Is it possible to extend a ViewPublic class?

Normally I would make you would make your own ViewPublic class, but in this specific case, thats not an option and I need to extend onto the existing one. Is something like this possible?
 
Okay, I couldn't get "load_class_view" working... but lets move on, I figured out a different way to do it what I was trying to do...

My next quesiton... I used "load_class_controller" to add stuff to the ThreadView, including an input form:
Untitled-1.webp

My next question sounds like it would have a simple answer, but I'm lost... With my input form:
  • where should I be sending the form action and how do I control it?
 
Top Bottom