MyBB Community Forums

Full Version: Adding template through plugin activation error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey again. 

I'm creating a template for my plugin, and I need to include the likes of 
$mybb->settings['bbname'];

For my title etc, however, with the following code:

    $template = '<html>
                <head>
                <title>{$mybb->settings[bbname]} - {$pageTitle}</title>
                {$headerinclude}
                </head>
                <body>
                {$header}
                <table border="0" cellspacing="1" cellpadding="4" class="tborder">
                <tr>
                <td class="thead"><strong>{$pageTitle}</strong></td>
                </tr>
                <tr>
                <td class="trow1">

                Add here your custom messages.

                </td></tr></table>
                {$footer}
                </body>
                </html>';

$templateArray = array(
        'title' => 'paypalShopTemplate',
        'template' => $db->escape_string($template),
        'sid' => '-1',
        'version' => '',
        'dateline' => time()
    );


I get an error saying it will cause an error, because of the missing '' around bbname, however when I wrap it in '' or "" I get unexpected character errors. What do I do? Is this an error thrown up because of escape string?

Thanks
Just a thought but have you tried



\'\'

ie:

{$mybb->settings[\'bbname\']}


As that should sort you out. Since you are including it all in ' ' rather than " " and in " " you wouldn't have to do so, but would have to say \$ \"\" etc, etc,  but yeah \'\' should be what you want as is?
That worked. Thanks
No worries, glad you got it sorted out. Smile