4行加えるだけなので実装は簡単。 載せるページのview.ctpに以下のコードを加えます。
今回はContentテーブルにpathを格納しているので、アドレスの呼び出しは$content['Content']['path']になっています。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="movies"> | |
<video controls id="video" width="600" height="400" /> | |
<source src=<?php echo $content['Content']['path'] ?>/> | |
</div> |
pathは「 /movie/動画ファイル名.mp4 」でテーブルに格納してあります。
contents画面からviewボタンで詳細ページに移動すると、画像のように動画が表示されます。
0 件のコメント:
コメントを投稿