OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Get Variable for external script

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.

Get Variable for external script

Postby jauhari » Fri Dec 29, 2006 10:54 pm

Hello team, I have question about how to get OJS variable to work with my external script,

This my example
On my OJS we have URL like this
http://myojs.net/index.php?journal=myju ... ge=manager

Like that URL the journal is myjournal, so this what I need,
I want get the variable of that journal? how to do that?

That I mean, on my manajer page, I was add link that if some one click that link, the page will go to my external script and bring the journal variable.

More detail
my external script locate in http://myojs.net/myscript/

So when link on page manejer click will do like this
http://myojs.net/myscript/?journal=myjournal
How to do that?

I am a newbie in PHP and Smarty of course in OJS too
Please help me to solve my problem

Thanks

Nurudin Jauhari
jauhari
 
Posts: 2
Joined: Fri Dec 29, 2006 8:43 am

Postby asmecher » Sat Dec 30, 2006 11:38 am

Hi Nurudin,

The easiest way to do this is probably to hack a {url ...} function call. If your PHP script is in the same directory as OJS's index.php, in a file called my_script.php, you can add something like the following line to an OJS template:

{url|replace:'index.php':'my_script.php' op="doSomething"}

This will probably provide several extra parameters, but it should provide the journal parameter as you require.

Regards,
Alec Smecher
Open Journal Systems Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/
asmecher
 
Posts: 8610
Joined: Wed Aug 10, 2005 12:56 pm

Postby jauhari » Sun Dec 31, 2006 10:08 pm

Thanks Alec Smecher

I was do that and that running ok, but how tweak it? I was succes to push to my external script, but why still have another parameter that I don't need id? my URL become like this
http://myojs.net/myscript/?journal=myju ... oSomething

Thay I mean, I want to delete another parameter that I don't need it, like page parameters and op Parameters

Please help me

Thanks
jauhari
 
Posts: 2
Joined: Fri Dec 29, 2006 8:43 am

Postby asmecher » Mon Jan 01, 2007 3:42 pm

Hi Nurudin,

If you want more control over the URL, you'll need to do something a little different. In the Page class that calls the template you want to modify, add a line of code:
Code: Select all
$templateMgr->assign('requestedJournalPath', Request::getRequestedJournalPath());
...then, in the template...
Code: Select all
<a href="http://www.some-url-goes-here.com/path/to/script.cgi?journal={$requestedJournalPath|escape}">Link</a>

Regards,
Alec Smecher
Open Journal Systems Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/
asmecher
 
Posts: 8610
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 6 guests