Advertisement:

Author Topic: Function [code=  (Read 4741 times)

Offline Jean Prado

  • Jr. Member
  • **
  • Posts: 307
  • Gender: Male
Function [code=
« on: December 27, 2009, 09:50:39 PM »
Hey guys, know the funcion [code=] What after of the '=' you can also assign a name to the code, thus:
Code: (name) [Select]
nameI want you to help me find this function, and, what makes it work ..
 8)


Offline JBlaze

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,160
  • Gender: Male
    • @fragicide on Twitter
Re: Function [code=
« Reply #1 on: December 27, 2009, 09:52:41 PM »
./Sources/Subs.php

Located in the parse_bbc() function.
Jason Clemons
Former Lead Customizer/Support Specialist
Twitter | Facebook | Instagram

Offline Jean Prado

  • Jr. Member
  • **
  • Posts: 307
  • Gender: Male
Re: Function [code=
« Reply #2 on: December 27, 2009, 09:57:56 PM »
Which line?
Subs.php attached,


Offline JBlaze

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,160
  • Gender: Male
    • @fragicide on Twitter
Re: Function [code=
« Reply #3 on: December 27, 2009, 09:59:34 PM »
I don't have a text editor handy (I'm on vacation and I don't have my computer with me) so I can't look at the file.

Just look under the parse_bbc() function and look for the 'code' = array() in the array. There are two instances so just look for them.
Jason Clemons
Former Lead Customizer/Support Specialist
Twitter | Facebook | Instagram

Offline Jean Prado

  • Jr. Member
  • **
  • Posts: 307
  • Gender: Male
Re: Function [code=
« Reply #4 on: December 27, 2009, 10:00:48 PM »
Code: [Select]
array(
'tag' => 'code',
'type' => 'unparsed_content',
'content' => '$1',
// !!! Maybe this can be simplified?
'validate' => isset($disabled['code']) ? null : create_function('&$tag, &$data, $disabled', '
global $context, $txt, $settings;

if (!isset($disabled[\'code\']))
{
$php_parts = preg_split(\'~(<\?php|\?>)~\', $data, -1, PREG_SPLIT_DELIM_CAPTURE);

for ($php_i = 0, $php_n = count($php_parts); $php_i < $php_n; $php_i++)
{
// Do PHP code coloring?
if ($php_parts[$php_i] != \'&lt;?php\')
continue;

$php_string = \'\';
while ($php_i + 1 < count($php_parts) && $php_parts[$php_i] != \'?&gt;\')
{
$php_string .= $php_parts[$php_i];
$php_parts[$php_i++] = \'\';
}
$php_parts[$php_i] = highlight_php_code($php_string . $php_parts[$php_i]);
}

// Fix the PHP code stuff...
$data = str_replace("<pre style=\"display: inline;\">\t</pre>", "\t", implode(\'\', $php_parts));

// select all and copy code to clipboard mod
static $codecounter = 0;
$codecounter++;
$data = \'<div class="codeheader">\' . $txt[\'smf238\'] . \': \'
.\'<a href="javascript:void(0)" title="\'.$txt[\'codeselectall\'].\'" onclick="javascript:selectall(\\\'code_a\'.$codecounter.\'\\\');return false;">\'.$txt[\'codeselectall\'].\'</a>\'
.\' \'.$txt[\'codedivider\'].\' <a href="javascript:void(0)" title="\'.$txt[\'codecopytoclipboard\'].\'" onclick="javascript:copy(\\\'code_a\'.$codecounter.\'\\\');return false;">\'.$txt[\'codecopytoclipboard\'].\'</a>\'
.\'</div><div class="code" id="code_a\'.$codecounter.\'">\' . ($context[\'browser\'][\'is_gecko\'] ? \'<pre style="margin-top: 0; display: inline;">\'.$data.\'</pre>\' : $data) . \'</div>\';
// end of select all and copy to clipboard mod

// Older browsers are annoying, aren\'t they?
if ($context[\'browser\'][\'is_ie4\'] || $context[\'browser\'][\'is_ie5\'] || $context[\'browser\'][\'is_ie5.5\'])
$data = str_replace("\t", "<pre style=\"display: inline;\">\t</pre>", $data);
elseif (!$context[\'browser\'][\'is_gecko\'])
$data = str_replace("\t", "<span style=\"white-space: pre;\">\t</span>", $data);
}'),

where?


Offline Jean Prado

  • Jr. Member
  • **
  • Posts: 307
  • Gender: Male
Re: Function [code=
« Reply #5 on: December 28, 2009, 04:12:14 PM »
........


Offline H

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 21,662
  • Gender: Male
Re: Function [code=
« Reply #6 on: December 28, 2009, 04:15:40 PM »
We're all volunteers. Please wait 24 before bumping your posts!
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,823
    • StoryBB/StoryBB on GitHub
Re: Function [code=
« Reply #7 on: December 28, 2009, 04:16:19 PM »
What exactly do you want to know? As ever, tell us what you're trying to do.

Basically, type unparsed_equals_content (the second code block) covers it.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Jean Prado

  • Jr. Member
  • **
  • Posts: 307
  • Gender: Male
Re: Function [code=
« Reply #8 on: December 28, 2009, 04:53:12 PM »
I want to configure my spoiler equal to the code, and which is entered after the '=' can put the name quser, because my spoiler does not have it.


Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,823
    • StoryBB/StoryBB on GitHub
Re: Function [code=
« Reply #9 on: December 28, 2009, 04:53:56 PM »
So, [spoiler=something]content[/spoiler]

What happens to the 'something'?
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Jean Prado

  • Jr. Member
  • **
  • Posts: 307
  • Gender: Male
Re: Function [code=
« Reply #10 on: December 28, 2009, 08:01:52 PM »
Nooooooooooo , My spoiler don't have this function, i want to add , how i add?


Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,823
    • StoryBB/StoryBB on GitHub
Re: Function [code=
« Reply #11 on: December 28, 2009, 08:03:48 PM »
That's what I mean.

So, again, what is supposed to happen to the 'something' when you use that code?
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Jean Prado

  • Jr. Member
  • **
  • Posts: 307
  • Gender: Male
Re: Function [code=
« Reply #12 on: December 28, 2009, 08:25:13 PM »
Not appear .
It is [spoiler=something] as if it don't have the BBC CODE .


Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,823
    • StoryBB/StoryBB on GitHub
Re: Function [code=
« Reply #13 on: December 28, 2009, 08:29:20 PM »
*sigh*

So if a user puts that code in, what is supposed to happen to the 'something'? What is it supposed to do?

Or should [spoiler=something] be the same as [spoiler] ?
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Jean Prado

  • Jr. Member
  • **
  • Posts: 307
  • Gender: Male
Re: Function [code=
« Reply #14 on: December 28, 2009, 08:46:52 PM »
I want to put a function of '=something', because only the [spoiler] works!


Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,823
    • StoryBB/StoryBB on GitHub
Re: Function [code=
« Reply #15 on: December 28, 2009, 08:47:27 PM »
Right.... AND WHAT SHOULD IT DO IF YOU ADD IT?
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Yahmez

  • Sr. Member
  • ****
  • Posts: 798
  • -_-
Re: Function [code=
« Reply #16 on: December 28, 2009, 08:51:31 PM »
 ;D :D ;)

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,823
    • StoryBB/StoryBB on GitHub
Re: Function [code=
« Reply #17 on: December 28, 2009, 08:56:55 PM »
While I appreciate there may be a language barrier, having to ask the same question multiple times doesn't make me want to help much.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline JBlaze

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,160
  • Gender: Male
    • @fragicide on Twitter
Re: Function [code=
« Reply #18 on: December 28, 2009, 09:01:34 PM »
Let me try...

OK, so you want to make a spoiler mod, and you want to know how to code it. First, we need to know what kind of effect it will have on the content inside of the [spoiler] tags. What does it do? How does it work to display the content?

These are the things we need to know in order to help you.
Jason Clemons
Former Lead Customizer/Support Specialist
Twitter | Facebook | Instagram

Offline Jean Prado

  • Jr. Member
  • **
  • Posts: 307
  • Gender: Male
Re: Function [code=
« Reply #19 on: December 29, 2009, 09:16:32 AM »
I want to run the [spoiler =] my forum, if I put [spoiler = something] does not work [/ spoiler], only with normal spoiler [spoiler] work [/ spoiler]!
Let me try...

OK, so you want to make a spoiler mod, and you want to know how to code it. First, we need to know what kind of effect it will have on the content inside of the [spoiler] tags. What does it do? How does it work to display the content?

These are the things we need to know in order to help you.
The spoiler is a spoiler normal, except that the [spoiler = something] does not work if I put this, it is only the tag, has no effect, only work if I just put [spoiler]


Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,823
    • StoryBB/StoryBB on GitHub
Re: Function [code=
« Reply #20 on: December 29, 2009, 09:19:15 AM »
Yes, yes, yes we realise that.

BUT, again, should the 'something' part of that actually DO something or be displayed anywhere somehow?

Or should [spoiler=something] function EXACTLY like [spoiler]?
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline JBlaze

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,160
  • Gender: Male
    • @fragicide on Twitter
Re: Function [code=
« Reply #21 on: December 29, 2009, 09:20:53 AM »
* JBlaze slams his head into the desk
Jason Clemons
Former Lead Customizer/Support Specialist
Twitter | Facebook | Instagram

Offline Kays

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,973
  • Gender: Male
    • Kayssplace
Re: Function [code=
« Reply #22 on: December 29, 2009, 07:48:10 PM »
Nooooooooooo , My spoiler don't have this function, i want to add , how i add?

The spoiler mod you are using will not do that. Try this mod instead.

http://custom.simplemachines.org/mods/index.php?mod=195

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Offline Costa

  • SMF Hero
  • ******
  • Posts: 3,045
  • Gender: Male
  • Do NOT feed the trolls...
Re: Function [code=
« Reply #23 on: December 29, 2009, 08:07:32 PM »
I give up this issue in portuguese board because of this:
Right.... AND WHAT SHOULD IT DO IF YOU ADD IT?
and this
While I appreciate there may be a language barrier, having to ask the same question multiple times doesn't make me want to help much.

Meh!

* Costa LOL and LOL about this

see...
http://translate.google.pt/translate?js=y&prev=_t&hl=pt-PT&ie=UTF-8&layout=2&eotf=1&u=http%3A%2F%2Fwww.simplemachines.org%2Fcommunity%2Findex.php%3Ftopic%3D348115.msg2357794%23msg2357794&sl=pt&tl=en
Hugo "Costa" Fernandes
Todas as MP's a pedir ajuda são sujeitas a radioactividade, microondas, queimadas e atiradas borda fora.

"At least someone appreciates the fact that I am doing and not thinking..."
"Laziness is counter-revolutionary."

Offline Liam.

  • SMF Hero
  • ******
  • Posts: 2,240
  • Gender: Male
Re: Function [code=
« Reply #24 on: December 29, 2009, 08:09:00 PM »
As far as I can tell, like this mod for MyBB. http://mods.mybboard.net/view/spoiler-bbcode
It doesn't have an image demo, but from what I think he means, the title would be just like the code view title, etc. The content just after "title=" would be in bold just above the content of the "[spoiler]" tag.

Offline Costa

  • SMF Hero
  • ******
  • Posts: 3,045
  • Gender: Male
  • Do NOT feed the trolls...
Re: Function [code=
« Reply #25 on: December 29, 2009, 08:12:12 PM »
he want to do this

Quote from: meh
Meh!
Hugo "Costa" Fernandes
Todas as MP's a pedir ajuda são sujeitas a radioactividade, microondas, queimadas e atiradas borda fora.

"At least someone appreciates the fact that I am doing and not thinking..."
"Laziness is counter-revolutionary."

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,823
    • StoryBB/StoryBB on GitHub
Re: Function [code=
« Reply #26 on: December 29, 2009, 08:19:31 PM »
As far as I can tell, like this mod for MyBB. http://mods.mybboard.net/view/spoiler-bbcode
It doesn't have an image demo, but from what I think he means, the title would be just like the code view title, etc. The content just after "title=" would be in bold just above the content of the "[spoiler]" tag.

That's all I've been trying to establish; should it actually do something or just drop the stuff after the equals?
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Jean Prado

  • Jr. Member
  • **
  • Posts: 307
  • Gender: Male
Re: Function [code=
« Reply #27 on: December 30, 2009, 04:11:23 PM »
Nooooooooooo , My spoiler don't have this function, i want to add , how i add?

The spoiler mod you are using will not do that. Try this mod instead.

http://custom.simplemachines.org/mods/index.php?mod=195

I tryed.
But i want the spoiler of click to show, and not the spoiler mod to passing the mouse to show.


Offline Costa

  • SMF Hero
  • ******
  • Posts: 3,045
  • Gender: Male
  • Do NOT feed the trolls...
Re: Function [code=
« Reply #28 on: December 30, 2009, 04:19:53 PM »
read the page mod...

Quote
There are three different types of spoilers to use, which can be define per theme. If a theme have not defined a type the default one will be used.
Hugo "Costa" Fernandes
Todas as MP's a pedir ajuda são sujeitas a radioactividade, microondas, queimadas e atiradas borda fora.

"At least someone appreciates the fact that I am doing and not thinking..."
"Laziness is counter-revolutionary."

Offline Jean Prado

  • Jr. Member
  • **
  • Posts: 307
  • Gender: Male
Re: Function [code=
« Reply #29 on: December 31, 2009, 09:29:21 AM »
So if I edit the style.css I will be able to run normal?


Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,823
    • StoryBB/StoryBB on GitHub
Re: Function [code=
« Reply #30 on: December 31, 2009, 09:32:14 AM »
Or you follow what the mod's page says and change it in the admin panel

Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Jean Prado

  • Jr. Member
  • **
  • Posts: 307
  • Gender: Male
Re: Function [code=
« Reply #31 on: December 31, 2009, 09:57:24 AM »
Thanks, i got!  :D :D :D :D :D :D :D :D :D :D


Offline Jean Prado

  • Jr. Member
  • **
  • Posts: 307
  • Gender: Male
Re: Function [code=
« Reply #32 on: December 31, 2009, 10:38:36 AM »
what is the code in style.css which makes the content in the spoiler being dotted?


Offline Nick Whetstone

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 1,816
    • nickwhetstone on Facebook
    • nickwhetstone on GitHub
    • nickwhetstone on LinkedIn
Re: Function [code=
« Reply #33 on: December 31, 2009, 11:06:41 AM »
Code: [Select]
fieldset.spoiler
{
border: 1px dashed gray;
}
The "dashed" defines that the border is, well, dashed.
The artist formerly known as (Ha)²

Former Support Specialist

Please do not solicit support via PM. Here's why!

Offline Jean Prado

  • Jr. Member
  • **
  • Posts: 307
  • Gender: Male
Re: Function [code=
« Reply #34 on: December 31, 2009, 11:11:48 AM »
Oh , thanks very much!
 :D :D :D


Offline Jean Prado

  • Jr. Member
  • **
  • Posts: 307
  • Gender: Male
Re: Function [code=
« Reply #35 on: December 31, 2009, 11:16:20 AM »
But , in my theme, Noize, not work


Offline Kays

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,973
  • Gender: Male
    • Kayssplace
Re: Function [code=
« Reply #36 on: December 31, 2009, 11:17:42 AM »
Try Ctrl + F5 to refresh the page.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Offline Jean Prado

  • Jr. Member
  • **
  • Posts: 307
  • Gender: Male
Re: Function [code=
« Reply #37 on: December 31, 2009, 11:32:49 AM »
Thanks , I had no spoiler.body that was important, and it did not work, now did it, thank you.