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 求差集那个函数有问题,有无佬可以解决
    • ¥15 【提问】基于Invest的水源涵养
    • ¥20 微信网友居然可以通过vx号找到我绑的手机号
    • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
    • ¥15 解riccati方程组
    • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
    • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
    • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
    • ¥50 树莓派安卓APK系统签名
    • ¥65 汇编语言除法溢出问题