inferno-prime Posted January 10, 2020 Share Posted January 10, 2020 I am investigating an alternative video sharing script in the event my primary fails to work. It has or uses videojs as the player and uses phtml files with some html code. There is one file from videojs and some php code for it in the page. My problem is its not html code so I am uncertain as to where to place the needed code to add the new plugin for videojs. Here is the code I am talking about: <?php if ($playlist) $this->addBodyClass('is-playlist'); $this->addMeta('videoId', $video->videoId); $this->addMeta('theme', $this->options->themeUrl); $this->addMeta('loggedIn', (boolean) $loggedInUser); $this->addCss('video-js.css'); $this->addCss('scrollbar.css'); $this->addJs('video.plugin.js'); $this->addJs('scrollbar.js'); $this->setLayout('full'); ?> <!-- BEGIN Video Player --> <?php if ($video->gated && !$loggedInUser): ?> <div id="player-gated"> <img width="750" height="420" src="<?=$config->thumbUrl?>/<?=$video->filename?>.jpg" alt="" /> <div> <p><?=Language::getText('gated_video')?></p> <a href="<?=BASE_URL?>/login/" class="button_small"><?=Language::getText('login')?></a> <?php if ($config->enableRegistrations): ?> <a href="<?=BASE_URL?>/register/" class="button_small"><?=Language::getText('register')?></a> <?php endif; ?> </div> </div> <?php else: ?> <div class="video-player-container"> <video id="video-player" class="video-js vjs-default-skin vjs-16-9" data-setup='{ "controls": true, "autoplay": true, "preload": "auto" }' width="750" height="420" poster="<?=$config->thumbUrl?>/<?=$video->filename?>.jpg"> <source src="<?=$config->h264Url?>/<?=$video->filename?>.mp4" type="video/mp4" /> <?php if ($webmEncodingEnabled): ?> <source src="<?=$config->webmUrl?>/<?=$video->filename?>.webm" type="video/webm" /> <?php endif; ?> <?php if ($theoraEncodingEnabled): ?> <source src="<?=$config->theoraUrl?>/<?=$video->filename?>.ogg" type="video/ogg" /> <?php endif; ?> </video> </div> <?php endif; ?> <!-- END Video Player --> I appreciate any help on this. If there is anymore information you need please let me know. Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/ Share on other sites More sharing options...
requinix Posted January 11, 2020 Share Posted January 11, 2020 Sure looks like HTML to me. The "phtml" just means it's HTML that has some PHP in it. What code? Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573319 Share on other sites More sharing options...
inferno-prime Posted January 11, 2020 Author Share Posted January 11, 2020 Yeah I did a lookup on that. How should I go about inserting the html from videojs ? Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573320 Share on other sites More sharing options...
inferno-prime Posted January 13, 2020 Author Share Posted January 13, 2020 Sorry I was referring to this code: <script src="//path/to/video.min.js"></script> <script src="//path/to/videojs-theater-mode.min.js"></script> <script> var player = videojs('my-video'); player.theaterMode({ elementToToggle: 'page', className: 'theater-mode' }); player.on('theaterMode', function(elm, data) { if (data.theaterModeIsOn) { // do something } else { // do something else } }); </script> Its for a plugin for videojs. Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573455 Share on other sites More sharing options...
requinix Posted January 13, 2020 Share Posted January 13, 2020 I guess I'm not really sure where the difficulty is? You have the HTML that puts the video on the page, and you have the HTML (containing Javascript) to set up the video. You put them together. Do you know what the resulting HTML is supposed to look like? If you know that then it shouldn't take much to see where the <script>s need to go. Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573461 Share on other sites More sharing options...
inferno-prime Posted January 13, 2020 Author Share Posted January 13, 2020 Sorry since the code looks different to me then the normal html I have seen I was unsure where in the file to put it. Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573467 Share on other sites More sharing options...
inferno-prime Posted January 14, 2020 Author Share Posted January 14, 2020 The code in my first post is whats already in the file I am editing I did not put it there. I am just inserting the other script code I posted to enable another feature of videojs. I don't know any php so I did not know where to place the code. I only know that some script code goes into the header of the html. I have never dealt with anything like adding script code to an already existing flash player to enable more features. Just trying to get a better understanding sorry to be a bother. Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573473 Share on other sites More sharing options...
requinix Posted January 14, 2020 Share Posted January 14, 2020 You say it should go into the header but what I see makes me question that. I can't say for sure that the header is the wrong place, just that I'm not sure it isn't. What you posted does not include the header. As in the <head>. But fortunately putting stuff into the header is a discouraged practice anyways. You have a <div class="video-player-container"> that holds stuff for the video. You have some <script>s related to it. Put the scripts after the video. Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573475 Share on other sites More sharing options...
inferno-prime Posted January 14, 2020 Author Share Posted January 14, 2020 Sorry but could you be a bit more specific when you mean after the video. Do you mean after the </div> tag for the video ? Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573498 Share on other sites More sharing options...
requinix Posted January 14, 2020 Share Posted January 14, 2020 3 minutes ago, inferno-prime said: Sorry but could you be a bit more specific when you mean after the video. Do you mean after the </div> tag for the video ? Makes sense to me. Does it make sense to you? Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573499 Share on other sites More sharing options...
inferno-prime Posted January 14, 2020 Author Share Posted January 14, 2020 (edited) Sorry I have not done this in a while. Thanks,if I have anymore trouble with this could I reply back ? I REALLY appreciate the help.😀 Edited January 14, 2020 by inferno-prime Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573500 Share on other sites More sharing options...
requinix Posted January 14, 2020 Share Posted January 14, 2020 Of course. Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573502 Share on other sites More sharing options...
inferno-prime Posted January 15, 2020 Author Share Posted January 15, 2020 Ran into another problem. Its asking for the video to be defined,but its not one single video. So how do you define any video that plays in the player ? Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573503 Share on other sites More sharing options...
requinix Posted January 15, 2020 Share Posted January 15, 2020 Then there are more changes besides just the player that will need to be made. What's the rest of the code? Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573504 Share on other sites More sharing options...
inferno-prime Posted January 15, 2020 Author Share Posted January 15, 2020 You mean from the videojs plugin ? Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573505 Share on other sites More sharing options...
requinix Posted January 15, 2020 Share Posted January 15, 2020 I mean from the page you're working with. If there are more videos then there is code that is outputting them and it isn't included in what you posted. Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573506 Share on other sites More sharing options...
inferno-prime Posted January 15, 2020 Author Share Posted January 15, 2020 <?php if ($playlist) $this->addBodyClass('is-playlist'); $this->addMeta('videoId', $video->videoId); $this->addMeta('theme', $this->options->themeUrl); $this->addMeta('loggedIn', (boolean) $loggedInUser); $this->addCss('video-js.css'); $this->addCss('video-theatermode.css'); $this->addCss('scrollbar.css'); $this->addJs('video.plugin.js'); $this->addJs('video.theatermode.js'); $this->addJs('scrollbar.js'); $this->setLayout('full'); ?> <div class="row"> <div class="col-md-8 play-left"> <div class="alert hidden"></div> <!-- BEGIN Video Player --> <?php if ($video->gated && !$loggedInUser): ?> <div id="player-gated"> <img width="750" height="420" src="<?=$config->thumbUrl?>/<?=$video->filename?>.jpg" alt="" /> <div> <p><?=Language::getText('gated_video')?></p> <a href="<?=BASE_URL?>/login/" class="button_small"><?=Language::getText('login')?></a> <?php if ($config->enableRegistrations): ?> <a href="<?=BASE_URL?>/register/" class="button_small"><?=Language::getText('register')?></a> <?php endif; ?> </div> </div> <?php else: ?> <div class="video-player-container"> <video id="video-player" class="video-js vjs-default-skin vjs-16-9" data-setup='{ "controls": true, "autoplay": true, "preload": "auto" }' width="750" height="420" poster="<?=$config->thumbUrl?>/<?=$video->filename?>.jpg"> <source src="<?=$config->h264Url?>/<?=$video->filename?>.mp4" type="video/mp4" /> <?php if ($webmEncodingEnabled): ?> <source src="<?=$config->webmUrl?>/<?=$video->filename?>.webm" type="video/webm" /> <?php endif; ?> <?php if ($theoraEncodingEnabled): ?> <source src="<?=$config->theoraUrl?>/<?=$video->filename?>.ogg" type="video/ogg" /> <?php endif; ?> </video> </div> <?php endif; ?> <script src="https://www.example.com/tv/cc-content/themes/corporate/js/video.plugin.js"></script> <link rel="stylesheet" href="https://www.example.com/tv/cc-content/themes/corporate/css/video-theatermode.css"> <script src="https://www.example.com/tv/cc-content/themes/corporate/js/video.theatermode.js"></script> <script> var player = video-player-container('my-video'); player.theaterMode({ elementToToggle: 'page', className: 'theater-mode' }); player.on('theaterMode', function(elm, data) { if (data.theaterModeIsOn) { // do something } else { // do something else } }); </script> <!-- END Video Player --> <!-- BEGIN Playlist --> <?php if ($playlist): ?> <div id="playlist"> <header> <a class="playlist-collapse pull-right hidden-lg" href="#playlist .video-list" data-toggle="collapse"> <span class="glyphicon glyphicon-triangle-bottom"></span> </a> <h5><?=Functions::cutOff($this->getService('Playlist')->getPlaylistName($playlist), 85)?></h5> <?php $playlistAuthor = $this->getMapper('User')->getUserById($playlist->userId); ?> <p class="small"> <span class="author"><?=Language::getText('by')?>: <a href="<?=BASE_URL?>/members/<?=$playlistAuthor->username?>/"><?=$playlistAuthor->username?></a></span> <?=Language::getText('videos')?>: <?=count($playlistVideos)?> </p> </header> <div class="scrollbar-outer"> <div class="video-list collapse in"> <?php $videoService = $this->getService('Video'); ?> <?php foreach ($playlistVideos as $playlistVideo): ?> <div class="video video-small media <?=($playlistVideo->videoId == $video->videoId) ? 'active' : ''?>"> <div class="media-left thumbnail"> <a href="<?=$videoService->getUrl($playlistVideo)?>/?playlist=<?=$playlist->playlistId?>" title="<?=$playlistVideo->title?>"> <span class="glyphicon glyphicon-play"></span> <img class="media-object" width="100" height="56" src="<?=$config->thumbUrl?>/<?=$playlistVideo->filename?>.jpg" /> </a> </div> <div class="media-body"> <p class="media-heading"><a href="<?=$videoService->getUrl($playlistVideo)?>/?playlist=<?=$playlist->playlistId?>" title="<?=$playlistVideo->title?>"><?=$playlistVideo->title?></a></p> <div class="small"> <?=Language::getText('by')?>:</strong> <a href="<?=BASE_URL?>/members/<?=$playlistVideo->username?>/" title="<?=$playlistVideo->username?>"><?=$playlistVideo->username?></a> <span class="duration"><span class="glyphicon glyphicon-time"></span> <?=$playlistVideo->duration?></span> </div> </div> </div> <?php endforeach; ?> </div> </div> </div> <?php endif; ?> <!-- END Playlist --> <!-- BEGIN Actions --> <div class="panel panel-default actions"> <div class="panel-body row"> <div class="col-xs-12"> <h1><?=$video->title?></h1> </div> <div class="col-xs-6"> <p> <span class="like"> <span class="glyphicon glyphicon-thumbs-up"></span> <?=$rating->likes?> </span> <span class="dislike"> <span class="glyphicon glyphicon-thumbs-down"></span> <?=$rating->dislikes?> </span> </p> </div> <div class="col-xs-6 text-right"> <a class="rating" href="" data-video="<?php echo $video->videoId; ?>" data-rating="1" title="<?=Language::getText('like')?>"> <span class="glyphicon glyphicon-thumbs-up"></span> <?=Language::getText('like')?> </a> <a class="rating" href="" data-video="<?php echo $video->videoId; ?>" data-rating="0" title="<?=Language::getText('dislike')?>"> <span class="glyphicon glyphicon-thumbs-down"></span> <?=Language::getText('dislike')?> </a> </div> </div> </div> <!-- END Actions --> <!-- BEGIN Action Tabs --> <ul class="nav nav-tabs"> <li><a href="#about" data-toggle="tab"><?=Language::getText('about')?></a></li> <li><a href="#share" data-toggle="tab"><?=Language::getText('share')?></a></li> <li><a href="#add-to-playlist" data-toggle="tab" id="playlist-toggle"><?=Language::getText('add')?></a></li> <li><a href="" class="flag" data-type="video" data-id="<?=$video->videoId?>"><?=Language::getText('flag')?></a></li> </ul> <!-- END Action Tabs --> <!-- BEGIN Tab Panes --> <div class="tab-content"> <!-- BEGIN About Tab --> <div class="tab-pane" id="about"> <h4><?=Language::getText('about')?></h4> <div class="panel panel-default"> <div class="panel-body row"> <div class="col-xs-12 col-sm-10 media"> <div class="media-left"> <?php $avatar = $this->getService('User')->getAvatarUrl($member); ?> <img class="media-object" width="65" height="65" src="<?=($avatar) ? $avatar : $this->options->themeUrl . '/images/avatar.gif'?>" alt="<?=$member->username?>" /> </div> <div class="media-body"> <p><strong><?=Language::getText('by')?>:</strong> <a href="<?=BASE_URL?>/members/<?=$member->username?>/" title="<?=$member->username?>"><?=$member->username?></a></p> <p><strong><?=Language::getText('date_uploaded')?>:</strong> <?=date('m/d/Y', strtotime($video->dateCreated))?></p> <p><strong><?=Language::getText('tags')?>:</strong> <?php foreach ($video->tags as $value): ?> <a href="<?=BASE_URL?>/search/?keyword=<?=$value?>" title="<?=$value?>"><?=$value?></a>Â Â <?php endforeach; ?> </p> <?php if (!empty($attachments)): ?> <p><strong><?=Language::getText('attachments')?>:</strong> <?php foreach ($attachments as $attachment): ?> <a class="attachment" href="<?php echo $this->getService('File')->getUrl($attachment); ?>" title="<?php echo htmlspecialchars($attachment->name); ?> (<?php echo \Functions::formatBytes($attachment->filesize, 0); ?>)" ><i class="glyphicon glyphicon-paperclip"></i> <?php echo htmlspecialchars($attachment->name); ?> (<?php echo \Functions::formatBytes($attachment->filesize, 0); ?>) </a> <?php endforeach; ?> </p> <?php endif; ?> </div> </div> <div class="col-xs-12 col-sm-2"> <a href="" class="btn btn-primary subscribe" title="<?=Language::getText($subscribe_text)?>" data-type="<?=$subscribe_text?>" data-user="<?=$video->userId?>"><?=Language::getText($subscribe_text)?></a> </div> <p class="col-xs-12"><?=$video->description?></p> </div> </div> </div> <!-- END About Tab --> <!-- BEGIN Share Tab --> <div class="tab-pane" id="share"> <h4><?=Language::getText('share')?></h4> <div class="panel panel-default"> <div class="panel-body row"> <div class="col-xs-4"> <!-- Share Widget Notes - Please replace <your_app_id> in the FaceBook share URL with your actual app id obtained from FaceBook's website. This widget will not work until that happens. - FaceBook, and Google + widgets require the video's URL to be publicly accessible, otherwise the widgets will not work. --> <!-- FACEBOOK BUTTON --> <meta property="og:url" content="<?=$this->getService('Video')->getUrl($video)?>/" /> <meta property="og:title" content="<?=$video->title?>" /> <meta property="og:description" content="<?=$video->description?>" /> <meta property="og:image" content="<?=$config->thumbUrl?>/<?=$video->filename?>.jpg" /> <meta property="og:type" content="video" /> <meta property="og:video" content="<?=$config->h264Url?>/<?=$video->filename?>.mp4"> <meta property="og:video:type" content="video/mp4"> <meta property="og:video:width" content="640"> <meta property="og:video:height" content="360"> <script>if (window.location.hash === '#facebook-share') {window.close();}</script> <a class="facebook" href="https://www.facebook.com/dialog/share?app_id=<your_app_id>&display=popup&href=<?=urlencode($this->getService('Video')->getUrl($video) . '/')?>&redirect_uri=<?=urlencode($this->getService('Video')->getUrl($video) . '/#facebook-share')?>" onClick="window.open(this.href, 'sharewindow','width=550,height=300');return false;">Share on Facebook</a> <!-- TWITTER BUTTON --> <a class="twitter" href="" onClick="window.open('https://twitter.com/share?url=<?=urlencode($this->getService('Video')->getUrl($video) . '/')?>&text=<?=urlencode(Functions::cutOff($video->description, 140))?>','sharewindow','width=650,height=400');return false;">Share on Twitter</a> <!-- Google +BUTTON --> <a class="google" href="https://plus.google.com/share?url=<?=urlencode($this->getService('Video')->getUrl($video) . '/')?>" onClick="javascript:window.open(this.href, 'sharewindow', 'height=600,width=600');return false;">Share</a> </div> <?php if ($video->disableEmbed == '0' && $video->gated == '0'): ?> <!-- EMBED CODE --> <div class="col-xs-8"> <p class="h4"><?=Language::getText('embed')?></p> <p><?=Language::getText('embed_text')?></p> <textarea class="form-control" rows="5" cols="58"><iframe src="<?=BASE_URL?>/embed/<?=$video->videoId?>/" width="480" height="360" frameborder="0" allowfullscreen></iframe></textarea> </div> <?php endif; ?> </div> </div> </div> <!-- END Share Tab --> <!-- BEGIN Add Tab --> <div class="tab-pane" id="add-to-playlist"> <h4><?=Language::getText('add_to')?></h4> <div class="panel panel-default"> <div class="panel-body"> <?php if ($loggedInUser): ?> <div class="test col-xs-12 col-sm-5"> <div class="scrollbar-outer playlist-container" > <ul> <?php $playlistService = $this->getService('Playlist'); ?> <li class="<?php echo $playlistService->checkListing($video, $favoritesList) ? 'added' : ''; ?>"> <i class="glyphicon glyphicon-ok-sign"></i> <i class="glyphicon glyphicon-plus-sign"></i> <a data-playlist_id="<?=$favoritesList->playlistId?>" href="" data-video="<?php echo $video->videoId; ?>" ><?=Language::getText('favorites')?></a> </li> <li class="<?php echo $playlistService->checkListing($video, $watchLaterList) ? 'added' : ''; ?>"> <i class="glyphicon glyphicon-ok-sign"></i> <i class="glyphicon glyphicon-plus-sign"></i> <a data-playlist_id="<?=$watchLaterList->playlistId?>" href="" data-video="<?php echo $video->videoId; ?>" ><?=Language::getText('watch_later')?></a> </li> <?php if (count($userPlaylists) > 0): ?> <li><strong><?=Language::getText('playlists')?></strong></li> <?php foreach ($userPlaylists as $userPlaylist): ?> <li class="<?php echo $playlistService->checkListing($video, $userPlaylist) ? 'added' : ''; ?>"> <i class="glyphicon glyphicon-ok-sign"></i> <i class="glyphicon glyphicon-plus-sign"></i> <a data-playlist_id="<?=$userPlaylist->playlistId?>" href="" data-video="<?php echo $video->videoId; ?>" ><?=$userPlaylist->name?> (<?=count($userPlaylist->entries)?>)</a> </li> <?php endforeach; ?> <?php endif; ?> </ul> </div> </div> <div class="col-xs-12 col-sm-5 col-sm-offset-2"> <p class="h4"><?=Language::getText('create_new_playlist')?></p> <form> <div class="form-group"> <label class="control-label"><?=Language::getText('playlist_name')?>:</label> <input class="form-control" type="text" name="playlist_name" /> </div> <div class="form-group"> <label class="control-label"><?=Language::getText('visibility')?>:</label> <select class="form-control" name="playlist_visibility"> <option value="public"><?=Language::getText('public')?></option> <option value="private"><?=Language::getText('private')?></option> </select> </div> <input type="hidden" name="action" value="create" /> <input type="hidden" name="video_id" value="<?=$video->videoId?>" /> <input class="btn btn-primary" type="submit" value="<?=Language::getText('create_playlist_button')?>" /> </form> </div> <?php else: ?> <?=Language::getText('playlist_login', array('url' => BASE_URL . '/login/?redirect=' . urlencode($this->getService('Video')->getUrl($video))))?> <?php endif; ?> </div> </div> </div> <!-- END Add Tab --> </div> <!-- END Tab Panes --> <!-- BEGIN Comments Header --> <div class="row" id="comments-header"> <h4 class="col-xs-6"> <?=Language::getText('comments_header')?> <?=($video->commentsClosed) ? '' : ' (<span class="comment-total">' . $commentCount . '</span>)'?> </h4> <?php if (!$loggedInUser && $config->enableRegistrations): ?> <p class="col-xs-6 text-right"><?=Language::getText('comments_login_register', array('login_link' => BASE_URL . '/login/?redirect=' . urlencode($this->getService('Video')->getUrl($video)), 'register_link' => BASE_URL . '/register/'))?></p> <?php elseif (!$loggedInUser && !$config->enableRegistrations): ?> <p class="col-xs-6 text-right"><?=Language::getText('comments_login', array('login_link' => BASE_URL . '/login/?redirect=' . urlencode($this->getService('Video')->getUrl($video))))?></p> <?php endif; ?> </div> <!-- END Comments Header --> <!-- BEGIN Comments Container --> <div id="comments" class="panel panel-default"> <div class="panel-body"> <?php if ($video->commentsClosed): ?> <?=Language::getText('comments_closed')?> <?php else: ?> <?php if ($loggedInUser): ?> <!-- BEGIN Comments Form --> <div class="collapsed comment-form comment-form-main row"> <form action="" method="post"> <div class="col-xs-12 collapsed-show"> <textarea class="form-control" rows="2" cols="50" name="comments" placeholder="<?=Language::getText('comments_button')?>"></textarea> </div> <div class="col-xs-12 collapsed-hide"> <textarea class="form-control" rows="4" cols="50" name="comments" placeholder="<?=Language::getText('comments')?>"></textarea> </div> <div class="col-xs-6 col-sm-3 collapsed-hide"> <a class="cancel" href=""><?=Language::getText('cancel')?></a> </div> <div class="col-xs-6 col-sm-3 col-sm-offset-6 text-right collapsed-hide"> <input type="hidden" name="videoId" value="<?=$video->videoId?>" /> <input type="hidden" name="parentCommentId" value="" /> <input class="btn btn-primary" type="submit" name="button" value="<?=Language::getText('comments_button')?>" /> </div> </form> </div> <!-- END Comments Form --> <?php endif; ?> <!-- BEGIN Comments List --> <div class="comment-list"> <?php if ($commentCount > 0): ?> <?php foreach ($commentCardList as $commentCard): ?> <?php $commentIndentClass = getCommentIndentClass($commentCard->comment); ?> <div class="media comment <?=$commentIndentClass?>" data-comment="<?=$commentCard->comment->commentId?>"> <div class="media-left"> <img class="media-object" width="60" height="60" src="<?=($commentCard->avatar) ? $commentCard->avatar : $this->options->themeUrl . '/images/avatar.gif'?>" /> </div> <div class="media-body row"> <div class="col-xs-8"> <a href="<?=getUserProfileLink($commentCard->author)?>" class="comment-author"><?=$commentCard->author->username?></a> <span class="comment-date"><?=date('m/d/Y', strtotime($commentCard->comment->dateCreated))?></span> <?php if ($commentCard->comment->parentId != 0): ?> <span class="comment-reply"><?=Language::getText('reply_to')?> <a class="comment-parent-author" href="<?=getUserProfileLink($commentCard->parentAuthor)?>"><?=$commentCard->parentAuthor->username?></a> </span> <?php endif; ?> </div> <div class="col-xs-4 comment-action text-right"> <a class="reply" href=""><?=Language::getText('reply')?></a> <a class="flag" data-type="comment" data-id="<?=$commentCard->comment->commentId?>" href=""><?=Language::getText('report_abuse')?></a> </div> <p class="col-xs-12 comment-text"><?=nl2br($commentCard->comment->comments)?></p> </div> </div> <?php endforeach; ?> <?php else: ?> <p class="no-comments"><?=Language::getText('no_comments')?></p> <?php endif; ?> </div> <!-- END Comments List --> <?php endif; ?> </div> <?php if ($commentCount > 5): ?> <div class="panel-footer text-center load-more"> <button class="btn btn-primary load-more-btn" data-total="<?php echo $commentCount; ?>" data-video="<?php echo $video->videoId; ?>" data-loading-text="<?=Language::getText('loading')?>" ><?=Language::getText('load_more')?></button> </div> <?php endif; ?> </div> <!-- END Comments Container --> </div> <!-- END PLAY LEFT --> <!-- BEGIN PLAY RIGHT --> <div class="col-md-4 play-right"> <?php $this->Block ('ad300.phtml'); ?> <!-- BEGIN RELATED VIDEOS --> <div class="related-videos"> <h4><?=Language::getText('suggestions_header')?></h4> <?php if (count($relatedVideos) > 0): ?> <div class="video-list"> <?php $videoService = $this->getService('Video'); ?> <?php foreach ($relatedVideos as $relatedVideo): ?> <div class="video video-medium media"> <div class="media-left thumbnail"> <a href="<?=$videoService->getUrl($relatedVideo)?>/" title="<?=$relatedVideo->title?>"> <span class="glyphicon glyphicon-play"></span> <img class="media-object" width="140" height="78" src="<?=$config->thumbUrl?>/<?=$relatedVideo->filename?>.jpg" /> </a> </div> <div class="media-body"> <p class="media-heading"><a href="<?=$videoService->getUrl($relatedVideo)?>/" title="<?=$relatedVideo->title?>"><?=$relatedVideo->title?></a></p> <div class="small"> <?=Language::getText('by')?>: <a href="<?=BASE_URL?>/members/<?=$relatedVideo->username?>/" title="<?=$relatedVideo->username?>"><?=$relatedVideo->username?></a> <span class="duration"><span class="glyphicon glyphicon-time"></span> <?=$relatedVideo->duration?></span> </div> </div> </div> <?php endforeach; ?> </div> <?php else: ?> <strong><?=Language::getText('no_suggestions')?></strong> <?php endif; ?> </div> <!-- END RELATED VIDEOS --> </div> <!-- END PLAY RIGHT --> </div> I'm sure I got something wrong in there. I found some course on udemy to help with my lack of knowledge. But again I really appreciate the help. Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573553 Share on other sites More sharing options...
requinix Posted January 15, 2020 Share Posted January 15, 2020 There's only one single video there. 22 hours ago, inferno-prime said: but its not one single video What do you mean? Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573554 Share on other sites More sharing options...
inferno-prime Posted January 15, 2020 Author Share Posted January 15, 2020 This is a video sharing script so all the videos play on videojs player. Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573555 Share on other sites More sharing options...
requinix Posted January 15, 2020 Share Posted January 15, 2020 There is only one video on the page, yes or no? Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573556 Share on other sites More sharing options...
inferno-prime Posted January 15, 2020 Author Share Posted January 15, 2020 yes Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573557 Share on other sites More sharing options...
requinix Posted January 15, 2020 Share Posted January 15, 2020 Then there is only one video. The error is something else. Could it be that you need to pass the ID of the <video> on the page? Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573558 Share on other sites More sharing options...
inferno-prime Posted January 16, 2020 Author Share Posted January 16, 2020 I did some digging and I don't know if this is right or not but it seems that the url is dynamic for the video and changes depending on which video you are watching. Here is the line of code which I'm guessing is php : <source src="<?=$config->h264Url?>/<?=$video->filename?>.mp4" type="video/mp4" /> Since the video url changes I bet that's why videojs keeps saying the video is not defined. I did find the line thats giving the error from videojs : var player = video-js('myvideo');. So how do you specify a dynamic url to videojs ? Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573569 Share on other sites More sharing options...
requinix Posted January 16, 2020 Share Posted January 16, 2020 Look at the new HTML you're trying to insert. Does it say anything about video URLs? Check what I said again: 21 hours ago, requinix said: Could it be that you need to pass the ID of the <video> on the page? Â Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573570 Share on other sites More sharing options...
inferno-prime Posted January 16, 2020 Author Share Posted January 16, 2020 Alright I will do some more digging but till then how would you suggest I do that. Quote Link to comment https://forums.phpfreaks.com/topic/309821-javascript-in-phtml/#findComment-1573573 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.