Difference between revisions of "User:Emanuele/sandbox/smcFunc" From Online Manual

Jump to: navigation, search
(Updating to match new version of source page)
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
===db_query===
+
Bulletin board codes or BBCodes are a way to format posts in SMF and in many other places online. For an explanation of the buttons in the post page, see [[#Nesting BBCodes|Basic Bulletin Board Codes]]. This article explains the important concept of nesting. Test.
Current structure:
 
{{code|1=<nowiki>
 
'''Usage''' $smcFunc['db_query'] (identifier, query, values, connection)
 
* Works Similar to how db_query worked in 1.x versions.
 
* Identifier is used for identifying specific queries that will be handled specially.
 
* Values is an array of values you are intending to use in the query.
 
'''Example'''
 
<pre>            $result = $smcFunc['db_query'](''', '
 
                SELECT poster_time
 
                FROM {db_prefix}messages
 
                WHERE id_msg = {int:id_msg}
 
                LIMIT 1',
 
                array(
 
                    'id_msg' =&gt; $user_settings['id_msg_last_visit'],
 
                )
 
            );</pre>
 
</nowiki>}}
 
  
Proposed structure:
+
==Nesting BBCodes==
{{code|1=<nowiki>
 
'''Usage''' - {{code|1=$smcFunc['db_query'] (identifier, query, values, connection)}}
 
'''Description''' - Works Similar to how db_query worked in 1.x versions.
 
'''Parameters''':
 
*'''identifier''' - is used for identifying specific queries that will be handled specially.
 
*'''query''' - is the actual query
 
*'''values''' - array of values...etc. (optional if no values used in the query)
 
*'''connection''' - database connection (optional)
 
'''Example''' - {{code|1=&nbsp;            $result = $smcFunc['db_query'](''', '
 
                SELECT poster_time
 
                FROM {db_prefix}messages
 
                WHERE id_msg = {int:id_msg}
 
                LIMIT 1',
 
                array(
 
                    'id_msg' =&gt; $user_settings['id_msg_last_visit'],
 
                )
 
            );
 
}}
 
'''Return''' - a query resource or '''false''' on error.
 
</nowiki>}}
 
  
 +
The general format of a BBCode has three parts, an opening tag, the inside content and a closing tag, as shown below:
 +
{{code|[open]      text inside      [/close]
 +
[b]        bold text        [/b]}}
  
Attempting a template:
 
{{code|1=<nowiki>
 
  
 +
===Bold and italic text===
  
{{#if: {{{function|}}}|{{#if: {{{wikiheader|}}}|{{
+
You can place one BBCode tag inside another as long as ''the child tag is closed before the parent tag''. For example, the correct way to make bold and italic text is:<!-- <div class="codeheader">: <a href="javascript:void(0);" onclick="return smfSelectText(this);" class="codeoperation"></a></div> -->{{code|[b][i]bold & italic text[/i][/b]}}
#switch: {{{wikiheader}}}
+
This is shown more easily when the tags are indented:{{code|[b]
|1=={{ucfirst:{{{function}}}}}=
+
    [i]
|2==={{ucfirst:{{{function}}}}}==
+
        bold & italic text
|3===={{ucfirst:{{{function}}}}}===
+
    [/i]
|4===== {{ucfirst:{{{function}}}}}====
+
[/b]}}
|#default
+
The next example is incorrectly nested, which is easily shown with indented tags:
}}
+
{{code|[b][i]bold & italic text[/b][/i]
__NOEDITSECTION__ }}
+
[b]
{{#if: {{{usage|}}}|{{#set:BBC_button=[[File:{{{button}}}]]}}<p>'''button''': [[File:{{{button}}}]]</p>|}}<!--
+
    [i]
-->{{
+
        bold & italic text
#if: {{{usage|}}}|
+
[/b]
 +
    [/i]}}
  
<p>
+
==See Also==
'''Usage''': {{code|1={{{usage}}}}}</p>|}}<!--
 
-->{{#if: {{{description|}}}|<p>'''Description''':</p>{{{description}}}|}}<!--
 
-->{{#if: {{{parameters|}}}|<p>'''Parameters''':</p>{{{parameters}}}|}}<!--
 
-->{{#if: {{{example|}}}|<p>'''Example''':</p>{{code|1=&nbsp;{{{example}}}}}|}}<!--
 
-->{{#if: {{{return|}}}|<p>'''Return''':</p>{{{return}}}|}}<!--
 
  
-->|'''Template must be given a tag}}
+
* [[Basic bulletin board codes]]
<noinclude>{{documentation}}</noinclude>
+
* [[Alphabetical list of all bulletin board codes]]
 
+
{{Other languages}}
 
+
[[Category:About Bulletin Board Code]]
</nowiki>}}
 

Latest revision as of 14:37, 12 July 2011

Bulletin board codes or BBCodes are a way to format posts in SMF and in many other places online. For an explanation of the buttons in the post page, see Basic Bulletin Board Codes. This article explains the important concept of nesting. Test.

Nesting BBCodes

The general format of a BBCode has three parts, an opening tag, the inside content and a closing tag, as shown below:

[open]      text inside      [/close]
[b]         bold text        [/b]


Bold and italic text

You can place one BBCode tag inside another as long as the child tag is closed before the parent tag. For example, the correct way to make bold and italic text is:

[b][i]bold & italic text[/i][/b]

This is shown more easily when the tags are indented:

[b]
    [i]
        bold & italic text
    [/i]
[/b]

The next example is incorrectly nested, which is easily shown with indented tags:

[b][i]bold & italic text[/b][/i]
[b]
    [i]
        bold & italic text
[/b]
    [/i]

See Also