バージョン選択

フォーラム

メニュー

オンライン状況

78 人のユーザが現在オンラインです。 (63 人のユーザが フォーラム を参照しています。)
登録ユーザ: 0
ゲスト: 78
もっと...

サイト内検索

質問 > フロント機能 > 商品紹介ページのYouTube動画の埋め込みについて。

フロント機能

新規スレッドを追加する

スレッド表示 | 新しいものから 前のトピック | 次のトピック | 下へ
投稿者 スレッド
tarou123
投稿日時: 2022/12/12 9:42
対応状況: 解決済
半人前
登録日: 2022/12/12
居住地:
投稿: 14
商品紹介ページのYouTube動画の埋め込みについて。
▼テンプレート
[EC-CUBE]4.2.0
[現象] https://techmemo.biz/ec-cube/iframe-embed-productpage/

こちらのサイトを参考にしながら商品紹介ページにYouTubeの動画を埋めないか試したのですが、[システム設定] – [マスターデータ管理]の「mtb_allowed_tag」という設定場所がなく、iframeタグを商品紹介文で使用できません。
これの設定場所は4.2.0ではないのでしょうか?
また、他の解決方法はないか教えて頂きたいです。
shinra
投稿日時: 2022/12/12 11:34
対応状況: −−−
一人前
登録日: 2017/9/2
居住地:
投稿: 124
Re: 商品紹介ページのYouTube動画の埋め込みについて。
参考サイトはECCUBE2です
ECCUBE4の場合はHTMLPurifierを利用しているため
下記の設定ファイルを編集して、iframeの許可を追加すれば対応可能と思います
app/config/eccube/packages/exercise_html_purifier.yaml

参考:
https://github.com/Exercise/HTMLPurifierBundle (yaml構成)
https://stackoverflow.com/questions/24681541/allowing-youtube-embed-with-htmlpurifier-on-laravel-4-and-mewebstudio-purifier (HTML.SafeIframe, URI.SafeIframeRegexp)
tarou123
投稿日時: 2022/12/12 13:14
対応状況: −−−
半人前
登録日: 2022/12/12
居住地:
投稿: 14
Re: 商品紹介ページのYouTube動画の埋め込みについて。
返信ありがとうございます。

packagesフォルダの中にexercise_html_purifier.yamlというファイルが無くFileZillaの検索からapp全体を検索したのですが見つからなかったです。
4.2.0では何か別の名前のフォルダに変わっているのでしょうか?
shinra
投稿日時: 2022/12/12 13:44
対応状況: −−−
一人前
登録日: 2017/9/2
居住地:
投稿: 124
Re: 商品紹介ページのYouTube動画の埋め込みについて。
app/config/eccube/packages/exercise_html_purifier.yaml
というような形で新規作成が必要になります。
tarou123
投稿日時: 2022/12/12 15:12
対応状況: −−−
半人前
登録日: 2022/12/12
居住地:
投稿: 14
Re: 商品紹介ページのYouTube動画の埋め込みについて。
yamlという形式のファイルを触った事がなくよく分からないのですが
作成したexercise_html_purifier.yamlフォルダに下記の内容を入れたのですがエラーになってしまいます。


return array(
'encoding' => 'UTF-8',
'finalize' => true,
'preload' => false,
'settings' => array(
'default' => array(
'HTML.Doctype' => 'XHTML 1.0 Strict',
'HTML.Allowed' => 'div[style],b,strong,i,em,a[href|title|style],ul,ol,li,p[style],br,span[style],iframe,
img[width|height|alt|src],h1[style],h2[style],h3[style],h4[style],h5[style],table[class|style|summary],tr,td[abbr],tbody,thead',
'CSS.AllowedProperties' => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align',
'HTML.SafeObject' => true,
'Output.FlashCompat' => true,
'HTML.SafeIframe' => true,
'URI.SafeIframeRegexp' => '%^(http://|https://|//)(www.youtube.com/embed/|player.vimeo.com/video/)%',
'AutoFormat.AutoParagraph' => true,
'AutoFormat.RemoveEmpty' => true,
'HTML.Nofollow' => true,
'URI.Host' => 'domain.com',
'Filter.YouTube' => true
),
),
);

このように記述しました。
mcontact
投稿日時: 2022/12/12 16:42
対応状況: −−−
登録日: 2022/1/22
居住地:
投稿: 1294
Re: 商品紹介ページのYouTube動画の埋め込みについて。
下記サイトのConfiguration項目を参考にしてみてください。
https://packagist.org/packages/exercise/htmlpurifier-bundle
shinra
投稿日時: 2022/12/12 18:28
対応状況: −−−
一人前
登録日: 2017/9/2
居住地:
投稿: 124
Re: 商品紹介ページのYouTube動画の埋め込みについて。
yamlの内容ですが、以下でどうでしょうか?

exercise_html_purifier:
html_profiles:
default:
config:
HTML.SafeIframe: true
URI.SafeIframeRegexp: '''^www.youtube.com/embed/" rel="external">https://(www.youtube.com/embed/|player.vimeo.com/video/)'''
tarou123
投稿日時: 2022/12/13 11:03
対応状況: −−−
半人前
登録日: 2022/12/12
居住地:
投稿: 14
Re: 商品紹介ページのYouTube動画の埋め込みについて。
Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\InvalidArgumentException: There is no extension able to load the configuration for "html_profiles" (in "/home/○○/○○.co.jp/public_html/ec-cube/app/config/eccube/packages/exercise_html_purifier.yaml"). Looked for namespace "html_profiles", found ""framework", "security", "doctrine", "doctrine_fixtures", "sensio_framework_extra", "monolog", "twig", "knp_paginator", "exercise_html_purifier", "doctrine_migrations", "twig_extra", "api", "league_oauth2_server", "eccube"". in /home/○○a/○○.co.jp/public_html/ec-cube/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php:799 Stack trace: #0 /home/○○/○○a.co.jp/public_html/ec-cube/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php(774): Symfony\Component\DependencyInjection\Loader\YamlFileLoader->validate(Array, '/home/○○...') #1 /home/○○/○○.co.jp/public_html/ec-cube/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php(123): Symf in /home/○○/○○.co.jp/public_html/ec-cube/vendor/symfony/config/Loader/FileLoader.php on line 174

教えて頂いたコードをyamlに入力したのですが、上のようなエラーが出ます(〇〇は伏字です。
何かの設定をしないといけないのでしょうか?
shinra
投稿日時: 2022/12/13 11:49
対応状況: −−−
一人前
登録日: 2017/9/2
居住地:
投稿: 124
Re: 商品紹介ページのYouTube動画の埋め込みについて。
exercise_html_purifier:
  html_profiles:
    default:
      config:
        HTML.SafeIframe: true
        URI.SafeIframeRegexp: '''^https://(www.youtube.com/embed/|player.vimeo.com/video/)'''

スペースが無かったからかもですね、上記ならどうでしょうか
tarou123
投稿日時: 2022/12/13 12:03
対応状況: −−−
半人前
登録日: 2022/12/12
居住地:
投稿: 14
Re: 商品紹介ページのYouTube動画の埋め込みについて。
できました!ありがとうございます、大変助かりました!!
スレッド表示 | 新しいものから 前のトピック | 次のトピック | トップ


 



ログイン


EC-CUBE公式 Amazon Payプラグイン

統計情報

総メンバー数は88,859名です
総投稿数は109,996件です

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2313
5
umebius
2085
6
yuh
1819
7
h_tanaka
1646
8
red
1570
9
mcontact
1294
10
tsuji
958
11
fukap
907
12
shutta
835
13
tao_s
799
14 ramrun 789
15 karin 689
16 sumida 641
17
homan
633
18 DELIGHT 572
19
patapata
502
20
flealog
485


ネットショップの壺

EC-CUBEインテグレートパートナー

Copyright© EC-CUBE CO.,LTD. All Rights Reserved.