OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



[Solved]Global variables for template files??

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

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

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

[Solved]Global variables for template files??

Postby stabb » Mon Aug 13, 2007 7:47 am

Hi there Alec

Im not sure if im using the right terminology here, but where can I get a list of all 'global variables'?
ie all variables I can access via the templates.
I dont have *nix unfortunately. not yet, so I cant use any command line prompts.


Kind regards
James
Last edited by stabb on Mon Aug 13, 2007 11:33 am, edited 3 times in total.
stabb
 
Posts: 47
Joined: Sat Mar 31, 2007 10:06 pm

Re: Global template variables..??

Postby asmecher » Mon Aug 13, 2007 9:14 am

Hi James,

As long as assignParams() is called on the email template, the following variables will always be available:
  • articleTitle
  • journalName
  • sectionName
  • articleAbstract
  • authorString
  • ...and in version 2.2, articleId will also be available.
These are assigned in classes/mail/ArticleMailTemplate.inc.php.

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

Re: Global template variables..??

Postby stabb » Mon Aug 13, 2007 10:54 am

Hi there Alec

The $journalName parameter didnt seem to be available when I used it in
ojs/templates/manager/index.tpl

Are these available from the templates/__.tpl files?
stabb
 
Posts: 47
Joined: Sat Mar 31, 2007 10:06 pm

Re: Global template variables..??

Postby asmecher » Mon Aug 13, 2007 11:20 am

Hi James,

Sorry, I misread your initial request -- the list I provided above was for email templates. For common variables available to Smarty templates, have a look through classes/template/TemplateManager.inc.php, particularly in the constructor function. If you want to get the journal title, you can use something like "{$currentJournal->getTitle()}".

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

Re: Global variables..??

Postby stabb » Mon Aug 13, 2007 11:28 am

aha $currentJournal.
Thanks Alec. I ended up using {if $currentURL==""} so this will make things cleaner.
stabb
 
Posts: 47
Joined: Sat Mar 31, 2007 10:06 pm


Return to OJS Technical Support

Who is online

Users browsing this forum: Baidu [Spider] and 3 guests