[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] Phrases, Pins and If



Ah you're embedding XML inside XML. don't do that.

Inside test attributes, use the epscript syntax https://wiki.eprints.org/w/EPScript#not_equals<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwiki.eprints.org%2Fw%2FEPScript%23not_equals&data=01%7C01%7C%7C6eae8ef7ef414579e1cd08d629e921a1%7C4a5378f929f44d3ebe89669d03ada9d8%7C1&sdata=TzfqzxosgzUeKZRAAosJAZ79usALCqafQCOhBXgis6Q%3D&reserved=0>

However you can't put <if> logic inside phrase files. Logic goes in citation files which use phrase files. The intention is that the phrase file is just the words (and gaps) that can be translated into other languages.

In this case you have two choices, either do it in perl, or make a citation file. If you're doing it as a package to share with others then absolutely make the mail a citation file, passing all relevant values in. However, if it's a local setup for just you, do it in Perl, it's less work.

On 04/10/2018 10:18, James Kerwin via Eprints-tech wrote:
Hi All,

I'm looking for some guidance with this problem:

I have an EPrints phrase that uses pins. I can see where the pins are set up and create my own, so I could solve this using Perl.

I want to include a condition in my phrase that depends on the value contained in the pin. Example:

<epp:phrase id="eprint_thesis_notify_mail">
The embargo period has been set at: <epc:pin name="emperiod" /> with the reason being given as testZZZZZZZZZZZZZZZZZtest:<br/>
<epc:if test="emreason = ''"> No reason has been provided.</epc:if>
<epc:if test="<epc:pin name='emreason' /> != ''"> <epc:pin name="emreason" /> <br/><br/></epc:if>
</epp:phrase>

I've used different format in each IF. I comment one out depending on which I'm testing. The second one won't work which I'm not surprised about). The pin in question is this "emreason" pin. Importantly, the phrase is in the perl script like this:

$mail = $repo->html_phrase( "eprint_thesis_notify_mail", %pins );

I could do what I need in the Perl script, but this seems like a good chance to become more familiar with phrases, plus I want to use a similar set-up for another idea I have.

If anybody could point me in the right direction, I would really appreciate it.

Thanks,
James



*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=01%7C01%7C%7C27c82744ed744132c79308d629dac99b%7C4a5378f929f44d3ebe89669d03ada9d8%7C1&amp;sdata=4Z8XdnSAcR2YgpnSjm244l0h1eHwk18AZa243aw4ZNM%3D&amp;reserved=0<https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&data=01%7C01%7C%7C6eae8ef7ef414579e1cd08d629e921a1%7C4a5378f929f44d3ebe89669d03ada9d8%7C1&sdata=DTSq2JV4zf5NO5mXYm60JNhlxvMmMmFg6%2F%2FX3leln%2F0%3D&reserved=0>
*** EPrints community wiki: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=01%7C01%7C%7C27c82744ed744132c79308d629dac99b%7C4a5378f929f44d3ebe89669d03ada9d8%7C1&amp;sdata=gzQnlA1nbV0W6faYBgjBONCCVhIIU1qwhDxStpehd7k%3D&amp;reserved=0<https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&data=01%7C01%7C%7C6eae8ef7ef414579e1cd08d629e921a1%7C4a5378f929f44d3ebe89669d03ada9d8%7C1&sdata=xwrNdLO8uuVbXkNBo8BbzjPgR8dszhbN0jxeamg3C7M%3D&reserved=0>
*** EPrints developers Forum: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fforum.eprints.org%2F&amp;data=01%7C01%7C%7C27c82744ed744132c79308d629dac99b%7C4a5378f929f44d3ebe89669d03ada9d8%7C1&amp;sdata=HUO04gW9hxFIm3n0UR4rJ6Ma2b47j9ir%2BN0Oqej1ndM%3D&amp;reserved=0<https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fforum.eprints.org%2F&data=01%7C01%7C%7C6eae8ef7ef414579e1cd08d629e921a1%7C4a5378f929f44d3ebe89669d03ada9d8%7C1&sdata=jBzn6IpL5xhhqb2S3ZEO4UTgflfX3b9gONGBPZve5Do%3D&reserved=0>



--
Christopher Gutteridge <totl at soton.ac.uk><mailto:totl at soton.ac.uk>
You should read our team blog at http://blog.soton.ac.uk/webteam/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20181004/d1c1f5d4/attachment-0001.html