How do I establish a connection to an existing components code from a new component

bryce alvord Posted in Component Development 5 years ago

Im writing a component that will use some core functionality of one of the stock OSSN components. Im wondering if there is something built into the OSSN framework that allows me to import a component into mine essentially so that I can call its functions and have the class accessible to me. I hate copying code that performs simple tasks and creating a new code fork vs. tapping into the core functionality in its pure form. I know I can include those files too, just wondering if there is a better way that is less sensitive for me to do this.

So lets say I am wanting to create a notification for example. Well a lot goes into thos notifications from what I can tell in the OSSN Notifications component so my thought process is why recreate the wheel when I can hopefully "import" OSSNNotifications and call a OSSNNotifications.CreateNotification() method (pseudo code obviously).

Thanks

This topic has been closed!

[Topic is Close]

Replies
us Bryce alvord Replied 5 years ago

That is perfect, thanks Z Man! Sorry for some of the newb questions, I am new to PHP completely so its a learning curve for sure but thank you for the help, nice to know there are knowledgeable friendly people that are helpful too.

German Michael Zülsdorff Replied 5 years ago

Hi Bryce,
you don't even have to "import" OssnNotifications.

Have a look into OssnNotifications/classes:

class OssnNotifications extends OssnDatabase

Have a look into configurations/classes:
these are the default classes (OssnDatabase among them) ...
being included on line #27 by system/start

That said, all you need to do is creating a new OssnNotifications instance like

$myNotificationInstance = new OssnNotifications;

and you'll be able to access all available methods like

$myNotificationInstance->method(PARAMETERS);
Premium Version

Due to the many requests in the past for additonal features and components we have decided to develope a premium version. Features like Hashtags, Videos, Polls, Events, Stories, Link Preview, etc included in it.

$199 (Life Time)
Learn More

Other Questions