Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: Ar3k on November 06, 2004, 09:39:48 AM

Title: [offtopic]BOX[/offtopic]
Post by: Ar3k on November 06, 2004, 09:39:48 AM
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
Title: Re: [offtopic]BOX[/offtopic]
Post by: [Unknown] on November 06, 2004, 06:00:33 PM
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]
Title: Re: [offtopic]BOX[/offtopic]
Post by: diplomat. on November 07, 2004, 01:39:51 PM
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?
Title: Re: [offtopic]BOX[/offtopic]
Post by: [Unknown] on November 07, 2004, 06:26:58 PM
The same way I posted with the offtopic box.

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

-[Unknown]
Title: Re: [offtopic]BOX[/offtopic]
Post by: diplomat. on November 07, 2004, 08:17:43 PM
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)
Title: Re: [offtopic]BOX[/offtopic]
Post by: [Unknown] on November 07, 2004, 08:19:51 PM
Quote from: [Unknown] on June 07, 2004, 09:35:45 AM
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]
Title: Re: [offtopic]BOX[/offtopic]
Post by: codenaught on November 07, 2004, 09:17:51 PM
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.
Title: Re: [offtopic]BOX[/offtopic]
Post by: Ar3k on November 08, 2004, 01:09:16 AM
It works ! Thx 4 Help !

Greez Arek
Title: Re: [offtopic]BOX[/offtopic]
Post by: Anguz on November 08, 2004, 07:39:40 PM
Quote from: akabugeyes on November 07, 2004, 09:17:51 PM
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>';
}


;)

Quote from: akabugeyes
as that mod edits the subs.php file a lot.

Not really, only the parsecode function, the rest of the file is untouched.
Title: Re: [offtopic]BOX[/offtopic]
Post by: Anguz on November 12, 2004, 04:08:54 PM
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>
Title: Re: [offtopic]BOX[/offtopic]
Post by: Jaanz on December 30, 2004, 02:57:48 PM
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)

Title: Re: [offtopic]BOX[/offtopic]
Post by: Anguz on December 30, 2004, 05:43:39 PM
Well, the code tag gets a different parsing than the rest of the tags. What do you mean by making it like it?
Title: Re: [offtopic]BOX[/offtopic]
Post by: Jaanz on December 31, 2004, 03:19:39 AM
Ok, i try to explain it again, but different way and example.

Quote
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
Title: Re: [offtopic]BOX[/offtopic]
Post by: Anguz on December 31, 2004, 03:59:10 AM
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>
Title: Re: [offtopic]BOX[/offtopic]
Post by: Jaanz on January 01, 2005, 08:39:36 AM
Quote from: Anguz on December 31, 2004, 03:59:10 AM

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.)
Title: Re: [offtopic]BOX[/offtopic]
Post by: [Unknown] on January 01, 2005, 04:03:17 PM
I believe you enter that in the settings for his mod.

-[Unknown]
Title: Re: [offtopic]BOX[/offtopic]
Post by: Anguz on January 01, 2005, 04:18:59 PM
Quote from: Jaanz on January 01, 2005, 08:39:36 AM
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
Title: Re: [offtopic]BOX[/offtopic]
Post by: VaNcHeR on December 28, 2006, 10:26:22 AM
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 =(
Title: Re: [offtopic]BOX[/offtopic]
Post by: Daniel15 on January 30, 2007, 09:30:40 PM
Quote from: [Unknown] on November 06, 2004, 06:00:33 PM
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>',
),