/** * Smarty {includemiscfiles} postfilter plugin * * Type: postfilter<br> * Name: includemiscfiles<br> * Purpose: This function creates html loaders for - currently - JS and CSS Files * Please note it will only work for newtype __names (SomeModule, SomeForm, SomeTheme, SomeControl...) * * @param $compiledsource * @param \Smarty $smarty * * @return bool */ function smarty_postfilter_includemiscfiles($compiledsource, &$smarty) { ob_start(); //CSS $myCSS = expCore::resolveFilePaths("guess", $smarty->getTemplateVars('__name'), "css", $smarty->getTemplateVars('__view') . "*"); if ($myCSS != false) { foreach ($myCSS as $myCSSFile) { echo "<link rel='stylesheet' type='text/css' href='" . expCore::abs2rel($myCSSFile) . "'></link>\n"; } } //JavaScript $myJS = expCore::resolveFilePaths("guess", $smarty->getTemplateVars('__name'), "js", $smarty->getTemplateVars('__view') . "*"); if ($myJS != false) { foreach ($myJS as $myJSFile) { echo "<script type='text/javascript' src='" . expCore::abs2rel($myJSFile) . "'></script>\n"; } } $html = ob_get_contents(); ob_end_clean(); return $html . $compiledsource; }
public static function getViewConfigOptions($module, $view) { $form_file = ""; $filepath = array_shift(expCore::resolveFilePaths("modules", $module, "form", $view)); if ($filepath != false) { $form_file = $filepath; } if ($form_file == "") { return array(); } // no form file, no options $fh = fopen($form_file, "r"); $options = array(); while (($control_data = fgetcsv($fh, 65536, "\t")) !== false) { $data = array(); foreach ($control_data as $d) { if ($d != "") { $data[] = $d; } } $options[$data[0]] = $data[1]; } return $options; }