ページ 1 / 1
テンプレートを指定したリソースの追加ができない
Posted: 2011年4月01日(金) 19:27
by sama55
MODXのバージョン: 1.0.5J-r2/1.0.5J-r3
テンプレート($_REQUEST['newtemplate'])を指定して、manager/index.phpでリソースを追加すると、ManagerManagerが誤動作するようです。
例)
<a href="manager/index.php?a=4&pid=999
&newtemplate=9">親リソース(ID=999)下にテンプレート(ID=9)でリソースを追加</a>
再現条件)
1.ManagerManagerを導入していること
2.グローバル設定 > デフォルトテンプレート とは違うテンプレートを指定すること
plugin/managermanager/mm.inc.phpのL85あたりが怪しそうですが原因&修正方法はまだ分かりません。
$mm_current_page['template'] = isset($_POST['template']) ? $_POS ・・・
関連スレ:
ダッシュボードのカスタマイズ
Re: テンプレートを指定したリソースの追加ができない
Posted: 2011年8月01日(月) 18:27
by dyat
現在ページのテンプレート取得が上手く行っていないようです。
assets/plugins/managermanager/mm.inc.phpの85行目付近を下記のように修正すると上手く動作しました。
【修正前】
コード: 全て選択
$mm_current_page['template'] = isset($_POST['template']) ? $_POST['template'] : isset($content['template']) ? $content['template'] : $_GET['newtemplate'] ? $_GET['newtemplate'] : $default_template;
【修正後】
コード: 全て選択
if( isset($_POST['template']) ){
$mm_current_page['template'] = $_POST['template'];
} elseif( isset($content['template'])){
$mm_current_page['template'] = $content['template'];
} elseif( $_GET['newtemplate'] ){
$mm_current_page['template'] = $_GET['newtemplate'];
} else {
$mm_current_page['template'] = $default_template;
}
Re: テンプレートを指定したリソースの追加ができない
Posted: 2011年8月02日(火) 09:20
by sama55
dyatさん、ありがとうございます。
modx-1.0.5J-r4の改修ロジックに従うと、下のようになるようです。
変更点1: $_GET['newtemplate']の存在をissetで判定
変更点2: $_GETを$contentよりも先に判定
【修正後】
コード: 全て選択
if( isset($_POST['template']) ){
$mm_current_page['template'] = $_POST['template'];
} elseif( isset($_GET['newtemplate'])){
$mm_current_page['template'] = $_GET['newtemplate'];
} elseif( isset($content['template'])){
$mm_current_page['template'] = $content['template'];
} else {
$mm_current_page['template'] = $default_template;
}
補足)この問題はmodx-1.0.5J-r4で改修されています(コードの記述方法は若干違いますがロジックは同じです)。
Re: テンプレートを指定したリソースの追加ができない
Posted: 2011年8月02日(火) 11:18
by dyat
sama55さん、ありがとうございます。
r4で修正されているとのこと、有益な情報に感謝です。
ちなみに先の投稿が本フォーラム初投稿でしたが、温かくお返事を頂けたので、ホッとしております。
それでは、今後ともよろしくお願いいたします。