CMS

WEB DEVELOPMENT

Kami mengembangkan aplikasi CMS.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Membuat Module Sendiri

Buat sebuah file php dengan nama mod_populer.php dalam direktori mod_populer dan tuliskan script dibawah ini didalam file tersebut.
<?/*ini untuk menyembunyikan akses langsung ke file ini melalui browser*/defined( '_JEXEC' ) or die( 'Restricted access' );/*mengambil data base conten*/$db =& JFactory::getDBO();$query = 'SELECT a.hits, a.id, a.sectionid, a.title, a.created, u.name'. ' FROM #__content AS a'. ' LEFT JOIN #__users AS u ON u.id=a.created_by'. ' WHERE a.state <> -2'. ' ORDER BY hits DESC';/*menentukan limit atau jummlah yang akan di tampilkan*/$db->setQuery( $query, 0, 5 );$rows = $db->loadObjectList();?><!-- menampilkan list artikel - artikel dalam bentuk list --><table class="adminlist"><?phpforeach ($rows as $row){    $link = 'index.php?option=com_content&amp;task=view=article&id='. $row->id;    ?>    <tr>        <td>            <ul>            <li><a href="<?php echo $link; ?>"><?php echo htmlspecialchars($row->title, ENT_QUOTES, 'UTF-8');?></a>            </li>            </ul>        </td>    </tr>    <?php}?></table>
Berikut Penjelasan script di atas 
defined( '_JEXEC' ) or die( 'Restricted access' );
Ini merupakan sintak untuk menghindari akses dari browser
$db =& JFactory::getDBO();$query = 'SELECT a.hits, a.id, a.sectionid, a.title, a.created, u.name'. ' FROM #__content AS a'. ' LEFT JOIN #__users AS u ON u.id=a.created_by'. ' WHERE a.state <> -2'. ' ORDER BY hits DESC';
ini merupakan Sintak untuk memilih database conten pada database joomla. 
$db->setQuery( $query, 0, 5 );$rows = $db->loadObjectList();
Disini kita menentukan limit atau jumlah list yang akan ditampilkan. Angka 5 diatas saya buat agar di list ditampilkan lima artikel. Bisa diganti sesuai keinginan Anda.
<?phpforeach ($rows as $row){$link = 'index.php?option=com_content&amp;task=view=article&id='. $row->id;?><tr><td><ul><li><a href="<?php echo $link; ?>"><?php echo htmlspecialchars($row->title, ENT_QUOTES, 'UTF-8');?></a></li></ul></td></tr><?php}?>
Ini untuk menampilikan list Judul artikel terpopuler. Kita lihat nilai variabel $link adalah
$link=’ index.php?option=com_content&amp;task=view=article&id='. $row->id; 

ini membuat link ke artikel yang ditampilkan. Dan pada
 <a href="<?php echo $link; ?>"><?php echo htmlspecialchars($row->title, ENT_QUOTES, 'UTF-8');?></a> 
difungsikan untuk menampilkan judul – judul artikel yang akan ditampilkan. 
Nah sekarang kita buat pula file Instalasinya buat sebuah file dengan format XML masih dalam folder mod_populer. Lalu namai file tersebut dengan sebutan module_populer.xml
Dan tuliskan Sintak dibawah dalam file tersebut

<?xml version="1.0" encoding="utf-8"?><install type="module">    <name>Artikel Populer</name>    <author>Rojiyan Ar</author>    <creationDate>Agustus 2010</creationDate>    <copyright>Copyright (C) 2010 call-69.blogspot.com</copyright>    <license>tak punya lisensi he he he</license>    <authorEmail>arx131@gmail.com</authorEmail>    <authorUrl>call-69.blogspot.com</authorUrl>    <version>hana versi</version>    <description>Peu Galak kah?</description>    <files>        <filename module="mod_populer">mod_populer.php</filename>    </files>    <params>        <param name="cache" type="list" default="0" label="Caching" description="Select whether to cache the content of this module">            <option value="0">Tidak pernah</option>          </param>    </params></install>
Penjelasan.
<?xml version="1.0" encoding="utf-8"?> menunjukkan file XML


Share:

Good News

Powered by Blogger.