OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



How to tell what page the user is on in smarty templates.

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.

How to tell what page the user is on in smarty templates.

Postby Califer » Fri Sep 06, 2013 3:00 pm

I'm working in the smarty templates and I need to know how to tell whether I'm on the main landing page for a journal or not. Any help is appreciated.
Califer
 
Posts: 14
Joined: Thu Jan 21, 2010 2:53 pm

Re: How to tell what page the user is on in smarty templates

Postby JasonNugent » Mon Sep 09, 2013 7:24 am

hi,

The main landing page for a journal is the template in templates/index/journal.tpl. That template will load the other ones to build the full page. Did you need to know if you were on a journal index page on a different template that is loaded further down?

Regards,
Jason
JasonNugent
Site Admin
 
Posts: 888
Joined: Tue Jan 10, 2006 6:20 am

Re: How to tell what page the user is on in smarty templates

Postby Califer » Wed Sep 11, 2013 8:59 am

Yes, I need to know if I'm the journal index page on a different template.

They want a lot of the elements removed for their journal, including most of the header stuff. But they want to use step 5.3 in the set up for the alternate header on pages that are not the main landing page. Since none of the alternate header stuff shows up when we change it, I assume that it's part of what's being skipped for their journal.
Califer
 
Posts: 14
Joined: Thu Jan 21, 2010 2:53 pm

Re: How to tell what page the user is on in smarty templates

Postby JasonNugent » Fri Sep 13, 2013 6:31 am

Hi Califer,

The pages/index/IndexHander.inc.php file determines which template to load for 'index' requests, whether it's for the site or a specific journal. If you look at the index() method in that file, you'll see the logic where the determination is made. You could use the $templateMgr variable to assign something that you could look for in a sub template, if you liked, only in the case where the index page was for a journal. Then you could test for it in your template:

Code: Select all
   {if $myVariable} do something {else} do something else {/if}


Alternatively, you might use one of the existing variables set in that block. That would be one less customization to maintain if you upgraded OJS in the future.

Regards,
Jason
JasonNugent
Site Admin
 
Posts: 888
Joined: Tue Jan 10, 2006 6:20 am


Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot] and 5 guests