jfh-main-profile-json [Jcink.com Wiki]

Differences

This shows you the differences between the selected revision and the current version of the page.

jfh-main-profile-json 2018/09/07 20:40 jfh-main-profile-json 2019/02/10 14:07 current
Line 3: Line 3:
HTML Templates allow use of variables for your convenience to restructure the board layout. The main profile HTML template contains some variables that utilize JSON, or JavaScript Object Notation that allow you to build your own layout around the items. Examples and scripts will be provided below for each JSON variable. HTML Templates allow use of variables for your convenience to restructure the board layout. The main profile HTML template contains some variables that utilize JSON, or JavaScript Object Notation that allow you to build your own layout around the items. Examples and scripts will be provided below for each JSON variable.
 +Currently, only some of the portal profile elements are available as variables. See the availability chart below. We're working to add more profile elements as variables, so please check back.
 +
 +^ Profile Element      ^ Available?      ^
 +| Recent Visitors|    Yes    |
 +| Comments    |    Yes      |
 +| Topics    |    No    |
 +| Posts    |    No    |
 +| Friends    |    No    |
 +| Settings    |    No    |
====== Understanding JSON ====== ====== Understanding JSON ======
Line 44: Line 53:
This is the basic idea behind the use of JSON. For an in-depth tutorial on JSON we recommend the W3schools JSON Intro: http://www.w3schools.com/js/js_json_intro.asp This is the basic idea behind the use of JSON. For an in-depth tutorial on JSON we recommend the W3schools JSON Intro: http://www.w3schools.com/js/js_json_intro.asp
- 
- 
Line 52: Line 59:
The variable for the most recent comments made on the profile is <!-- |comments| -->, and the output when parsed by the code below looks like this: The variable for the most recent comments made on the profile is <!-- |comments| -->, and the output when parsed by the code below looks like this:
-{{http://jcink.com/wiki/i/recent_comments.png?|Recent Comments)}}+{{https://jcink.com/wiki/i/recent_comments.png?|Recent Comments)}}
The complete code to display the above is provided here, and also integrates the comment_form, **copy and paste it** into the Main Profile template: The complete code to display the above is provided here, and also integrates the comment_form, **copy and paste it** into the Main Profile template:
Line 84: Line 91:
</div> </div>
</code> </code>
 +
====== Visitors ====== ====== Visitors ======
 +
 +The variable for the most recent visitors on the profile is <!-- |visitors| -->, and the output when parsed by the code below looks like this:
 +
 +{{https://jcink.com/wiki/i/recent_visitors.png?|Recent Visitors)}}
 +
 +The complete code to display the above is provided here **copy and paste it** into the Main Profile template:
 +
 +<code><style>
 +.largeframe,.smallframe{text-align: center;padding:4px;margin-top:auto;margin-bottom:auto;width: 52px;height: 52px;background: transparent;float:right;}
 +</style>
 +
 +<div id="profile-lastvisitors" class="tableborder" style="padding:1px; max-width: 200px;"><table cellspacing="1" cellpadding="6" width="100%"><tbody><tr><td class="maintitle" valign="top">Last Visitors</td></tr></tbody></table><!-- Visit 1 -->
 +
 + <script>
 + function print_visitor(row){
 +
 + document.write('<div class="row2">');
 + document.write('<div class="largeframe">');
 + document.write(row.visitor_avatar+'</div>');
 + document.write('<div style="position:absolute;z-index:2;">');
 + document.write('<strong><a href="?showuser='+row.visitor_id+'">'+row.visitor_name+'</a></strong></div>');
 + document.write('<br>');
 + document.write('<br>');
 + document.write('<div class="desc">'+row.visitor_date+'</div>');
 + document.write('<br>');
 + document.write('<br>');
 + document.write('</div>');
 +
 + }
 +
 + var visitor = <!-- |visitors| -->;
 + for (var i = 0; i < visitor.length; i++){
 + print_visitor(visitor[i]);
 + }
 + </script>
 +</div>
 +</code>
 +
 +Please note that if you were using this variable previously, spelling errors were corrected in the variable names.
 
jfh-main-profile-json.1536367201.txt.gz · Last modified: 2018/09/07 20:40 by jcink