duanjia4969 2018-09-08 15:04
浏览 65

在多层(3层架构模式)中放置带有缓存文件的文件夹的位置?

Where to put folder in cached files in multitier architecture?Also i have a class playlistBL.class.php which deals with getting videos from youtube in xml format and then sending them to videos.php page as an array so videos php page can loop through it and show videos,is it correct to put that playlistBL.class.php in modules_BL/playlist/playlistBl.class.php or is it better to put it in separate folder videos??

videos.php //file location is in root

    <?php
    if(session_id() === "")
    {
        session_start();
    }
    require_once "modules_BL/user/loginBL.class.php";
    require_once "modules_BL/album/albumBL.class.php";
    include_once "modules_BL/playlist/playlistBL.class.php";

?>
<!DOCTYPE html>
<html>
    <head>
    <meta charset="UTF-8">
        <title>View Our Videos</title>
    <link href="https://fonts.googleapis.com/css?family=Metal+Mania" rel="stylesheet">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
    <link href="css/style.css" type="text/css" rel="stylesheet">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="js/hide.js"></script>
    </head>
    <body>
        <div id="wrapper">
            <header id="header">
                <a href="index.html">
                    <img src="images/prisoner_logo.jpg" alt="prisoner_logo.jpg">
                </a>    
            </header> <!-- end of #header -->

            <nav id="nav">
                <ul>
                    <li><a href="index.html">Prison</a></li>
                    <li><a href="biography.html">Biography</a></li>
                    <li><a href="discography.html">Discography</a></li>
                    <li><a href="merchandize.php">Merchandize</a></li>
                    <li><a href="contact.html">Contact</a></li>
                </ul>
            </nav> <!-- end of #navigation -->

            <main id="main" class="view">
                <section id="bckToOpt">
                    <div>
                        <button type="submit" name="bckToOpt"><a href="home.php" class="btnStyle">Back to Options</a></button>
                    </div>
                </section>

            <?php
                $loginBL = new LoginBL();
                $loginBL->CheckUserSessionData();
                $user = unserialize($_SESSION["user"]);

                if($user->GetID_ROLA() == USER_ROLE_KORISNIK)
                {
                    $playlist = new PlaylistBL();
                    $contents = $playlist->WatchVideos();

                    foreach ($contents as $content)
                    {
                        echo $content;
                    }
                }


            ?>
            <section class="bckToTop">
                <div>
                    <button type="submit" name="bckToTop"><a href="#bckToOpt" class="btnStyle">Back to Top</a></button>
                </div>
            </section>

            </main> <!-- end of #main -->

            <footer id="footer">
                <p>Offical Prisoner WebSite &copy; 2018</p>
            </footer>
        </div> <!-- end of #wrapper -->
    </body>
</html>

playlistBl.class.php //file location is in modules_BL/playlist/

<?php

class PlaylistBL
{
    public function WatchVideos()
    {
            $feed = "https://www.youtube.com/feeds/videos.xml?playlist_id=PLDuBTz2Byh9MaprT9RPIzkGWsUJCYrMKe";
            $xml = simplexml_load_file($feed);
            $entries = $xml->entry;

            foreach($entries as $entry)
            {
                $published = $entry->published;
                $shortDate = date("d.m.Y", strtotime($published));

                $title = $entry->title;
                $id = $entry->id;
                $id = str_replace("yt:video:", "", $id);
                $author = $entry->author->name;
                $uri = $entry->author->uri;

                $content = sprintf("<article class='iframeContainer'>
                                        <h1><a class='btnStyle' href='%s'>%s</a></h1>
                                        <iframe src='%s%s' class='iframeSize' allowfullscreen>
                                        </iframe>
                                        <br>
                                        <small>Published: %s &nbsp; By: %s</small>
                                    </article>
                                    <hr>
                                    ",
                                        $uri,
                                        $title,
                                        "http://www.youtube.com/embed/",
                                        $id,
                                        $shortDate,
                                        $author
                                    );
                $contentArray[] = $content;
            }

            return $contentArray;
    }
}

?>

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 #MATLAB仿真#车辆换道路径规划
    • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
    • ¥15 数据可视化Python
    • ¥15 要给毕业设计添加扫码登录的功能!!有偿
    • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
    • ¥15 微信公众号自制会员卡没有收款渠道啊
    • ¥100 Jenkins自动化部署—悬赏100元
    • ¥15 关于#python#的问题:求帮写python代码
    • ¥20 MATLAB画图图形出现上下震荡的线条
    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