Browse Source

implement mechanism to register css variables through inherited colors.txt files and register backgroundColor

dev01
parent
commit
b26933a5dd
4 changed files with 19 additions and 4 deletions
  1. +10
    -4
      app/controller/page.php
  2. +5
    -0
      app/modules/filesinfolders.php
  3. +3
    -0
      app/views/colors.css
  4. +1
    -0
      app/views/tpl/index.html

+ 10
- 4
app/controller/page.php View File

); );


$folder->prepare_files(); $folder->prepare_files();
if($folder->extras['colors']) {
$folder->structs['default']['txt']['colors']=$folder->extras['colors'];
}
$this->register_key('backgroundColor',$folder);
$folder->fill_content(); $folder->fill_content();
foreach($f3->get('siteColors') as $k=>$v){ foreach($f3->get('siteColors') as $k=>$v){
$f3->set($k, $f3->set($k,
? $folder->config['includeBanner'] ? $folder->config['includeBanner']
: $f3->get('templateVars.includeBanner') : $f3->get('templateVars.includeBanner')
); );
if ($f3->get('hasBanner')) { if ($f3->get('hasBanner')) {
$banner = new \Modules\CachedImage($folder->extras['banner']); $banner = new \Modules\CachedImage($folder->extras['banner']);
$f3->set('banner',$banner->get_src(2000)); $f3->set('banner',$banner->get_src(2000));
/////////////////////// ///////////////////////
// Utility functions // // Utility functions //
/////////////////////// ///////////////////////
function register_key($name, &$ff) {
$f3 = \Base::instance();
if (array_key_exists($name,$ff->config)) {
$f3->set($name,$ff->config[$name]);
}
}
function linkify($string) { function linkify($string) {
$pattern = "/\s@(\w+)[=]([\w,]+)\s/"; $pattern = "/\s@(\w+)[=]([\w,]+)\s/";
$count = 0; $count = 0;

+ 5
- 0
app/modules/filesinfolders.php View File

$this->EXT[$param['type']] $this->EXT[$param['type']]
); );
} }
if($this->extras[$key]) {
if ($param['type'] == 'txt') {
$this->read_textfile($this->extras[$key]);
}
}
} }
} }



+ 3
- 0
app/views/colors.css View File

html {
background-color: {{ @backgroundColor }};
}

+ 1
- 0
app/views/tpl/index.html View File

<link type="text/css" href="/{{ @RESOURCES }}style.css" rel="stylesheet" /> <link type="text/css" href="/{{ @RESOURCES }}style.css" rel="stylesheet" />
<title>{{ @title }}</title> <title>{{ @title }}</title>
<style> <style>
<include href="colors.css" />
li { margin-left:1em; } li { margin-left:1em; }
</style> </style>
</head> </head>

Loading…
Cancel
Save