Reading an html galley, and displaying below abstract - Plugin

I tried your parser. However the plugin page in the journal manager just kept on loading. Is it not yet ready?

Yep. Will be ready soon, but not yet. Although eternal loading is a strange behavior. What do you see in PHP error log?

you could achieve what you are hoping fairly easily by using one of the plugins @Vitaliy mentioned as base.

Just check for html instead of xml: embedGalley/ at master · ajnyga/embedGalley · GitHub

And skip the conversion: embedGalley/ at master · ajnyga/embedGalley · GitHub

What you do need to think about is what to do with the HTML. You could replace the _parseXML function with a function that only gets the HTML between the body tags. If you embed the full html, you will end up with unvalid html.

where do I find a list of the functions associated with the objects?



Where dio I find a reference for these?


My PHP error log has been de activated by the host server. Is there any other way to find out?

there is not much reference available, I usually just see what others have done in the plugins or in the OJS core.

See @asmecher’s answer here: [OJS 3] Technical Reference?

There is also a link here, if this helps you:

1 Like

By default it’s apache error.log. Without error logs its impossible to find out causes of troubles. OK, I will prepare plugin for front-end developing at the end of the week. You can try than.

1 Like

Found that site as well.

I have seen your and vitaliy’s code. I think I am slowly getting there.

If i am correct, first register the plugin to a hook, then get the html content: i will be using DOMdocument to select only the body, and then strip the

Then I attach that to the smarty template (this is where I dtill need smoe time)

If I download one plugin, how can I add it to OJS? the admin pages still do not show a way of doing this. Should I just upload by ftp in the directory?



That sounds about right. Of course a lot depends on the HTML file you are embedding.

I usually upload the plugins with ftp. If you upload the through the backend, I think they have to be tar.gz compressed.

I am not managing at all……

I have tried using ajnyga’s plugin, and started to modify, but I do not know how the plugin gets called in the first place.

I have a button on the page, to load this html: but I do not understand how to trigger the plugin, like the default action when one clicks on the Galley links.

I am actually thinking of doing all this by addin some php file, and load dynamiccally via javascript, but I still need access to the article classes as used by OJS

The lack of a tutorial / reference to formulate a plugin is frustrating.


The way embedGalley works is that it detects whether the article has XML galleys. If it has, it will then open the XML galley file, convert it to HTML, run a few HTML filters and then embed that HTML to the article abstract page.

You just need to have the plugin activated and add a JATS XML galley to an article. Everything else is automatic.

If you click on a galley link, it will open a different view than the abstract page. I understood from your first post, that you want it under the abstract?

There is no need fully understand OJS code to make a plugin. Moreover OJS is complicated system, that evolved for a very long time.
On what stage you have stuck?:
Getting HTML from a galley?
Assigning variables to smarty?
Making Smarty template?
Connecting to a hook?

Plugin requires minimum PHP7.0
What version you are using?

5.6. If i use 7, my website does not show up only.

PHP7 requires mysqli instead of mysql driver, did you try change it in your OJS config?

No. i will try doing it.

I have made a lot of progress over the last few days.

I have managed to read the html galley, and get it into the abstract page.

However, I am not using a plugin approach - i will try that later once I get everything in order. I have instead hijacked the code, and included some php to deal with the requests.

Now i need to know how to get the Journal short path. Would anyone know how to access it from php, smarty?

thanks again


I retrieve XML from plugin with this code:

$articleArrays = $smarty->get_template_vars('article');
foreach ($articleArrays->getGalleys() as $galley) {
    if ($galley && in_array($galley->getFileType(), array('application/xml', 'text/xml'))) {
	  $xmlGalley = $galley;

Maybe, if you change xml to html, you retrieve needed galley?

Creating DOM:

$document = new DOMDocument;

After this you can do standard operations with DOM and save it.
Assigning a variable to the smarty.

$smarty->assign('document', $document);

your smarty template:

$output .= $smarty->fetch($this->getTemplatePath() . 'yourSmarty.tpl');

You already have almost ready code from @ajnyga`s EmbedGalley plugin. There is nothing really think about. Just change XML to HTML galley and delete unnecessary parsing.

I have seen that code.

I have tried that, but for some reason it was not working at the time. Also, I did not want to show all the article immedicately with the abstract, but have a button to display the whole article on demand.

I might reconsider my approach, but will speak to my colleagues first.


1 Like