Ryan Boyd Posted December 3, 2015 Posted December 3, 2015 Hello, I am new to IPS Framework and I barely know how to use it. I want to ask you if there's a way I can find all the details like the post that @bfarber made regarding working with members. I can't really find something useful so I can learn with it's base code. Also I am using XAMPP on my MacBook Pro, is there a faster way to test all my stuff and if yes how? And how can I configure phpStorm on my MacBook so it runs through a localhost (in phpStorm not XAMPP). Also how can I use the namespace? I'm not really familiar with OOP PHP but trying to learn slowly. How can I use my .php files? For example: I have a fetch.php that retrieves info of an external database and I want to use it's functions in my plugin, how would this be possible? Thank you Best regards UKF
bfarber Posted December 4, 2015 Posted December 4, 2015 23 hours ago, UKF_HHA said: Also how can I use the namespace? I'm not really familiar with OOP PHP but trying to learn slowly. How can I use my .php files? For example: I have a fetch.php that retrieves info of an external database and I want to use it's functions in my plugin, how would this be possible? You need only require init.php <?php // This gets the framework require 'init.php'; // Print the logged in member's name print \IPS\Member::loggedIn()->name;
Dreadknux Posted March 21, 2016 Posted March 21, 2016 The Guides section is intended to have info about using the framework in the future, though there's not much about the framework itself in there right now (it's very good for JS and CSS stuff, though). The best framework info right now is in the old Documentation section, though it's messy and dated in places. There's also a lot of good info that's come from questions asked here in the forums, but it's all dotted about and of varying quality. I'm not aware of any public phpDocs-style documentation on all the classes, methods etc - I generated a rough set for my own use, but I'd really like to see a proper one here like the one IPB3 had. The most important thing to understand about the framework IMO, is that almost every class extends a more general class defined elsewhere. So, with a lot of them you have exactly the same methods and they work the same way from a framework standpoint - e.g. if anything extends \IPS\Patterns\ActiveRecord at some point, it'll have methods like load and save. Topics and Statuses are examples of Content Items, which have their own set of universal stuff to work with, and Forums are an example of a Node which has stuff suited to a hierarchy of Nodes, having parents and children. In general, find out what a class extends, and you can figure out what its basic behaviours are. In terms of structure, everything is under \IPS\. if the second part of the namespace/class begins with a capital letter, then it's part of the system hierarchy, which is found in the system directory in the forum root. If it instead begins with a lowercase letter, it's part of an application (applications directory). The base application that has stuff like the global content, ACP etc is core. Within an application, sources is usually for creating new classes, modules is for page generation procedures, and extensions can do either (they're part of the Developer Mode's extension system, which gives you a set of a templates for modifying/extending particular parts of the system).
Pseudonym Posted February 26, 2017 Posted February 26, 2017 On 05/12/2015 at 3:13 AM, bfarber said: You need only require init.php <?php // This gets the framework require 'init.php'; // Print the logged in member's name print \IPS\Member::loggedIn()->name; I'm trying to tweak an existing script to include a bit of IPS authentication in it. This code seemed to be exactly what I need, but I can't make it work. Trying to run it, even by itself, I just get the error "Something went wrong. Please try again." What am I doing wrong? I see the post was made back in 2015 - is this code still valid in the latest versions of IPS?
teraßyte Posted February 26, 2017 Posted February 26, 2017 Try with this code (not tested): <?php // This gets the framework require 'init.php'; // This is now required for calls external to the framework \IPS\Dispatcher\External::i(); // Print the logged in member's name print \IPS\Member::loggedIn()->name;
Daniel F Posted February 26, 2017 Posted February 26, 2017 Yea, what @teraßyte said. As I mentioned yesterday morning in another topic, you'll need to initialize the dispatcher after including the init.php file.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.