Yes you can use them inside the AMD module but keep in mind once you add an event listener on the window object it will be called everytime there is an action:ajaxify.end. If you don't want it triggered after you leave that page you need to turn it off with $(window).off('eventName', myMethod)
Custom PHP Page
-
-
No, stop. This is a Node.js and Redis stack. If you're married to PHP then you should be using a LAMP stack. Are you adding a new page, or do you have a legacy PHP function you need in NodeBB? If it's the first then just use a custom pages NodeBB plugin. If the later then expose it on a restful API in whatever language you choose and integrate it via a NodeBB plugin in JavaScript.
-
@rbeer just made a really great post on getting primed for NodeJS here, along with many other great resources. JS will bend your brain a bit, but no one ever became a worse programmer from learning a new language. IMHO JS is even easier to play around with because you can just open a dev console in Chrome and start typing!
-
I don't know much PHP, but I think what he wants is a form on his NodeBB custom page that ajaxs the form to the existing PHP page.
-
Anybody can send me an example using this? https://github.com/gwTumm/node-teamspeak
just a basic things to start to test and learn.
-
var TeamSpeakClient = require("node-teamspeak"), util = require("util"); var cl = new TeamSpeakClient("##SERVERIP###"); cl.send("login", {client_login_name: "##USERNAME##", client_login_password: "##PASSWORD##"}, function(err, response, rawResponse){ cl.send("use", {sid: 1}, function(err, response, rawResponse){ cl.send("clientinfo", {clid: "##CLIENTID##"} ,function(err, response, rawResponse){ console.log(util.inspect(response)); }); }); });
this should connect you to your server, log u in, select virtual server 1, and print clientinfo for the client with id ##CLIENTID##.
(slightly modified from the node-teamspeak example)
-
console.log is just a print statement, like echo or print() in php.