Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Thema gestartet von: Ar3k in November 06, 2004, 09:39:48 VORMITTAG

Titel: [offtopic]BOX[/offtopic]
Beitrag von: Ar3k in November 06, 2004, 09:39:48 VORMITTAG
Hello.
Sorry but my english is not so good. But i will try it. ;)

I will make an other painted box when i enter [offtopic] [/offtopic]
like [ code ] [ /code ]

Thx 4 help
Titel: Re: [offtopic]BOX[/offtopic]
Beitrag von: [Unknown] in November 06, 2004, 06:00:33 NACHMITTAGS
http://www.simplemachines.org/community/index.php?topic=12138.0

'~\[offtopic\](.+?)\[/offtopic\]~i' => '<div style="margin: 1px; padding: 1px; background-color: #eeeeee; color: black; border: 1px solid black;">$1</div>',

-[Unknown]
Titel: Re: [offtopic]BOX[/offtopic]
Beitrag von: diplomat. in November 07, 2004, 01:39:51 NACHMITTAGS
reading that, i get confused a little. i was trying to add a spoiler tag but without the javascript...like a code or quote box, but the text is the same color as the bg of the spoiler box. how would i do that?
Titel: Re: [offtopic]BOX[/offtopic]
Beitrag von: [Unknown] in November 07, 2004, 06:26:58 NACHMITTAGS
The same way I posted with the offtopic box.

-[Unknown]
Titel: Re: [offtopic]BOX[/offtopic]
Beitrag von: diplomat. in November 07, 2004, 07:24:05 NACHMITTAGS
where exactly do i add that part?
Titel: Re: [offtopic]BOX[/offtopic]
Beitrag von: [Unknown] in November 07, 2004, 07:26:04 NACHMITTAGS
Read my first post in the topic I linked to.

-[Unknown]
Titel: Re: [offtopic]BOX[/offtopic]
Beitrag von: diplomat. in November 07, 2004, 08:17:43 NACHMITTAGS
yeah thats where i get confused. u have to add two things from the other thread im assuming...but on this
'~\[spoiler\](.+?)\[/spoiler\]~i' => '<div style="margin: 1px; padding: 1px; background-color: #eeeeee; color: black; border: 1px solid black;">$1</div>',

i dunno where i would insert that part by looking at the other thread. (keep in mind that im a nooby)
Titel: Re: [offtopic]BOX[/offtopic]
Beitrag von: [Unknown] in November 07, 2004, 08:19:51 NACHMITTAGS
Zitat von: [Unknown] in Juni 07, 2004, 09:35:45 VORMITTAG
In the next version, you'll find this in the same file:
// [me=Comment]does something[/me]
'~\[me=((?:&quot;)?)(.{1,80}?)\\1\](.+?)\[/me\](?:<br />)?~i' => '<div class="meaction">* $2 $3</div>',


And add after it:
'~\[you( />)?\]~i' => $context['user']['name'],

-[Unknown]

-[Unknown]
Titel: Re: [offtopic]BOX[/offtopic]
Beitrag von: codenaught in November 07, 2004, 09:17:51 NACHMITTAGS
Yeah just add

'~\[spoiler\](.+?)\[/spoiler\]~i' => '<div style="margin: 1px; padding: 1px; background-color: #eeeeee; color: black; border: 1px solid black;">$1</div>',


after

'~\[me=((?:&quot;)?)(.{1,80}?)\\1\](.+?)\[/me\](?:<br />)?~i' => '<div class="meaction">* $2 $3</div>',

in the Sources/Subs.php file
like Unknown suggested. If you have the Faster Parsecode mod installed you will have to do something different though as that mod edits the subs.php file a lot.

Actually you have beta 5 on your forum don't you? So maybe that is why you can't find it.
Titel: Re: [offtopic]BOX[/offtopic]
Beitrag von: Ar3k in November 08, 2004, 01:09:16 VORMITTAG
It works ! Thx 4 Help !

Greez Arek
Titel: Re: [offtopic]BOX[/offtopic]
Beitrag von: Anguz in November 08, 2004, 07:39:40 NACHMITTAGS
Zitat von: akabugeyes in November 07, 2004, 09:17:51 NACHMITTAGS
If you have the Faster Parsecode mod installed you will have to do something different though


if(isset($add['[offtopic]'])){
$arr1 = '~\[offtopic\](.+?)\[/offtopic\]~i';
$arr2 = isset($disabled['offtopic']) ? '$1' : '<div style="margin: 1px; padding: 1px; background-color: #eeeeee; color: black; border: 1px solid black;">$1</div>';
}


;)

Zitat von: akabugeyes
as that mod edits the subs.php file a lot.

Not really, only the parsecode function, the rest of the file is untouched.
Titel: Re: [offtopic]BOX[/offtopic]
Beitrag von: Anguz in November 12, 2004, 04:08:54 NACHMITTAGS
Now you can also add tags that don't use parameters using this mod
http://mods.simplemachines.org/index.php?mod=48 :)

