addCssFile() public method

Adds a CSS file to search for in the theme folder(s).
public addCssFile ( string $FileName, string $AppFolder = '', $Options = null )
$FileName string The CSS file to search for.
$AppFolder string The application folder that should contain the CSS file. Default is to use the application folder that this controller belongs to. - If you specify plugins/PluginName as $AppFolder then you can contain a CSS file in a plugin's design folder.
示例#1
0
 /**
  * Homepage of VanillaForums.org.
  *
  * @param Gdn_Controller $sender
  */
 public function homeController_homepage_create($sender)
 {
     try {
         $AddonModel = new AddonModel();
         $Addon = $AddonModel->getSlug('vanilla-core', true);
         $sender->setData('CountDownloads', val('CountDownloads', $Addon));
         $sender->setData('Version', val('Version', $Addon));
         $sender->setData('DateUploaded', val('DateInserted', $Addon));
     } catch (Exception $ex) {
     }
     $sender->title('The most powerful custom community solution in the world');
     $sender->setData('Description', "Vanilla is forum software that powers discussions on hundreds of thousands of sites. Built for flexibility and integration, Vanilla is the best, most powerful community solution in the world.");
     $sender->Head->addTag('meta', array('name' => 'description', 'content' => $sender->data('Description')));
     $sender->clearJsFiles();
     $sender->addJsFile('jquery.js', 'vforg');
     $sender->addJsFile('easySlider1.7.js', 'vforg');
     saveToConfig('Garden.Embed.Allow', false, false);
     // Prevent JS errors
     $sender->clearCssFiles();
     $sender->addCssFile('vforg-home.css', 'vforg');
     $sender->MasterView = 'empty';
     $sender->render('index', 'home', 'vforg');
 }
示例#2
0
 /**
  * Adds 'Discussion' item to menu.
  *
  * 'base_render_before' will trigger before every pageload across apps.
  * If you abuse this hook, Tim will throw a Coke can at your head.
  *
  * @since 2.0.0
  * @package Vanilla
  *
  * @param Gdn_Controller $sender The sending controller object.
  */
 public function base_render_before($sender)
 {
     if ($sender->Menu) {
         $sender->Menu->addLink('Discussions', t('Discussions'), '/discussions', false, ['Standard' => true]);
     }
     if (!inSection('Dashboard')) {
         // Spoilers assets
         $sender->addJsFile('spoilers.js', 'vanilla');
         $sender->addCssFile('spoilers.css', 'vanilla');
         $sender->addDefinition('Spoiler', t('Spoiler'));
         $sender->addDefinition('show', t('show'));
         $sender->addDefinition('hide', t('hide'));
     }
     // Add user's viewable roles to gdn.meta if user is logged in.
     if (!$sender->addDefinition('Roles')) {
         if (Gdn::session()->isValid()) {
             $roleModel = new RoleModel();
             Gdn::controller()->addDefinition("Roles", $roleModel->getPublicUserRoles(Gdn::session()->UserID, "Name"));
         }
     }
 }