News:

Wondering if this will always be free?  See why free is better.

Main Menu

Tag to show reader's name in message

Started by WhizzB, June 07, 2004, 09:22:25 AM

Previous topic - Next topic

WhizzB

Hi,

hope this is about the right place to ask this...

I'm  looking for a tag that would be replaced by the reader's user name, similar to
the {bbusername} tag in some other forums.

All I found about this issue was for IRC: 

> Woah...I just discovered the IRC "/me" little "Easter Egg"... 
> Are there any other such MODs already built in? Such as
> a "/you" function to display the reader's name?

but now, is there a similar thing for the posts on the forum?

I was told that <me> and </me> work on the forum too:
  [me=WhizzB] What are you looking for here? [/me]
that shows as
 
* WhizzB  What are you looking for here?
but that doesn't seem to have anything to do with getting the reader's name to the text.

Why I'd need this, is to write a story where the reader appears as one of the characters, so it's not really a question of life and death, but it'd be nice to get it working, anyway. So help is appreciated.

[Unknown]

This is not a built in feature, but you can add it.  The way to add it, however, will be changing in the next version.  For the current version:

Sources/Subs.php, Find:
// [me=Comment]does something[/me]
'/\[me=&quot;(.+?)&quot;\](.+?)\[\/me\](?:<br \/>)?/is',


Add after:
'~\[you( /)?\]~i',

And then find:
// Something "me" is doing.
'<div class="meaction">* $1 $2</div>',


And add right after that:
$context['user']['name'],

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]

WhizzB

Thanks a lot for the info.

Unfortunately I'm no admin on that site, so that stuff goes beyond what I can do  there  :-[  and the admin prefers to wait for the new version, before letting ignorant newbies hack his databases ;-)


Oldiesmann

That change doesn't involve doing anything with the database at all. Just point them to this thread and they can make the changes themselves.
Michael Eshom
Christian Metal Fans

nave

oh i really really like this. i think i'll add this on my board..

edit: as much i love this, i couldnt get it to work. i'm sure i did something wrong

[Unknown]

What happened?

Did you try it like this:

[you]

Or like this:

[you /]

Did it parse at all, just wrong, or not at all?

-[Unknown]

[MiNX]Tek

This is awesome, I have been wanting to add like commands to my forum (and my members wanted it as well) so.. now I can. You showed where the code is, but how to add my own? Like... I want to add a sarcasm code. So (without saying it later) you can do >>>

<sarcasm>That's the best thing I have ever heard!</sarcasm>

is there then a way to do this?

[Unknown]

Well, you could add...

'~\[sarcasm\](.+?)\[/sarcasm\]~i' => '-- $1 --',

I don't know how you'd want to format it, but basically you put in the second part the formatting.  So, that '-- $1 --' could be:

'<div style="color: green;">$1</div>'
'<div class="sarcasm">$1</div>'
'<div style="color: white; background-color: white;">$1</div>'

Or anything.

-[Unknown]

[MiNX]Tek


Winters

Hrm, I'm probably totally wrong here, but I'll ask anyway: Is this the way I could add a "spoiler" Tag? (Meaning: By clicking on a "spoiler" button, the poster makes her enclosed text invisible unless people mark it with the right mouse button. The reader, at first, only sees the spoiler warning.

[Unknown]

Yes... there is.  Why else would I have posted my cryptic reply to the "hide" topic?

Instead of '<div style="color: green;">$1</div>'... why not:

'<script language="JavaScript">var spolierid = Math.round(Math.random() * 10000); document.write(\'<a href="#" onclick="document.getElementById(&quot;spolier\' + spolierid + \'&quot;).style.display = &quot;&quot;; this.style.display = &quot;none&quot;; return false;">SPOILER: CLICK TO READ</a><span id="spoiler\' + spolierid + \'">\');</script>$1<script language="JavaScript">document.write(\'</span>\');</script>'

In theory, that shoudl hide it until you click to show.  If javscript is off, it won't be hidden at all.

-[Unknown]

[MiNX]Tek

OMG wow, that's a big "why not" replacement. Never heard of a "spoiler" tag. Hmmm, even more to contemplate about.

[MiNX]Tek

'~\[sarcasm\](.+?)\[/sarcasm\]~i' => '-- $1 --',
'<div style="color: green;">$1</div>'
'<div class="sarcasm">$1</div>'
'<div style="color: white; background-color: white;">$1</div>'


Why are their two color's? One white and one green? They are both refering to text right? Also, where in the Subs.php file do I put this?

[Unknown]

Sorry, that was an example of three *separate* things it could be.

-[Unknown]

[MiNX]Tek

Oh okay. But again, where do I put the code


'~\[sarcasm\](.+?)\[/sarcasm\]~i' => '-- $1 --',
'<div style="color: green;">$1</div>'


If I wanted to use that.

[Unknown]

Quote from: [Unknown] on June 07, 2004, 09:35:45 AM
This is not a built in feature, but you can add it.  The way to add it, however, will be changing in the next version.  For the current version:

...

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]

So, instead of the thing it says to add there, add:

'~\[sarcasm\](.+?)\[/sarcasm\]~i' => '<div style="color: green;">$1</div>',

-[Unknown]

[MiNX]Tek

#16
Okay, great thanks :) Wow, that was easy, lol. I just imagined it to be harder. I got it so that it's green, and bold. But how to I make it italicised? I'm looking in the other PHP files to try to find the code for italicze, but I'm not seeing it.

Anguz

#17
Quote from: [MiNX]Tek on September 16, 2004, 05:13:58 PM
Okay, great thanks :) Wow, that was easy, lol. I just imagined it to be harder. I got it so that it's green, and bold. But how to I make it italicised? I'm looking in the other PHP files to try to find the code for italicze, but I'm not seeing it.

'~\[sarcasm\](.+?)\[/sarcasm\]~i' => '<div style="color: green; font-weight: bold; font-style: italic;">$1</div>',

Edit:

Better even, create a new class in style.css named .sarcasm

.sarcasm
{
   color: green;
   font-weight: bold;
   font-style: italic;
}


and then change the above div tag to

<div class="sarcasm">
Cristián Lávaque http://cristianlavaque.com

CapriSkye

spoiler doesn't work :(

this is what i have

'~\[spoiler\](.+?)\[/spoiler\]~i' => '<script language="JavaScript">var spolierid = Math.round(Math.random() * 10000); document.write(\'<a href="#" onclick="document.getElementById(&quot;spolier\' + spolierid + \'&quot;).style.display = &quot;&quot;; this.style.display = &quot;none&quot;; return false;">SPOILER: CLICK TO READ</a><span id="spoiler\' + spolierid + \'">\');</script>$1<script language="JavaScript">document.write(\'</span>\');</script>',

CapriSkye

ok i did some search on google, and came up with this code,

<b>Spoiler:</b> <input type="button" value="Show" style="width: 45px; font-size: 10px; margin:0px; padding:0px;" onClick="if (document.getElementsByTagName('div')[2].style.display !='')
{
document.getElementsByTagName('div')[2].style.display =''; this.innerText = ''; this.value = 'Hide';
}
else
{
document.getElementsByTagName('div')[2].style.display = 'none'; this.innerText = ''; this.value = 'Show';
}">
</div>

<div style="width:50%">
<div style="display: none; margin: 3px; padding: 6px; border: 1px solid;">
This is a spoiler
</div>


now i just gotta find a way to put it in smf... ;)

Advertisement: