Skip to content

Commit

Permalink
Merge pull request #1404 from MitrahSoft/Added_a_examples_31-08-23
Browse files Browse the repository at this point in the history
Added a examples for lucee docs
  • Loading branch information
zspitzer authored Sep 9, 2023
2 parents 2bd3491 + e53170d commit f45105a
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docs/03.reference/01.functions/isuserinrole/_examples.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
*There are currently no examples for this function.*
```lucee+trycf
<cflogin>
<cfloginuser name = "test" password = "password" roles = "user,admin,editor">
</cflogin>
<cfdump var="#IsUserInRole(role_name="admin")#" />
```
8 changes: 8 additions & 0 deletions docs/03.reference/01.functions/sanitizehtml/_examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
```luceescript+trycf
html = '<!DOCTYPE html><html><body><h2>HTML Forms</h2><form action="/action_page.cfm"><label for="fname">First name:</label><br><input type="text" id="fname" name="fname"value="Pothys"><br><br><br><input type="submit" value="Submit">
</form><p>If you click the "Submit" button, the form-data will be sent to a page called "/action_page.cfm".</p></body></html>';
writeDump(var=html, label='html');
test = SanitizeHtml(html);
writeDump(var=test, label='SanitizeHtml');
```
19 changes: 19 additions & 0 deletions docs/03.reference/05.objects/query/rowbyindex/_examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
```lucee+trycf
<cfscript>
q_tag = queryNew("tag,id")
tags = getTagList();
loop collection="#tags.cf#" item="tag" {
res = queryAddRow(q_tag);
QuerySetCell(q_tag, "tag", tag, res);
QuerySetCell(q_tag, "id", res, res);
}
</cfscript>
<cfquery name="q_tags_indexed" indexName="tag" dbtype="query">
select * from q_tag;
</cfquery>
<cfscript>
writeDump(q_tags_indexed.rowByIndex("tag",5));
</cfscript>
```
7 changes: 7 additions & 0 deletions docs/03.reference/05.objects/string/sanitizehtml/_examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```luceescript+trycf
html = '<!DOCTYPE html><html><body><h2>HTML Forms</h2><form action="/action_page.cfm"><label for="fname">First name:</label><br><input type="text" id="fname" name="fname"value="Pothys"><br><br><br><input type="submit" value="Submit">
</form><p>If you click the "Submit" button, the form-data will be sent to a page called "/action_page.cfm".</p></body></html>';
writeDump(var=html, label='html');
test = html.sanitizeHTML();
writeDump(var=test, label='string.SanitizeHtml');
```

0 comments on commit f45105a

Please sign in to comment.