The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
injecting into admincp settings?
im trying to include a stylesheet in my settings page, i managed to get it to load in but not in a good way. It adds the code to the very end of the page.
Code:
</body> </html><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css"> Code:
<plugin active="1" executionorder="1" product="vbulletin"> <title>font awesome in settings</title> <hookname>admin_complete</hookname> <phpcode><![CDATA[if ($vbulletin->options['drc_fa_adm']){ echo('<link rel="stylesheet" href="'.$vbulletin->options['drc_fa_prov'].'">'); }]]></phpcode> </plugin> even though this works, I would like to know... is there anyway i can properly inject stylesheets and/or scripts into the settings page? |
#2
|
||||
|
||||
Here install this mod and then create a setting where the option code is:
Code:
css:my_custom_css_file.css |
Благодарность от: | ||
Dr.CustUmz |
#3
|
||||
|
||||
thanks squid, this is the hook I ended up using already =) but that hook, some option pages like turn site on off don't have that hook, and one of my products (didnt check every default settings page) actually has that hook 2ce so the stylesheet loads 2ce.
I tried using some js in the admin complete hook Code:
$drcjQ = "<link ref=\"stylesheet\" href=\"style.css\">"; echo "<script>var headHTML = document.getElementsByTagName('head')[0].innerHTML; headHTML += '" . $drcjQ . "'; document.getElementsByTagName('head')[0].innerHTML = headHTML;</script>"; side note* I am out of iframes when im testing this, i open the options in a new tab and go to the settings of the product I'm working on. example: yoursite.com/admincp/options.php?do=options&dogroup=onoff so its the full page and no nav on the left or bar at the top --------------- Added [DATE]1462470531[/DATE] at [TIME]1462470531[/TIME] --------------- this is what I have currently working btw I'd just like to be able to get it working in the HEAD Code:
<hookname>admin_options_print</hookname> <phpcode><![CDATA[if ($vbulletin->options['drc_fa_adm']){ echo '<link rel="stylesheet" href="'.$vbulletin->options['drc_fa_prov'].'">'; }]]></phpcode> |
#4
|
||||
|
||||
Quote:
Code:
css:style.css For any settings page that you want custom css to be applied to, add a new settings with css:... as the option code. EDIT: To clarify, this will only add your custom css to those settings pages where you add a setting that has the specified option code. The product will not add it to all settings group pages. |
#5
|
||||
|
||||
Here's what I mean, the first image is a new setting I create within any settings group.
Here's viewing the actual settings page. The style.css file has a single entry .alt1{background-color:red;} |
#6
|
||||
|
||||
thats actually pretty cool, but it's not what im going for. Im going to have a core product that must be installed for my addons, and in that product is where i apply the style sheet for its (and all my other products) settings. That way i can use jquery and stylesheets and theyre all loaded from the core product, so in a new products settings i can just call the classes and what not.
its hard to explain not having released it yet, but i hope you get it =/ --------------- Added [DATE]1462489633[/DATE] at [TIME]1462489633[/TIME] --------------- i tried this @admin_options_print just to test Code:
$alreadyLoaded = array('one' => false, 'two' => false); if (!$alreadyLoaded['one']) { echo 'ECHO'; $alreadyLoaded['one'] = true; } whats going on =/ this is my settings page |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|