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

Jump to: navigation, search
(Created page with "===db_query=== Current structure: {{code|1=<nowiki> '''Usage''' $smcFunc['db_query'] (identifier, query, values, connection) * Works Similar to how db_query worked in 1.x version...")
 
(Updating to match new version of source page)
 
(11 intermediate revisions by 2 users 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>}}


or the same without list (except for parameters, that should always be a list)
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:
===Bold and italic text===
{{code|1=<nowiki>


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]}}
This is shown more easily when the tags are indented:{{code|[b]
    [i]
        bold & italic text
    [/i]
[/b]}}
The next example is incorrectly nested, which is easily shown with indented tags:
{{code|[b][i]bold & italic text[/b][/i]
[b]
    [i]
        bold & italic text
[/b]
    [/i]}}


{{#if: {{{function|}}}|{{#if: {{{wikiheader|}}}|{{
==See Also==
#switch: {{{wikiheader}}}
|1=={{ucfirst:{{{function}}}}}=
|2==={{ucfirst:{{{function}}}}}==
|3===={{ucfirst:{{{function}}}}}===
|4===== {{ucfirst:{{{function}}}}}====
|#default
}}
__NOEDITSECTION__ }}
{{#if: {{{usage|}}}|{{#set:BBC_button=[[File:{{{button}}}]]}}<p>'''button''': [[File:{{{button}}}]]</p>|}}<!--
-->{{
#if: {{{usage|}}}|


<p>
* [[Basic bulletin board codes]]
'''Usage''': {{code|1={{{usage}}}}}</p>|}}<!--
* [[Alphabetical list of all bulletin board codes]]
-->{{#if: {{{description|}}}|<p>'''Description''':</p>{{{description}}}|}}<!--
{{Other languages}}
-->{{#if: {{{parameters|}}}|<p>'''Parameters''':</p>{{{parameters}}}|}}<!--
[[Category:About Bulletin Board Code]]
-->{{#if: {{{example|}}}|<p>'''Example''':</p>{{code|1=&nbsp;{{{example}}}}}|}}<!--
-->{{#if: {{{return|}}}|<p>'''Return''':</p>{{{return}}}|}}<!--
 
-->|'''Template must be given a tag}}
<noinclude>{{documentation}}</noinclude>
 
 
</nowiki>}}

Latest revision as of 18: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

Languages English  · italiano


Advertisement: