I need to make a date conversion function in order to convert the Gregorian date system currently used in OJS. I have made the functions, but I don`t know where to put them so I can call them from all template (tpl) or Php files.
I tested merging them in the Issue, Journal or Core classes, which was not applicable, because it depends on whether the user is logged in or not and many other factors.
Is there a general class for this purpose?
how can I access a new function from all website pages?
I am using OJS 2.4.7
thank you for your response.
I am aware of this plugin and am using it widely in OJS; the problem is that journal’s office has asked for a calendar to be displayed on the website and other plugins and modules that need Jalali date and I’d rather use a new class for their purposes, because I need more functions and attributes and I do not want to modify or override that plugin’s functions.
Also, in modifying OJS during the last years, I have came across this problem many times for adding other functionalities.
My understanding is that I should create a class and register it somehow in OJS, in order to access and use the member functions in the system.
I do have the classes,could you guide me on the next step?
thank you @ctgraham,
It helped a lot! Now, I can use my classes almost everwhere.
I am changing \lib\pkp\templates\common\header.tpl in order to add the date on top of every page. On this page I can not access the imported classes. I checked and even strlen() from the String class is unavailable.
I can access the $issue object from Issue.inc.php , if the user is not logged in; but this is the wrong way to do it.
Any idea about this?
OJS follows an MVC model. Generally, you will want set variables for output in the calling Controller which will be passed to the View, rather than calling specific class methods directly from the View. For something that you want to make global, like adding a date to every page, you probably want to assign the value in the TemplateManager itself:
This is, for example, how the $metaSearchDescription is populated.