Link | gf_include_random |
Author | Gaetano Frascolla |
Category | Include |
Version | 8.x |
License | Public Domain |
Posted | 24 Oct 2007 |
Updated | 24 Oct 2007 |
More by this author... |
This tag returns a random element included in a determined directory. It can be used to include random images or pages.
[include:(gf_include_random:'/path/')]
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
define_tag:'gf_include_random', -optional='path'; if:(local_defined:'path')&&(file_exists:(#path)); var:'array_path'=(File_ListDirectory: (#path)); var:'size_path'=($array_path)->Size; var:'array_clean_path'=(Array); loop:($size_path); var:'element'=($array_path)->(get:(loop_count)); if:!(file_isdirectory:($element)); $array_clean_path->(insert:($element)); /if; /loop; var:'size_clean_path'=($array_clean_path)->Size; var:'include_number'=(Math_Random: -Min=1, -Max=($size_clean_path)+1); var:'element_include'=($array_clean_path)->(get:($include_number)); var:'result'=(#path)+($element_include); return:($result); /if; /define_tag;
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft