Autor | Zpráva | ||
---|---|---|---|
Fisak Profil |
#1 · Zasláno: 7. 11. 2013, 19:03:30 · Upravil/a: Fisak
Dobrý den, mám funkci:
function titleIn($value) { //fce pro změnu titlu v dokumentu $_SESSION['actuall_title'] = $value; return $_SESSION['actuall_title']; } Chyba: "Parse error: syntax error, unexpected T_VARIABLE in /data/web/virtuals/30303/virtual/www/domains/../system/class/class.template.php on line 54 <?php class Template { public function sqlDefaultTemplate($string) { $sql = DB::query("SELECT %n", $string, " FROM [:pref:page] where [page] = %s", mypage("page")); return $sql->fetchSingle(); } public function insertTemplate($temp, $in = false) { $content = file_get_contents("./system/template/".$temp.".html"); if ($in) { foreach ($in as $k => $v) { $content = str_replace("{#$k}", $v, $content); } } return $content; } public function template_admin() { load_page("admin/php_modules/".$this->sqlDefaultTemplate("page")."/index.php"); $h = array(); $h['title'] = get_tag("title"); $h['language'] = get_current_lang(); $h['keywords'] = get_tag("keywords"); $h['author'] = get_tag("author"); $h['description'] = get_tag("description"); $h['head'] = options("headers"); $h['analytics'] = options("analytics"); $h['style'] = ("/themes/admin/".get_current_lang()."/images/styles.css"); ob_start(); load_page("themes/admin/".get_current_lang()."/index.php"); $load_c = ob_get_contents(); ob_end_clean(); $c = array(); $c['content'] = $load_c; echo($this->insertTemplate('head', $h)); echo($this->insertTemplate('content', $c)); echo($this->insertTemplate('footer')); } public function template_inc($title_in = $_SESSION['actuall_title']) { if(file_exists("php_modules/".$this->sqlDefaultTemplate("page")."/index.php")) { load_page("php_modules/".$this->sqlDefaultTemplate("page")."/index.php"); //php modul } $h = array(); if ($title_in != "") { //pokud je title v sessionu $h['title'] = $title_in; unset($_SESSION['actuall_title']); } else { $h['title'] = get_tag("title"); } $h['language'] = get_current_lang(); $h['keywords'] = get_tag("keywords"); $h['author'] = get_tag("author"); $h['description'] = get_tag("description"); $h['head'] = options("headers"); $h['analytics'] = options("analytics"); if(!$this->sqlDefaultTemplate("style")){ $h['style'] = ("/themes/web/".get_current_lang()."/".options("template")."/images/styles.css"); } else { $h['style'] = ("/themes/css/".$this->sqlDefaultTemplate("style")); } ob_start(); load_page("themes/web/".get_current_lang()."/".options("template")."/skin/".$this->sqlDefaultTemplate("skin").".php"); $load_c = ob_get_contents(); ob_end_clean(); $c = array(); $c['content'] = $load_c; if($this->sqlDefaultTemplate("htmlc") != "no") { echo($this->insertTemplate('head', $h)); echo($this->insertTemplate('content', $c)); echo($this->insertTemplate('footer')); } else { load_content(); } } public function print_template() { $tpl = $this->sqlDefaultTemplate("page"); if(!empty($tpl)) { //administrace if ($this->sqlDefaultTemplate("type") == "admin") { $this->template_admin(); } //obsah if ($this->sqlDefaultTemplate("type") == "inc") { $this->template_inc(); } } else { //neexistující stránka redirect_page("defense", "1"); } } } Předem děkuji za jakoukoliv radu. |
||
Alphard Profil |
#2 · Zasláno: 7. 11. 2013, 19:30:57
Je to syntaktická chyba, jako defaultní hodnotu nelze předat jinou proměnnou. Lze dosadit třeba null a ošetřit si to v těle.
|
||
Časová prodleva: 10 let
|
0