News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Problem when creating custom bbcode

Started by nexpb, April 05, 2014, 01:47:54 PM

Previous topic - Next topic

nexpb

How can I use the value $1 as parameter in a php function?

example:
[tag]name[/tag]
name would be $1 so I want to use the method getSerie($1)


margarett

I'm not really sure on what you want to do, neither exactly how parse_bbc works, unfortunately.

But if you look at, eg, the "email" BBC

array(
'tag' => 'email',
'type' => 'unparsed_content',
'content' => '<a href="mailto:$1" class="bbc_email">$1</a>',
// !!! Should this respect guest_hideContacts?
'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array(\'<br />\' => \'\'));'),
),

$1 goes into the link construction directly, so I assume you can just use it straight on.

You can check other BBC codes in Subs.php, function parse_bbc, maybe it will give you a better overview.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

nexpb

Quote from: margarett on April 14, 2014, 02:47:38 PM
I'm not really sure on what you want to do, neither exactly how parse_bbc works, unfortunately.

But if you look at, eg, the "email" BBC

array(
'tag' => 'email',
'type' => 'unparsed_content',
'content' => '<a href="mailto:$1" class="bbc_email">$1</a>',
// !!! Should this respect guest_hideContacts?
'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array(\'<br />\' => \'\'));'),
),

$1 goes into the link construction directly, so I assume you can just use it straight on.

You can check other BBC codes in Subs.php, function parse_bbc, maybe it will give you a better overview.
The thing is I want to use the value to call my php function what I want to achieve is someting like this [name]test[/name] then I want to call a php function with the value "test" and grab all the info from my database and display that.

I noticed the same thing like you did it seems you an only use the value $1 directly in the construction so I was wondering if it was possible to get the value that $1 holds.

(I hope I made a little sense)

Advertisement: