Customizing SMF > SMF Coding Discussion

Looking for a shortcut to display some predefined text

(1/3) > >>

Vahid‎‎ ‎Damanafshan:
I'm looking for a shortcut like {Some_Rules} which while I put it in the post body or PM's body, it display some predefined text such as:

--- Code: ---1- bla bla bla ...
2- bla bla bla ...
3- bla bla bla ...
--- End code ---

MrPhil:
Look at adding a BBCode tag, such as [rules]. Either use a mod to add the new tag, or add it in Sources/Subs.php, alongside the existing tags:

--- Code: --- array(
'tag' => 'rules',
'type' => 'closed',
'content' => '<ol><li>rule 1</li>
                                                  <li>rule 2</li>
                                                  <li>rule 3</li></ol>',
'block_level' => true,
),
--- End code ---

Making an icon and button for the Post page is Extra Credit.

ѕησω:

--- Quote from: MrPhil ---Making an icon and button for the Post page is Extra Credit.

--- End quote ---

The massive array list in subs-editor.php?

Vahid‎‎ ‎Damanafshan:

--- Quote from: MrPhil on June 27, 2012, 08:46:22 AM ---Look at adding a BBCode tag, such as [rules]. Either use a mod to add the new tag, or add it in Sources/Subs.php, alongside the existing tags:

--- Code: --- array(
'tag' => 'rules',
'type' => 'closed',
'content' => '<ol><li>rule 1</li>
                                                  <li>rule 2</li>
                                                  <li>rule 3</li></ol>',
'block_level' => true,
),
--- End code ---

--- End quote ---
‎Thank‎ you, this is exactly what I was looking ‎for,‎ but I have a problem with it: ‎
When I want to replace my Persian strings with the "rule 1"‎,‎ "rule 2", ..., these strings do not ‎appear‎ in the output.‎ How to solve this?
By the way, please note that Persian is a right-to-left language.

MrPhil:
OK, Subs.php is not a good place for any text which is not pure ASCII. It would also limit your [rules] to one language. Perhaps you could try doing something with 'content' => $txt['rules'], and $txt['rules'] defined in one of the language files. It appears that Themes/default/languages/index.<language>.php (where <language> is something like english is available to Sources/Subs.php. The $txt['rules'] entry could be <ol> through </ol> (including the HTML list tags). You might play around with that.

Navigation

[0] Message Index

[#] Next page

Go to full version