Membuat news berjalan dengan mengambil isi database

Dalam pembuatan website, terutama website yang lebih menonjolkan sebuah informasi atau berita, ingin sekali dalam penyajian beritanya dibuat lebih menarik. Nah, kali ini penulis akan coba membahas untuk membuat sebuah news dengan mengambil isi news tersebut dari database, yang nantinya akan kita tampilkan dengan bentuk berjalan dari bawah ke atas dengan perintah <marquee>.

Untuk memulainya, tentu saja di database anda sudah tersedia tabel khusus untuk artikel/news itu sendiri.

Berikut adalah coding dengan menggunakan PHP :
    <div id="news_update">
        <h1>News Update</h1>
        <marquee direction="up" onmouseover="this.stop()" width="100%" scrollamount="2" onmouseout="this.start()" height="100">
        <?php
            $sql = mysql_query("SELECT menu_name, page_file, resume_folder, a.page_id, content_time, content, page_title, summary
                            FROM cpage a
                            INNER JOIN cmenu b ON b.cmenu_id=a.cmenu_id
                            WHERE a.fl_show=1 AND resume_folder='/news/' ORDER BY content_time ASC LIMIT 0, 3");
           
            while ($row = mysql_fetch_array($sql))
            {
                $content_time = date("F d, Y", strtotime($row['content_time']));
                $page_title = $row['page_title'];
                $page_file = $row['page_file'];
                $summary = $row['summary'];
                $page_file = $row['page_file'];
        ?>
    <ul>   
        <li>
              <h2><?php echo $content_time; ?></h2>
                <h3><a href="/news/<?php echo $page_file; ?>"><?php echo $page_title; ?></a></h3>
            <?php echo $summary; ?>
        </li><br />
    </ul>
        <?php
            }
        ?>
    </marquee>
    </div><!--end of news_update-->


Penjelasan :

<marquee direction="up" onmouseover="this.stop()" width="100%" scrollamount="2" onmouseout="this.start()" height="100"> --> adalah bahasa html yang dapat membuat teks berjalan. Bisa dari kanan ke kiri atau sebaliknya, dan dari atas ke bawah atau sebaliknya. Dalam pembahasan ini, penulis membuat artikel yang berjalan dari bawah ke atas. Untuk melihat contohnya : www.prowebpro.com/pic/banir/membuat_news_berjalan_dengan_mengambil_isi_database.html

Share |

Portfolio

www.wearnespc.comwww.solper.comwww.autojaya.comwww.intisolar.comsmartprint.co.idwww.ottopharm.comoliser.co.idAnd More ....

Livechat

  • LiveZilla Live Help

  • Aris G

  • Agus

  • Fazri

  • Rudi S

  • Bincar H

Address

PT. Proweb Indonesia
Perkantoran Duta Merlin No F4
Jl. Gadjah Mada 3-5
Jakarta Pusat

 

Phone : 021 - 2636 3170
     
Mobile : 0856 - 922 622 03
    0812 - 806 2772
    0816 - 180 8005
     
Fax : 021 - 633 5765
     
Web : www.proweb.co.id