Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save steveosoule/503f336990df4abbfe6ead7ec6d25578 to your computer and use it in GitHub Desktop.
Save steveosoule/503f336990df4abbfe6ead7ec6d25578 to your computer and use it in GitHub Desktop.
Miva - Full mvt:do with Load Module Path, Check Active, & Check Installed
<mvt:comment>One-Time Setup</mvt:comment>
<mvt:do file="g.Module_Library_DB" name="l.module_loaded" value="Module_Load_Code_Cached('tg_transients', l.tg_transients_module)" />
<mvt:do file="g.Module_Library_DB" name="l.storemodule_installed" value="StoreModule_Load_Cached(l.tg_transients_module:id, 'util', l.null)" />
<mvt:if expr="l.tg_transients_module:active AND l.storemodule_installed">
<mvt:assign name="g.Module_TG_Transients" value="g.Module_Root $ l.tg_transients_module:module" />
<mvt:else>
<mvt:assign name="g.Module_TG_Transients" value="''" />
</mvt:if>
<mvt:comment>Each Usage</mvt:comment>
<mvt:if expr="NOT ISNULL g.Module_TG_Transients">
<mvt:do file="g.Module_TG_Transients" name="l.result" value="Set_Transient( 'foo', 'bar', 60*60*24 )" />
<mvt:do file="g.Module_TG_Transients" name="l.value" value="Get_Transient( 'foo' )" />
foo=<mvt:eval expr="l.value" />
</mvt:if>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment