プラグイン > バグ報告・利用に関する質問 > Impossible to access an attribute ("name01") on a string variable ("anon.").について |
バグ報告・利用に関する質問
スレッド表示 | 古いものから | 前のトピック | 次のトピック | 下へ |
投稿者 | スレッド |
---|---|
umebius |
投稿日時: 2019/3/25 7:15
対応状況: −−−
|
神 登録日: 2016/7/22 居住地: 投稿: 2085 |
Re: Impossible to access an attribute ("name01") on a string variable ("anon.").について 良かったです!
|
shige0309 |
投稿日時: 2019/3/24 3:42
対応状況: 解決済
|
半人前 登録日: 2018/2/27 居住地: 投稿: 28 |
Re: Impossible to access an attribute ("name01") on a string variable ("anon.").について umebius様
{% if NewsImages is defined and NewsImages[News.id] %}に変更ごエラーが発生しなくなりました。 本当に助かりました! 色々とご丁寧にありがとうございました |
umebius |
投稿日時: 2019/3/24 1:44
対応状況: −−−
|
神 登録日: 2016/7/22 居住地: 投稿: 2085 |
Re: Impossible to access an attribute ("name01") on a string variable ("anon.").について そうなのですね、だとすると画像が1つも登録されていない場合NewsImages変数が渡ってきていないといった問題があるのでしょうか...
とりあえず {% if NewsImages[News.id] %}を {% if NewsImages is defined and NewsImages[News.id] %}に変更すればエラー回避できるのではないかと思います。 |
shige0309 |
投稿日時: 2019/3/24 1:40
対応状況: −−−
|
半人前 登録日: 2018/2/27 居住地: 投稿: 28 |
Re: Impossible to access an attribute ("name01") on a string variable ("anon.").について umebius様
ご返信ありがとうございます! 新着情報画像 for EC-CUBE3ですが、 {% if NewsImages[News.id] %} <img src='{{ app.config.image_save_urlpath }}/{{ NewsImages[News.id] }}' /> {% endif %} 「新着情報ブロック編集ページの「{% for News in NewsList %}{% endfor %}」内に上記タグを追加して下さい。」とのことです。 とりあえず確認した所、新着情報ブロックに埋め込んでありました。 「新着情報ブロック」 <li class="col-xl-4 col-lg-4 col-md-4 mt-3 col-sm-4 col-6"> {% if News.url %} <a href="{{ News.url }}" {% if News.link_method=='1' %}target="_blank" {% endif %}>{% endif %} {% if NewsImages[News.id] %} <img src="{{ app.config.image_save_urlpath }}/{{ NewsImages[News.id] }}"/> {% else %} <img src="{{ app.config.front_urlpath }}/img/common/no_image.gif" alt="NO IMAGE"/> {% endif %} <br> <p class="topics-cat_time mt-2"><time datetime="{{ News.date|date('Y/m/d') }}">{{ News.date|date('Y/m/d') }}</time></p> <p class="font-weight-bold mt-2">{{ News.title }}</p> {% if News.comment or News.url %} <span class="mt-2 mb-5 d-inline-block">{{ News.comment|raw|nl2br }}</span> {% endif %} {% if News.url %}</a>{% endif %} </li> 申し訳ございませんが、ご教示頂けますと幸いです。 |
umebius |
投稿日時: 2019/3/24 1:23
対応状況: −−−
|
神 登録日: 2016/7/22 居住地: 投稿: 2085 |
Re: Impossible to access an attribute ("name01") on a string variable ("anon.").について 新着情報画像 for EC-CUBE3については良く知らないのですが、
要はNewsImagesという変数がtwigに使われているのに、コントローラー(プラグインのEventかも)から渡されてきていないというエラーです。 なのでNewsImagesというtwigの変数がどこで使われているかをまず特定することが先決かと思います。 その周辺のコードをご提示いただければ修正案は出せるかもしれません。 |
shige0309 |
投稿日時: 2019/3/24 1:17
対応状況: 確認中
|
半人前 登録日: 2018/2/27 居住地: 投稿: 28 |
Re: Impossible to access an attribute ("name01") on a string variable ("anon.").について umebius様
FrontControllerProviderにURLを設定した所エラーは解除されました ありがとうございます! 下記エラーが発生しました NewsImagesはプラグインの「新着情報画像 for EC-CUBE3」の変数のような気がします。 Twig_Error_Runtime in Template.php line 487: Variable "NewsImages" does not exist in "__string_template__ae62a1f11f6987c8bde50dfb704849943530435d725477cabb7bc5b5346cb8f9" at line 14. すみませんが、ご教示いただけると幸いです。 |
shige0309 |
投稿日時: 2019/3/24 0:59
対応状況: −−−
|
半人前 登録日: 2018/2/27 居住地: 投稿: 28 |
Re: Impossible to access an attribute ("name01") on a string variable ("anon.").について umebius様
おっしゃられる通り、動的なブロックです。 静的なら楽なのですが 下記参考にさせていただきます EC-CUBE3 動的ブロックの作成方法 本当にありがとうございます! 大変助かります |
umebius |
投稿日時: 2019/3/24 0:16
対応状況: −−−
|
神 登録日: 2016/7/22 居住地: 投稿: 2085 |
Re: Impossible to access an attribute ("name01") on a string variable ("anon.").について DBへ直接INSERTされるということは
動的な内容があるブロックということですか? (静的なものなら管理画面から作成する方が楽なので) 動的であれば、よろしければ参考にしてください。 EC-CUBE3 動的ブロックの作成方法
|
shige0309 |
投稿日時: 2019/3/23 23:59
対応状況: −−−
|
半人前 登録日: 2018/2/27 居住地: 投稿: 28 |
Re: Impossible to access an attribute ("name01") on a string variable ("anon.").について umebius様
データベースに直接INSERT致しました。 FrontControllerProviderにURL記載していないので、記載してみます。 ご返信ありがとうございます。 大変助かります。 |
umebius |
投稿日時: 2019/3/23 23:55
対応状況: −−−
|
神 登録日: 2016/7/22 居住地: 投稿: 2085 |
Re: Impossible to access an attribute ("name01") on a string variable ("anon.").について 全く別のエラーですね。
Blockフォルダにファイルが存在しないかどうかはわかりませんが、 FrontControllerProviderにURLの記載がないからだと思います。 header_right_menuブロックはどうやって作成されたのでしょうか? データベースに直接INSERTですか? |
(1) 2 » |
スレッド表示 | 古いものから | 前のトピック | 次のトピック | トップ |