묻고답하기
애드온 중복실행 문제.
2012.12.07 20:51
애드온 이름 : settitle
코드
<?php if(!defined("__XE__")) exit(); if($called_position = before_display_content){ if(Context::get('module') != $addon_info->adminpage_use) { if($addon_info->titletik_type == 'yes') { $addon_info->titletik = " " .$addon_info->titletik. " "; } $midname = Context::getBrowserTitle(); if($addon_info->titlename_use == 'yesa') { Context::setBrowserTitle($addon_info->titlename); }else if($addon_info->titlename_use == 'yesb') { Context::setBrowserTitle($addon_info->titlename. "" .$addon_info->titletik. "" .$midname); }else if($addon_info->titlename_use == 'yesc') { Context::setBrowserTitle($midname. "" .$addon_info->titletik. "" .$addon_info->titlename); } if($addon_info->www_use == 'typea') { if($addon_info->html5 == 'yes') { $script = "<script>if (!(location.host==\"".$addon_info->siteurl."\")){window.location=\"http://".$addon_info->siteurl."\"+location.pathname+location.search}</script>"; Context::addHtmlHeader($script); }else { $script = "<script type=\"text/javascript\">if (!(location.host==\"".$addon_info->siteurl."\")){window.location=\"http://".$addon_info->siteurl."\"+location.pathname+location.search}</script>"; Context::addHtmlHeader($script); } }else if($addon_info->www_use == 'typeb') { if($addon_info->html5 == 'yes') { $script = "<script>if (!(location.host==\"".$addon_info->siteurl."\")){window.location=\"http://www.".$addon_info->siteurl."\"+location.pathname+location.search}</script>"; Context::addHtmlHeader($script); }else { $script = "<script type=\"text/javascript\">if (!(location.host==\"www.".$addon_info->siteurl."\")){window.location=\"http://www.".$addon_info->siteurl."\"+location.pathname+location.search}</script>"; Context::addHtmlHeader($script); } } } } ?>
애드온xml
<?xml version="1.0" encoding="UTF-8"?> <addon version="0.2"> <title xml:lang="ko">타이틀 설정 애드온</title> <title xml:lang="en">Set Title Addon</title> <description> 간단하게 사이트 타이틀을 바꿔주며 몇가지 부가 기능이 있습니다. </description> <version>1.2</version> <date>2012-11-13</date> <link>http://teamatde.co.kr/</link> <author email_address="hyung778@gmail.com" link="http://teamatde.co.kr/"> <name>LI-NA</name> </author> <extra_vars> ~ 생략 ~ </extra_vars> </addon>
어떻게 해봐도 해결되지 않네요....
어디에 문제가 있을까요?
같은 xml에 php코드만 바꿔서 settitle2로 해봤습니다.
코드
<?php if(!defined("__XE__")) exit(); if($called_position = before_display_content) { if(Context::get('module') != $addon_info->adminpage_use) { if($addon_info->titletik_type == 'yes') { $addon_info->titletik = " " .$addon_info->titletik. " "; } if($addon_info->titlename_use == 'yesa') { $script = "<script type=\"text/javascript\">document.title='".$addon_info->titlename."';</script>"; Context::addHtmlHeader($script); }else if($addon_info->titlename_use == 'yesb') { $script = "<script type=\"text/javascript\">var title=document.title;document.title='".$addon_info->titlename."'+'".$addon_info->titletik."'+title;</script>"; Context::addHtmlHeader($script); }else if($addon_info->titlename_use == 'yesc') { $script = "<script type=\"text/javascript\">var title=document.title;document.title=title+'".$addon_info->titletik."'+'".$addon_info->titlename."';</script>"; Context::addHtmlHeader($script); } if($addon_info->www_use == 'typea') { if($addon_info->html5 == 'yes') { $script = "<script>if (!(location.host=='".$addon_info->siteurl."')){window.location='http://".$addon_info->siteurl."'+location.pathname+location.search}</script>"; Context::addHtmlHeader($script); }else { $script = "<script type=\"text/javascript\">if (!(location.host=='".$addon_info->siteurl."')){window.location='http://".$addon_info->siteurl."'+location.pathname+location.search}</script>"; Context::addHtmlHeader($script); } }else if($addon_info->www_use == 'typeb') { if($addon_info->html5 == 'yes') { $script = "<script>if (!(location.host=='".$addon_info->siteurl."')){window.location=\"http://www.".$addon_info->siteurl."'+location.pathname+location.search}</script>"; Context::addHtmlHeader($script); }else { $script = "<script type=\"text/javascript\">if (!(location.host=='www.".$addon_info->siteurl."')){window.location='http://www.".$addon_info->siteurl."'+location.pathname+location.search}</script>"; Context::addHtmlHeader($script); } } } } ?>
그래도 여전히 안되더군요...ㅠㅠ
코드상에 문제가 있는걸까요?
아니면 코어상의 문제일까요...?
답변 부탁드립니다.
댓글 2
-
퍼니엑스이
2012.12.08 18:29
-
LI-NA
2012.12.08 18:54
그런데 문제가 아직도 발생합니다. 아레의 답변을 참고해주세요. -
LI-NA
2012.12.08 18:55
코드를 다시 짰습니다.
이제는 제 테스트 홈페이지 2곳중 1곳에서만 중복실행되는군요....ㅠㅠ
<?php
if(!defined("__ZBXE__")) exit();
if($called_position != "before_display_content") return;
if($addon_info->adminpage_use == 'admin' && Context::get('module') == 'admin') return;
if($addon_info->titlename_use != 'no'){
$midname = Context::getBrowserTitle();
if($addon_info->titletik_type == 'yes') $titletik = " " .$addon_info->titletik. " ";
switch ($addon_info->titlename_use){
case 'yesa': $title = $addon_info->titlename; break;
case 'yesb': $title = $addon_info->titlename.''.$titletik.''.$midname; break;
case 'yesc': $title = $midname.''.$addon_info->titletik.''.$addon_info->titlename; break;
}
Context::setBrowserTitle($title);
}
if($addon_info->www_use != 'no'){
$siteurl = $addon_info->siteurl;
if($addon_info->www_use == 'typea') {
$script = "<script type=\"text/javascript\">if (!(location.host=='".$siteurl."')){window.location='http://".$siteurl."'+location.pathname+location.search}</script>";
}else if($addon_info->www_use == 'typeb') {
$script = "<script type=\"text/javascript\">if (!(location.host=='www.".$siteurl."')){window.location='http://www.".$siteurl."'+location.pathname+location.search}</script>";
}
Context::addHtmlHeader($script);
}
?>