Main Menu arrow Forum
Diễn đàn
Welcome, Guest
No account yet?. Please Register.    Lost Password?
Re:Chuẩn bị viết mosExtranews cho Joomla 1.5 (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:Chuẩn bị viết mosExtranews cho Joomla 1.5
#403
support (Moderator)
Mạng xã hội học tập
Moderator
Posts: 155
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Hà thành Birthdate: 1977-07-04
Chuẩn bị viết mosExtranews cho Joomla 1.5 2 Months, 2 Weeks ago Karma: 0  
Tham khảo:
cách viết extension: http://xahoihoctap.net/component/op...,210/catid,9/lang,en/#210

các câu lệnh PHP hay sử dụng: http://xahoihoctap.net/component/op...,108/catid,9/lang,en/#108

Code:

#
# Table structure for table `#__categories`
#

CREATE TABLE `#__categories` (
`id` int(11) NOT NULL auto_increment,
`parent_id` int(11) NOT NULL default 0,
`title` varchar(255) NOT NULL default '',
`name` varchar(255) NOT NULL default '',
`alias` varchar(255) NOT NULL default '',
`image` varchar(255) NOT NULL default '',
`section` varchar(50) NOT NULL default '',
`image_position` varchar(30) NOT NULL default '',
`description` text NOT NULL,
`published` tinyint(1) NOT NULL default '0',
`checked_out` int(11) unsigned NOT NULL default '0',
`checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
`editor` varchar(50) default NULL,
`ordering` int(11) NOT NULL default '0',
`access` tinyint(3) unsigned NOT NULL default '0',
`count` int(11) NOT NULL default '0',
`params` text NOT NULL,
PRIMARY KEY (`id`),
KEY `cat_idx` (`section`,`published`,`access`),
KEY `idx_access` (`access`),
KEY `idx_checkout` (`checked_out`)
) TYPE=MyISAM CHARACTER SET `utf8`;

# --------------------------------------------------------

#
# Table structure for table `#__content`
#

CREATE TABLE `#__content` (
`id` int(11) unsigned NOT NULL auto_increment,
`title` varchar(255) NOT NULL default '',
`alias` varchar(255) NOT NULL default '',
`title_alias` varchar(255) NOT NULL default '',
`introtext` mediumtext NOT NULL,
`fulltext` mediumtext NOT NULL,
`state` tinyint(3) NOT NULL default '0',
`sectionid` int(11) unsigned NOT NULL default '0',
`mask` int(11) unsigned NOT NULL default '0',
`catid` int(11) unsigned NOT NULL default '0',
`created` datetime NOT NULL default '0000-00-00 00:00:00',
`created_by` int(11) unsigned NOT NULL default '0',
`created_by_alias` varchar(255) NOT NULL default '',
`modified` datetime NOT NULL default '0000-00-00 00:00:00',
`modified_by` int(11) unsigned NOT NULL default '0',
`checked_out` int(11) unsigned NOT NULL default '0',
`checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
`publish_up` datetime NOT NULL default '0000-00-00 00:00:00',
`publish_down` datetime NOT NULL default '0000-00-00 00:00:00',
`images` text NOT NULL,
`urls` text NOT NULL,
`attribs` text NOT NULL,
`version` int(11) unsigned NOT NULL default '1',
`parentid` int(11) unsigned NOT NULL default '0',
`ordering` int(11) NOT NULL default '0',
`metakey` text NOT NULL,
`metadesc` text NOT NULL,
`access` int(11) unsigned NOT NULL default '0',
`hits` int(11) unsigned NOT NULL default '0',
`metadata` TEXT NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
KEY `idx_section` (`sectionid`),
KEY `idx_access` (`access`),
KEY `idx_checkout` (`checked_out`),
KEY `idx_state` (`state`),
KEY `idx_catid` (`catid`),
KEY `idx_createdby` (`created_by`)
) TYPE=MyISAM CHARACTER SET `utf8`;

# --------------------------------------------------------

#
# Table structure for table `#__sections`
#

CREATE TABLE `#__sections` (
`id` int(11) NOT NULL auto_increment,
`title` varchar(255) NOT NULL default '',
`name` varchar(255) NOT NULL default '',
`alias` varchar(255) NOT NULL default '',
`image` TEXT NOT NULL default '',
`scope` varchar(50) NOT NULL default '',
`image_position` varchar(30) NOT NULL default '',
`description` text NOT NULL,
`published` tinyint(1) NOT NULL default '0',
`checked_out` int(11) unsigned NOT NULL default '0',
`checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
`ordering` int(11) NOT NULL default '0',
`access` tinyint(3) unsigned NOT NULL default '0',
`count` int(11) NOT NULL default '0',
`params` text NOT NULL,
PRIMARY KEY (`id`),
KEY `idx_scope` (`scope`)
) TYPE=MyISAM CHARACTER SET `utf8`;

# --------------------------------------------------------



Bảng cấu trúc của Joomla:
File Attachment:
Please login to download the file!
File Size: 38905


Xem thêm: http://xahoihoctap.net/component/op...,210/catid,9/lang,en/#295

Đặt gạch trước rồi nghiên cứu viết dần.
 
Report to moderator   Logged Logged  
 
Nhóm hỗ trợ - Supporting Group
  The administrator has disabled public write access.
#421
support (Moderator)
Mạng xã hội học tập
Moderator
Posts: 155
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Hà thành Birthdate: 1977-07-04
Re:Chuẩn bị viết mosExtranews cho Joomla 1.5 2 Months, 1 Week ago Karma: 0  
Tham khảo mã Tooltip khá hay: http://www.walterzorn.com/tooltip/tooltip_e.htm

Đang viết plugin_extranews cho Joomla 1.5, demo tại:
http://xahoihoctap.net/webs/joomla1...-nghiem-tieng-viet-1.html

Khi chú: Khi sử dụng related news item, chúng sẽ sử dụng keywords của mục metada inofrmation. Và ta gọi chúng là metakey bạn có thể nhập nhiều metakey phân tách nhau bằng dấu phẩy:
Ví dụ:
Code:

tin hoc, kinh te, viet nam
sẽ bao gồm 3 từ khóa là tin hoc, kinh teviet nam.

Sử dụng mootools.js: gọi script sau đây sau gọi script mootools.js.
Code:

window.addEvent('domready', function(){
var thetip = new Tips($$('.mytooltip'), {
initialize:function(){
this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 500, wait: false}).set(0);
},
onShow: function(toolTip) {
this.fx.start(1);
},
onHide: function(toolTip) {
this.fx.start(0);
}
});
});


Sau khi đã add xong các script trên, bạn cần bổ sung class và title cho 1 link bất kì hoặc hình ảnh bạn muốn hiện tooltip.

Để hiển thị tooltip, bạn cần chèn thêm class=mytooltiptitle=”Big Title :: the description” vào các liên kết hoặc hình ảnh.

Ví dụ sau là liên kết với class và title:

<a href=”www.yourweb.com/page.html” class=”mytooltip” title=”Tieeu đề :: phần mô tả”>

Bước tiếp theo là thay đổi hiển thị của tooltip. Bạn sẽ làm thế với ngôn ngữ CSS. Bạn cần bổ sung nội dung sau vào mã nguồn CSS đang sử dụng.

Code:


.tool-tip {
float:left;
color: #369;
width: 265px;
z-index: 13000;
}

.tool-title {
font-weight: bold;
font-size: 13px;
margin: 0;
color: #FFF;
padding: 8px 8px 4px;
background: url(/images/tips.png) repeat;
border-bottom: 1px solid #FFF;
}

.tool-text {
font-size: 11px;
padding: 4px 8px 8px;
background: url(/images/tips.png) repeat;
}

.custom-tip {
color: #000;
width: 130px;
z-index: 13000;
}

.custom-title {
font-weight: bold;
font-size: 11px;
margin: 0;
color: #3E4F14;
padding: 8px 8px 4px;
background: #C3DF7D;
border-bottom: 1px solid #B5CF74;
}

.custom-text {
font-size: 11px;
padding: 4px 8px 8px;
background: #CFDFA7;
}



http://designerfied.com/how-to-add-...ooltips-to-your-site.html
 
Report to moderator   Logged Logged  
 
Nhóm hỗ trợ - Supporting Group
  The administrator has disabled public write access.
#422
support (Moderator)
Mạng xã hội học tập
Moderator
Posts: 155
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Hà thành Birthdate: 1977-07-04
Re:Chuẩn bị viết mosExtranews cho Joomla 1.5 2 Months, 1 Week ago Karma: 0  
Demo : http://xahoihoctap.net/component/op...tid,9/id,425/lang,en/#422

Đặc điểm chính:
Tooltip:
  • Bật/tắt hiển thị tooltip
  • Điều chỉnh độ rộng, màu sắc khung và văn bản.
  • Hiển thi hình ảnh sized
  • Thay đổi số lượng ký tự hiển thị tiêu đề và phần nội dung tooltip.
  • Lựa chọn script của Overlib hoặc mootools


Content:
  • Hiển thị Tooltip đối với tiêu đề và nội dung của các bài viết liên quan, cũ và mới hơn tin hiện tại.
  • Cho phép tắt (đisable) plugin này đối với từng cat hoặc sec.
  • Cho phép disable đối với article nhất định bằng từ khóa - không nên sử dụng chức năng này
    Code:

    {extranews:off}


Ngày 26-4-2008:
- Đã cập nhật nội dung đúng yêu cầu. Hiển thị tin mới hơn là tin gần nhất với tin hiện tại.
- Thêm các link Previous Page và Next Page, hoạt động đúng.

Ngày 28-04-2008:
-Đã gần hoàn chỉnh Plugin:
Demo mootools: http://kulkul.xahoihoctap.net/the-n...ac-van-de-ve-bao-mat.html
Demo Dhtml: http://xahoihoctap.net/webs/joomla1...-nghiem-tieng-viet-1.html


Tham khảo thêm về mootools:
- http://demos.mootools.net/Tips
- http://cwiki.apache.org/WICKET/addi...eld-prompts-or-hints.html
 
Report to moderator   Logged Logged  
 
Nhóm hỗ trợ - Supporting Group
  The administrator has disabled public write access.
#424
support (Moderator)
Mạng xã hội học tập
Moderator
Posts: 155
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Hà thành Birthdate: 1977-07-04
Re:Chuẩn bị viết mosExtranews cho Joomla 1.5 2 Months, 1 Week ago Karma: 0  
Đã tìm được code cắt xâu ký tự tiếng Việt utf-8 sử dụng cho plugin_extranews và template JA Teline II Joomla 1.5.x.

Code:

function utf8_substr($str,$from,$len){
# utf8 substr
# www.yeap.lv
return preg_replace('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$from.'}'.
'((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$len.'}).*#s',
'$1',$str);
}

function utf8_strlen($str) {
$count = 0;
for ($i = 0; $i < strlen($str); ++$i) {
if ((ord($str[$i]) & 0xC0) != 0x80) {
++$count;
}
}
return $count;
}
//Hàm trả về số kí tự $charnum trong xâu ký tự $text_
//Hàm này nằm trong cùng Class với 2 hàm utf8_strlen và utf8_substr
function chars($text_, $charnum){
$text_ = trim($text_);
if(($charnum >0) && ($this->utf8_strlen($text_) > $charnum))
return $this->utf8_substr($text_,0,$charnum)."&hellip;";
else return $text_;
}


Update 20089-05-07: Sử dụng lớp JString để thay thế
 
Report to moderator   Logged Logged  
 
Nhóm hỗ trợ - Supporting Group
  The administrator has disabled public write access.
#425
support (Moderator)
Mạng xã hội học tập
Moderator
Posts: 155
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Hà thành Birthdate: 1977-07-04
Re:Chuẩn bị viết mosExtranews cho Joomla 1.5 2 Months, 1 Week ago Karma: 0  
Final Version 2.0.0:

http://luyenkim.net/home9/component...,66/id,1970/lang,en/#1970

Todo list
  • Sử dụng cách hiển thị thumb giống như Phoca Gallery khi xem Image list - Như vậy sẽ làm cho khung ảnh luôn được cố định + hiển thị văn bản theo số kí tự cố định sẽ làm cho thể hiện cân đối hơn.
 
Report to moderator   Logged Logged  
 
Nhóm hỗ trợ - Supporting Group
  The administrator has disabled public write access.
#431
support (Moderator)
Mạng xã hội học tập
Moderator
Posts: 155
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Hà thành Birthdate: 1977-07-04
Re:Chuẩn bị viết mosExtranews cho Joomla 1.5 2 Months ago Karma: 0  
Vấn đề thời gian - Offset time. Làm thế nào để biết được offset time thiết lập bởi Joomla 1.5.x.

Code:

//Lấy biến giá trị của biến $offset trong configuration.php
$config =& JFactory::getConfig();
$offset = $config->getValue('config.offset');

function mygetdate($date,$offset,$showdateformat){
//Hàm xử lý thời gian sử dụng cho plugin extranews
//Cộng thêm hoặc trừ thời gian (giờ) theo biến $offset
//$date - date time, $offset - time offset, $showdateformat - the date format
if($offset==0)return date("$showdateformat",strtotime($date));
$_date = new DateTime($date);
if(abs($offset) == 1)$offset_t = ($offset > 0)?'+1 hour':'-1 hour';
else $offset_t = ($offset > 0)?'+'.$offset.' hours':'-'.abs($offset).' hour';
$_date -> modify($offset_t);
return date("$showdateformat",strtotime($_date->format('Y-m-d H:i:s')));
}



Xem thêm về JConfig tại: http://forum.joomla.org/viewtopic.php?f=231&t=197515
Update 2008-05-07: Nên sử dụng Jdate thay thế.
 
Report to moderator   Logged Logged  
 
Nhóm hỗ trợ - Supporting Group
  The administrator has disabled public write access.
#434
support (Moderator)
Mạng xã hội học tập
Moderator
Posts: 155
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Hà thành Birthdate: 1977-07-04
Re:Chuẩn bị viết mosExtranews cho Joomla 1.5 2 Months ago Karma: 0  
Đãng chuẩn bị hoàn thiện bằng cách bổ sung CSS cho các class hiển thị text và bổ sung file ngôn ngữ nữa.

Đang vướng về cách tạo file ngôn ngữ, cài đặt và gọi biến ngôn ngữ.

Tham khảo: http://forum.joomla.org/viewtopic.php?f=478&t=233628
The naming is important. First, the language id ("en-GB", "pt-BR", etc.), then a dot, then "plg", then a underscore, then the type of plugin ("system", in our case), then another underscore, then the name of the plugin, then a dot, and finally the "ini" extension.

Đã tham khảo bài này: http://docs.joomla.org/How_to_create_a_search_plugin

Câu lệnh khai báo file ngôn ngữ:
Code:

<languages>
<language tag="en-GB">language/en-GB/en-GB.plg_content_extranews.ini</language>
</languages>

Sử dụng lệnh để gọi file language:
Code:

// Joomla's plugin-installer does not handle separate language files for
// backend and frontend if installing a plugin (kind of silly, as it works
// with components). Instead, it installs the language files always into the
// JPATH_ADMINISTRATOR/languages. Therefore we have to specify this path
// explicitely.
JPlugin::loadLanguage('plg_content_extranews', JPATH_ADMINISTRATOR);

Và file ngôn ngữ trên sẽ được thêm vào folder language/en-GB/.
 
Report to moderator   Logged Logged  
 
Nhóm hỗ trợ - Supporting Group
  The administrator has disabled public write access.
#437
support (Moderator)
Mạng xã hội học tập
Moderator
Posts: 155
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Hà thành Birthdate: 1977-07-04
Re:Chuẩn bị viết mosExtranews cho Joomla 1.5 2 Months ago Karma: 0  
Kế hoạch sắp tới:
+ Thể hiện ảnh thumb luôn luôn là size đã cho (ảnh được sized với khung đã cho).
 
Report to moderator   Logged Logged  
 
Nhóm hỗ trợ - Supporting Group
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop
Generated in 0.72822 Seconds