MyBB Community Forums

Full Version: [closed]html in plugin setting?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How would I set a default html code to display for a plugin's settings?

Like into the "value" => "" of the example?

Example:
$test_1 = array(
		"sid" => "NULL",
		"name" => "test_code",
		"title" => "Code",
		"description" => "Enter the HTML code.",
		"optionscode" => "textarea",
		"value" => "",
		"disporder" => "1",
		"gid" => intval($gid),
		);
	$db->insert_query("settings", $test_1);
Hi,
What do you mean "default HTML code"?
I believe you can enter HTML in the title/description. It really doesn't make sense for value...
(2008-08-11, 11:35 PM)ZiNgA BuRgA Wrote: [ -> ]Hi,
What do you mean "default HTML code"?
I believe you can enter HTML in the title/description. It really doesn't make sense for value...

When you go to the plugin's settings, users will be able to enter html code into the textbox under "Enter the HTML code." box.

How could I make the textbox come up with some html code by default? Like when users activate the plugin, the textbox will include some html code.

I want html code to appear in this box when users activate the plugin.
[attachment=10437]
Just insert what you want for HTML into the "value" part of the SQL you have.
(2008-08-12, 01:02 AM)RenegadeFan Wrote: [ -> ]Just insert what you want for HTML into the "value" part of the SQL you have.

How do I do that?
$test_1 = array(
        "sid" => "NULL",
        "name" => "test_code",
        "title" => "Code",
        "description" => "Enter the HTML code.",
        "optionscode" => "textarea",
        "value" => "<strong><em>what ever goes here</em></strong>",
        "disporder" => "1",
        "gid" => intval($gid),
        );
    $db->insert_query("settings", $test_1);
(2008-08-12, 01:07 AM)RenegadeFan Wrote: [ -> ]
$test_1 = array(
        "sid" => "NULL",
        "name" => "test_code",
        "title" => "Code",
        "description" => "Enter the HTML code.",
        "optionscode" => "textarea",
        "value" => "<strong><em>what ever goes here</em></strong>",
        "disporder" => "1",
        "gid" => intval($gid),
        );
    $db->insert_query("settings", $test_1);

I get this error when I try this.
Parse error: syntax error, unexpected '>' in /home/censored/public_html/test/inc/plugins/test.php on line 71

You a C&C Fan or is that a different renegade?
Try this:
"value" => preg_quote("<strong><em>what ever goes here</em></strong>"),

My username is based off the roller coaster at Valleyfair in Minnesota.
Make sure you don't have any special characters in your string. I'm guessing you have a few quotes (") in there which will break PHP. Escape them with \, eg:
"description" => "<mytag myattrib=\"myval\">stuff</mytag>"
Thanks! That was the problem.