OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Accessing to variables

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
Developer Resources:

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page.

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome, but if you have a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a technical support question, try the OJS Technical Support subforum.

Accessing to variables

Postby svillanueva » Thu Mar 06, 2008 3:45 am

Hello,

I would like to show the editorial board in the left sideBar. To do this, I need to access to the variables of the groups memberships (since we work in Masthead) in order to show them in the correct format. The problem I found is that these variables are only available when accessing the editorialTeamBoard.tpl, where I guess the class AboutHandler appears and initialize the variables. Somehow, I would like to call that class or, the methods of that class in order to retrieve the values and then be able to work with the variable $groups in header.tpl.

I've read that some variables are accesible from anywhere (for example currentLocale, siteTitle, etc....), is it possible to add the groups variable to work with it in header.tpl as the other variables? Or there is another way to do that?



Regards,

Sergi Villanueva.
svillanueva
 
Posts: 74
Joined: Fri Jan 18, 2008 4:20 am
Location: Barcelona

Re: Accessing to variables

Postby asmecher » Thu Mar 06, 2008 11:36 pm

Hi Sergi,

To make variables anywhere, add them to the constructor for classes/template/TemplateManager.inc.php -- e.g. where metaSearchDescription is set, near line 111. You should be able to adapt the necessary code from AboutHandler.inc.php in the editorialTeam function.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 9097
Joined: Wed Aug 10, 2005 12:56 pm

Re: Accessing to variables

Postby svillanueva » Fri Mar 07, 2008 6:02 am

Hi Alec,

I'm a little bit confused with this issue. The idea is to initialize the variables in the constructor for classes/template/TemplateManager.inc.php and then, work with them in the editorialTeam function on AboutHandler? Which variables should I need, $groupDao, $groupMembershipDao, $allGroups, $teamInfo, $groups ? I just want to show the name of the group, names and surnames of every boarder and the link to the bio.



Thannks again!

Sergi Villanueva.
svillanueva
 
Posts: 74
Joined: Fri Jan 18, 2008 4:20 am
Location: Barcelona

Re: Accessing to variables

Postby asmecher » Fri Mar 07, 2008 9:31 am

Hi Sergi,

You should only have to modify TemplateManager. You'll need to get the GroupDAO and GroupMembershipDAO using the DAORegistry, then fetch group and membership data using those DAOs and assign it to the template manager so that it can be used in any template. I'd suggest looking at the OJS Technical Reference (available from the documentation page) for more info on DAOs and communicating with templates.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 9097
Joined: Wed Aug 10, 2005 12:56 pm

Re: Accessing to variables

Postby svillanueva » Tue Mar 11, 2008 1:51 am

Thanks for your answer, I finally got it. I'm not sure whether is the best way or not but I adapted part of the code of the editorialTeam function in AboutHandler.inc.php for the TemplateManager and added the function editorialTeamBio adapting it too, in order to see the bio information when I click on a boarder. It works, but do you see any problems on these changes?




Regards,

Sergi Villanueva.
svillanueva
 
Posts: 74
Joined: Fri Jan 18, 2008 4:20 am
Location: Barcelona


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 7 guests

cron