The format for the offtopic one would be


offtopic <div style="margin: 1px; padding: 1px; background-color: #eeeeee; color: black; border: 1px solid black;">$1</div>


You could also just add a new class to your style.css file like this


div.offtopic
{
margin: 1px;
padding: 1px;
background-color: #eeeeee;
color: black;
border: 1px solid black;
}


and make the tag


offtopic <div class="offtopic">$1</div>
Titel: Re: [offtopic]BOX[/offtopic]
Beitrag von: Jaanz in Dezember 30, 2004, 02:57:48 NACHMITTAGS
How about if i want to see that offtopic text, i mean that i want to replace that Code: text with Offtopic: text. I tried to figure that out almost 1 hour and then i had to go for a smoke. (regular cigarette)

Titel: Re: [offtopic]BOX[/offtopic]
Beitrag von: Anguz in Dezember 30, 2004, 05:43:39 NACHMITTAGS
Well, the code tag gets a different parsing than the rest of the tags. What do you mean by making it like it?
Titel: Re: [offtopic]BOX[/offtopic]
Beitrag von: Jaanz in Dezember 31, 2004, 03:19:39 VORMITTAG
Ok, i try to explain it again, but different way and example.

Zitat
As you see, above this box has bolded Quote text wich tells you what this box mean is.

And i would like that Quote text to be replaced with Offtopic or Spoiler texts.

I know it's a easy to make that, but... not for me. Only experience i had with coding is from the year when commodore 64 was "the machine". :D
Titel: Re: [offtopic]BOX[/offtopic]
Beitrag von: Anguz in Dezember 31, 2004, 03:59:10 VORMITTAG
I see, well, it's pretty much what I posted in my other reply with the code. For the header, just add it at the beginning, like this:

offtopic <div class="quoteheader">Offtopic:</div><div class="offtopic">$1</div>

Ideally, you wouldn't hardcode the text, instead you'll add this in the file Modifications.english.php

$txt['offtopic'] = 'Offtopic';

and then make the tag like this:

offtopic <div class="quoteheader">' . $txt['offtopic'] . ':</div><div class="offtopic">$1</div>

If you want to have a different styling for the offtopic header than the quote one, then in style.css create a new class named offtopicheader with the styles you want and change the class in the tag like this

offtopic <div class="offtopicheader">' . $txt['offtopic'] . ':</div><div class="offtopic">$1</div>
Titel: Re: [offtopic]BOX[/offtopic]
Beitrag von: Jaanz in Januar 01, 2005, 08:39:36 VORMITTAG
Zitat von: Anguz in Dezember 31, 2004, 03:59:10 VORMITTAG

and then make the tag like this:

offtopic <div class="quoteheader">' . $txt['offtopic'] . ':</div><div class="offtopic">$1</div>


I don't understand where i supposed to put that code line? To the subs.php? I Tried that, but forum gave me few errors. (Sorry about asking stupid questions.)
Titel: Re: [offtopic]BOX[/offtopic]
Beitrag von: [Unknown] in Januar 01, 2005, 04:03:17 NACHMITTAGS
I believe you enter that in the settings for his mod.

-[Unknown]
Titel: Re: [offtopic]BOX[/offtopic]
Beitrag von: Anguz in Januar 01, 2005, 04:18:59 NACHMITTAGS
Zitat von: Jaanz in Januar 01, 2005, 08:39:36 VORMITTAG
I don't understand where i supposed to put that code line? To the subs.php? I Tried that, but forum gave me few errors. (Sorry about asking stupid questions.)

http://www.simplemachines.org/community/index.php?topic=19452.msg159718#msg159718
Titel: Re: [offtopic]BOX[/offtopic]
Beitrag von: VaNcHeR in Dezember 28, 2006, 10:26:22 VORMITTAG
Excuse me, can you explain me, what should I do to install this feature to SMF 1.1? I can't find right place in the Subs.php =( There is no such lines there =(
Titel: Re: [offtopic]BOX[/offtopic]
Beitrag von: Daniel15 in Januar 30, 2007, 09:30:40 NACHMITTAGS
Zitat von: [Unknown] in November 06, 2004, 06:00:33 NACHMITTAGS
http://www.simplemachines.org/community/index.php?topic=12138.0

'~\[offtopic\](.+?)\[/offtopic\]~i' => '<div style="margin: 1px; padding: 1px; background-color: #eeeeee; color: black; border: 1px solid black;">$1</div>',

-[Unknown]
For SMF 1.1, find:

array(
'tag' => 'nobbc',
'type' => 'unparsed_content',
'content' => '$1',
),

Add after:

// Modified for [offtopic] tag - http://www.simplemachines.org/community/index.php?topic=19452.0
array(
'tag' => 'offtopic',
'before' => '<div style="margin: 1px; padding: 1px; background-color: #eeeeee; color: black; border: 1px solid black;">',
'after' => '</div>',
),