[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
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.
stabb
Posts: 47
Joined: Sat Mar 31, 2007 10:06 pm
Contact:

[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.

asmecher
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm
Contact:

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

stabb
Posts: 47
Joined: Sat Mar 31, 2007 10:06 pm
Contact:

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?

asmecher
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm
Contact:

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

stabb
Posts: 47
Joined: Sat Mar 31, 2007 10:06 pm
Contact:

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.


Return to “OJS Technical Support”

Who is online

Users browsing this forum: No registered users and 2 guests