質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
EC-CUBE

EC-CUBEは、主に日本国内で開発されているECコンテンツ管理システムです。ロックオン社のECKitを元にしてオープンソース化され、商品管理・受注管理・顧客管理・売上集計などECに特化した様々な機能を備えています。

Q&A

解決済

1回答

2938閲覧

EC-CUBEでsmartyの{debug}が使えません

mo3

総合スコア59

EC-CUBE

EC-CUBEは、主に日本国内で開発されているECコンテンツ管理システムです。ロックオン社のECKitを元にしてオープンソース化され、商品管理・受注管理・顧客管理・売上集計などECに特化した様々な機能を備えています。

0グッド

0クリップ

投稿2015/07/09 06:29

テンプレートに記載されている変数の中身が見たいのですが、{debug}が使えません。
以下のサイトを参考にdebug.tplをいじってみようと思ったのですがバージョンが違うのか変更箇所がよく分かりませんでした。

http://www.happyquality.com/2009/02/04/705.htm

現在私が使っているsmartyのdebug.tplは以下のようになっています。
EC-CUBEのバージョンは2.13.3です。
よろしくお願いします。

{* Smarty }
{
debug.tpl, last updated version 2.1.0 *}
{assign_debug_info}
{capture assign=debug_output}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Smarty Debug Console</title> {literal} <style type="text/css"> /* <![CDATA[ */ body, h1, h2, td, th, p { font-family: sans-serif; font-weight: normal; font-size: 0.9em; margin: 1px; padding: 0; }

h1 {
margin: 0;
text-align: left;
padding: 2px;
background-color: #f0c040;
color: black;
font-weight: bold;
font-size: 1.2em;
}

h2 {
background-color: #9B410E;
color: white;
text-align: left;
font-weight: bold;
padding: 2px;
border-top: 1px solid black;
}

body {
background: black;
}

p, table, div {
background: #f0ead8;
}

p {
margin: 0;
font-style: italic;
text-align: center;
}

table {
width: 100%;
}

th, td {
font-family: monospace;
vertical-align: top;
text-align: left;
width: 50%;
}

td {
color: green;
}

.odd {
background-color: #eeeeee;
}

.even {
background-color: #fafafa;
}

.exectime {
font-size: 0.8em;
font-style: italic;
}

#table_assigned_vars th {
color: blue;
}

#table_config_vars th {
color: maroon;
}
/* ]]> */
</style>
{/literal}

</head> <body> <h1>Smarty Debug Console</h1> <h2>included templates &amp; config files (load time in seconds)</h2> <div> {section name=templates loop=$_debug_tpls} {section name=indent loop=$_debug_tpls[templates].depth}&nbsp;&nbsp;&nbsp;{/section} <font color={if $_debug_tpls[templates].type eq "template"}brown{elseif $_debug_tpls[templates].type eq "insert"}black{else}green{/if}> {$_debug_tpls[templates].filename|escape:html}</font> {if isset($_debug_tpls[templates].exec_time)} <span class="exectime"> ({$_debug_tpls[templates].exec_time|string_format:"%.5f"}) {if %templates.index% eq 0}(total){/if} </span> {/if} <br /> {sectionelse} <p>no templates included</p> {/section} </div> <h2>assigned template variables</h2> <table id="table_assigned_vars"> {section name=vars loop=$_debug_keys} <tr class="{cycle values="odd,even"}"> <th>{ldelim}${$_debug_keys[vars]|escape:'html'}{rdelim}</th> <td>{$_debug_vals[vars]|@debug_print_var}</td></tr> {sectionelse} <tr><td><p>no template variables assigned</p></td></tr> {/section} </table> <h2>assigned config file variables (outer template scope)</h2> <table id="table_config_vars"> {section name=config_vars loop=$_debug_config_keys} <tr class="{cycle values="odd,even"}"> <th>{ldelim}#{$_debug_config_keys[config_vars]|escape:'html'}#{rdelim}</th> <td>{$_debug_config_vals[config_vars]|@debug_print_var}</td></tr> {sectionelse} <tr><td><p>no config vars assigned</p></td></tr> {/section} </table> </body> </html> {/capture} {if isset($_smarty_debug_output) and $_smarty_debug_output eq "html"} {$debug_output} {else} <script type="text/javascript"> // <![CDATA[ if ( self.name == '' ) {ldelim} var title = 'Console'; {rdelim} else {ldelim} var title = 'Console_' + self.name; {rdelim} _smarty_console = window.open("",title.value,"width=680,height=600,resizable,scrollbars=yes"); _smarty_console.document.write('{$debug_output|escape:'javascript'}'); _smarty_console.document.close(); // ]]> </script> {/if}

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

テンプレートをいじる前に、確認すべきは、$smarty->debugging の値じゃないですか?
Chapter 12. Smarty クラス変数

投稿2015/07/09 08:03

退会済みユーザー

退会済みユーザー

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

mo3

2015/07/09 08:27

回答ありがとうございます。お手数ですが、詳しい使い方を教えていただけると助かります。参照先のurlも見て他のサイトなども参照したのですが使い方が今一つ分かりません。 どこかに設定されている$smarty->debuggingの値を変えればいいのでしょうか?それとも確認したい変数が記入されているPHPないしテンプレートに記載すればいいのでしょうか? もし宜しければ、お願い致します。
退会済みユーザー

退会済みユーザー

2015/07/09 08:34

どこのサイトを見てどの部分がわからないのかを書いてください。読んでもわからない表現と同じ説明を繰り返しても意味がありませんので。
mo3

2015/07/09 08:40

以下のサイトの一番目を参考にしました。 ひとまず書いてあるソースをそのままコピペして現在編集しているphpの<?php~?>の中に貼り付けてみたのですがエラーになってしまいました。 http://cl.pocari.org/2006-11-29-1.html よろしくお願いします。
退会済みユーザー

退会済みユーザー

2015/07/09 10:15 編集

http://pro-grammer.info/archives/1234 こっちの方がいいんじゃない? そのサイトより新しいし。 > エラーになってしまいました。 エラーになったでは何一つ状況を伝えることはできません。そのまま記述してください。
mo3

2015/07/12 01:33

お礼が遅くなり申し訳ありません。 上記のサイトで解決致しました。 エラーになったというのはEC-CUBEの画面にエラーメッセージ「システムエラーが発生しました。大変お手数ですが、サイト管理者までご連絡ください。」が出たという状況でした。 私の拙い説明にも関わらず答えを出していただきありがとうございました。 ベストアンサーにさせていただきます。 まだまだよく分かっていないので質問にも要領を得ないところがあると思いますが、良ければまたよろしくお願い致します。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問