Bài đăng

Module Hello World 3

Introduction This tutorial aims to further build on the helloworld module we expanded in part three. You will learn how to use parameters to fine tune some of the information that is displayed. We will also look at looking at ways to 'skin' your module output.. Requirements You need for this tutorial: • Joomla 1.0 or greater Let's Roll You will recall that we finished part 2 with your module displaying a list of the most hit times. Unfortunately we were stuck with displaying only 5 items and could not change the ordering. What we will do in this example is learn how to add parameters to the module so that you can vary these conditions. Setting up the Parameters We need to revisit the XML file that we created in part 1. We define all our parameters in this file. First let's consider what variables we want to allow the user to change: 1. We want a variable to change the number of items displayed. 2. We want to be able to select the ordering of the items from a list....

Module Hello World 2

Introduction This tutorial aims to build on the helloworld module started in part one. You will learn how to retrieve information from the database and how to present this data is a table using patTemplate. Requirements You need for this tutorial: • Joomla 1.0 or greater Let's Roll You will recall that we finished part 1 with your module displaying a message and the current time. This is all very interesting but far more interesting is the information held in the tables of the Joomla database. What we will do in this example is develop a type of Current News module. The Presentation Layer Let's start with the output of the module. Because the code (or the logic) of the module is now separated from the presentation layer (the HTML), it gives the graphic designer an opportunity to design the output separate from the module. The module code designer has informed us that a list of content items will be provided to the template. The content item data will include the item id, t...

Module Hello World 1

Introduction This tutorial aims to give you a grounding in the basic concepts for writing Joomla! modules. It will develop a very simple Hello World module and then extend it using patTemplate, a powerful set of functions that help separate the presentation (HTML) from the application logic (PHP) using templates. Full documentation for patTemplate can be found on their website. Requirements You need for this tutorial: • Joomla! 1.0 or greater Let's Roll We will be creating two files in this tutorial in the folder called /modules/. Let's look at the files we need. mod_helloworld.php This file is the actually engine for the module. mod_helloword.xml This file is the XML setup file for the module. It defines the information required for the module to be installed. Installing the Basic Module You cannot create a module from scratch from the Joomla! Administrator, so we have to make some basic files first and then install them as a module. Let's make the actual module first. Sav...

Writing a Simple Module in joomla

As an example, we will create a module that will list any content items that have keywords that match those in the one that is being viewed. Where do we start? First decide on a module name. We are going to call this a Related Items module. The module name will be mod_relcontent. All module names must be prefixed with "mod_" and the "relcontent" just stands for "related content" in our case. In a scratch area on your file system, create a directory called mod_relcontent. In this directory, just create two empty files for the moment; one called mod_relcontent.php and the other called mod_relcontent.xml. Let's build the XML file first. This is a definition file that tells the Joomla installer, most importantly, what files are required and other metadata about the module. [Please ignore this dummy sentence which is intended to deflect the glossary bot from incorrectly autocapitalising the word "{glossarbot=disable}author" in the XML sample belo...

bảng quảng cáo hay một bảng thông tin tự động trượt đến một vị trí được chỉ định

Thỉnh thoảng có lúc bạn muốn có một bảng quảng cáo hay một bảng thông tin tự động trượt đến một vị trí được chỉ định khi visitor scroll trang web lên-xuống. Đây là cách rất tốt để ưu ái quảng cáo của những đối tượng sẵn sàng chí trả nhiều tiền. Cách làm như sau: Mở file index.php của template bạn đang sử dụng bằng bất kỳ trình soạn thảo văn bản nào và... 1. Ngay trước thẻ &lt/head> thêm đoạn code sau: Code: &lt!-- Floating Object container \--> &ltscript type="text/javascript"> var isDOM, floaterObj; var isNS, pageHeight; var paddingX, paddingY, scrollTop, currentY, targetY, A, B, C, D; var slideTime; /* h - height in pixel of the floating object x - padding in pixel from the left side of floating object to the left side of browser window y - padding in pixel from the top side of floating object to the top side of browser window z - slide time in milisecond */ function setUp(h, x, y, z) { if (document.getElementById) { isDOM = true; floaterObj = ...

modify mod_latestnew & mod_mostread to show the image

&lt?php // no direct access defined( '_VALID_MOS' ) or die( 'Restricted access' ); global $mosConfig_offset, $mosConfig_live_site, $mainframe; $type = intval( $params->get( 'type', 1 ) ); $count = intval( $params->get( 'count', 5 ) ); $catid = trim( $params->get( 'catid' ) ); $secid = trim( $params->get( 'secid' ) ); $show_front = $params->get( 'show_front', 1 ); $now = date( 'Y-m-d H:i:s', time() ); $access = !$mainframe->getCfg( 'shownoauth' ); $nullDate = $database->getNullDate(); // select between Content Items, Static Content or both switch ( $type ) { case 2: //Static Content only $query = "SELECT distinct a.id, a.title, a.images" . "\n FROM #__content AS a" . "\n WHERE ( a.state = 1 AND a.sectionid = 0 )" . "\n AND ( a.publish_up = '$nullDate' OR a.publish_up &lt= '$now...

Cross-window scripting

var newwindow = ''; function popitup(url) { if (!newwindow.closed && newwindow.location) { newwindow.location.href = url; } else { newwindow=window.open(url,'name','height=200,width=150'); if (!newwindow.opener) newwindow.opener = self; } if (window.focus) {newwindow.focus()} return false; }