Skip to content

Instantly share code, notes, and snippets.

@Phize
Created April 29, 2012 12:56
Show Gist options
  • Save Phize/2550257 to your computer and use it in GitHub Desktop.
Save Phize/2550257 to your computer and use it in GitHub Desktop.
PHPTAL: a PHPTALES to check if a value exists and is not empty string.
function phptal_tales_notEmpty($src, $nothrow) {
$src = trim($src);
if (ctype_alnum($src)) return 'isset($ctx->' . $src . ') && "" !=== $ctx->' . $src;
return '(null !== ($path = $ctx->path($ctx,' . PHPTAL_Php_TalesInternal::string($src) . ', true)) && "" !== $path)';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment