How would i use $mybb->settings['bburl'] in a js file
#1
Thumbs Down 
This user has been denied support. This user has been denied support.
i have a js file which has a link to /images/bk/ 

 i have used $mybb->settings['bburl'] but that doesn't workin js since it's a php variable

halp

also  why is this isnt working
<?php

// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.");
}

$plugins->add_hook('NerdieTony Hourly BK Change Plugin', 'bkchange');

function bkchange_info()
{
	return array(
		"name"			=> "NerdieTony Hourly BK Change Plugin",
		"description"	=> "Changes background image every hour...",
		"website"		=> "http://crystalforums.cf",
		"author"		=> "NerdieTony",
		"authorsite"	=> "",
		"version"		=> "1.0",
		"guid" 			=> "",
		"codename"		=> "",
		"compatibility" => "18*"
	);
}

function bkchange_install()
{

}

function bkchange_is_installed()
{

 global $db;
    if($db->table_exists("bkchange"))
    {
        return true;
    }
    return false;
}

function bkchange_uninstall()
{

}

function bkchange_activate()
{

 global $db, $mybb;

$setting_group = array(
    'name' => 'bkchange',
    'title' => 'NerdieTony Hourly BK Change Plugin',
    'description' => 'Changes background image every hour...',
    'disporder' => 5, // The order your setting group will display
    'isdefault' => 0
);

$gid = $db->insert_query("settinggroups", $setting_group);

$setting_array = array(
    // A text setting
    'bkchange' => array(
        'title' => 'File Location',
        'description' => 'Where are the backgrounds located',
        'optionscode' => 'text',
        'value' => '/images/bk/', // Default
        'disporder' => 1
    ),
);

foreach($setting_array as $name => $setting)
{
    $setting['name'] = $name;
    $setting['gid'] = $gid;

    $db->insert_query('settings', $setting);
}

// Don't forget this!
rebuild_settings();

}

function bkchange_deactivate()
{

 global $db; $db->delete_query('settings', "name IN ('bkchange')"); $db->delete_query('settinggroups', "name = 'mysettinggroup'"); // Don't forget this rebuild_settings();
}

function do_something()
{

global $bk;

$bk = '<script src="<?php $mybb->settings['bburl']?>//jscripts/bkchange"></script> ';


   require_once MYBB_ROOT."/inc/adminfunctions_templates.php";

find_replace_templatesets(
    "index",
    "#" . preg_quote('') . "#i",
    '{$bk}</head>'
);


}

?>
Reply


Messages In This Thread
How would i use $mybb->settings['bburl'] in a js file - by shattered - 2016-09-28, 08:02 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)