hi
so, the following snippet works, but i am wondering if there’s a mo’ betta way to do it - specifically, if a condition is not met i have it just saying, " ". For some reason that bugs me, i can’t help but feel like i’m doing something bad...
also, am i being paranoid with testing for the existence of a local file? i would if this was just a bit of procedural laziness in a normal web page, but i would love to know if it’s needed in modx.
without further ado, here is the snippet - made to quickly add a js file to the head, for one of my designer clients to use:
<?php
$file = !empty($file) ? file_exists($file) : '' ? $modx->regClientStartupScript($file) : '';