天生我才必有用

Joomla的Toolbar

Posted in PHP    作者:Ray    2007年九月14日

1.保存按钮:

  • mosMenuBar::save() ;
  • mosMenuBar::savenew();
  • mosMenuBar::saveedit();

2.返回按钮

  • mosMenuBar::back();

3.新增按钮

  • mosMenuBar::addNew();

4.编辑列表按钮

  • mosMenuBar:: editList();

5.回收按钮

  • mosMenuBar:: trash();
  • mosMenuBar::deleteList();

6.发布按钮

  • mosMenuBar::publish()
  • mosMenuBar::publishList();
  • mosMenuBar::makeDefault();
  • mosMenuBar::assign();

7.取消发布按钮

  • mosMenuBar::unpublish();
  • mosMenuBar::unpublishList();

8.归档和取消归档按钮

  • mosMenuBar::archieveList();
  • mosMenuBar::unarchieveList();

9.编辑Html按钮

  • mosMenuBar::editHtml();

10.编辑CSS按钮

  • mosMenuBar::editCss();

11.预览按钮

  • mosMenuBar::preview();

12.媒体管理按钮

  • mosMenuBar::media__manager();

13.套用按钮

  • mosMenuBar::apply();

14.取消按钮

  • mosMenuBar::cancel();

15.自定义按钮

  • 如果用户需使用自定的按钮,可以使用JToolBarHelper中的Custom成员方法

其中mosMenuBarJToolBarHelper的子类,JToolBarHelper定义在administrator\includes\toolbar.php中.

标签: ,

Joomla组件常见问题

Posted in PHP    作者:Ray    2007年九月14日
  1. 如何把自己的组件(Component)登入到Admin的菜单中

INSERT INTO jos_components (name, link, admin_menu_link, admin_menu_alt, ‘option’, admin_menu_img, params) VALUES (‘Restaurant Reviews’, ‘option=com_reviews’, ’option=com_reviews’, ‘Manage Reviews’, ‘com_reviews’,'js/ThemeOffice/component.png’, ”);

摘入于[Learning Joomla Extension Development]

Joomla组件常备函数

Posted in PHP    作者:Ray    2007年九月13日
  1. 如何获得Joomla框架的文档:
    • $document =&$mainframe->getDocument();
  2. 如何获取URL Request的参数
    • JRequest::getVar(‘task’);
    • JRequest::getVar(‘name’, ‘Joomla! 1.5.0′);
  3. 取得模版文件路径
    • JApplicationHelper::getPath(‘front_html’, ‘com_name’)
  4. 设定网页的Title
    • $document = &$mainframe->setPageTitle(“Example componenet”);

Joomla组件2(Joomla Component2)

Posted in PHP    作者:Ray    2007年九月13日

1.简单的输出内容

让我们接着Joomla组件1,继续来扩充我们的Joomla Helloworld组件。

打开helloworld.php文件,输入一下内容:

<?php
// no direct access
defined(‘_JEXEC’) or die(‘Access to this file is prohibited’);
echo ‘Hello World!’;
?>

再来连接一下 http://localhost/joomla/index.php?option=com_helloworld,这次我们可以看到页面上出现Hello world。如何我们终于比前面进了一大步。

同时第一行的代码也防止非法用户直接放我门的Helloworld.php文件,此时浏览器中只会显示Access to this file is prohibited。你可以连接http://localhost/joomla/components/com_helloworld/helloworld.php来测试一下效果。:)

如果为了Joomla 1.0 或者Mambo撰写扩展,请使用_VALID_MOS代替 _JEXEC来判断用户是否直接访问。

2.接收Request的Get参数

接收Get参数,可以使用JRequest::getVar办法,函数经常使用两种格式:

  • $task = JRequest::getVar(“task”);

这个例子用来获取URL task参数的值,如果无task的参数,函数会返回null。

  • $name = JRequest::getVar(“name” , “Joomla test”);

这个例子用来获取URL name参数的值,如果无name的参数,函数和上个例子中不同,它会使用Joomla test作为默认值来代替null作为函数的返回值。

<?php
// no direct access
defined(‘_JEXEC’) or die(‘Access to this file is prohibited’);
// load the HTML View class
require_once (JApplicationHelper :: getPath(‘front_html’, com_helloworld’));
$task = JRequest::getVar(‘task’);
$name = JRequest::getVar(‘name’, ‘Joomla! 1.5.0′);
switch ($task) {
case ‘show’:
default:
hello_HTML::show($name);
break;
}
?>

Joomla的书籍

Posted in PHP    作者:Ray    2007年九月13日

关于Joomla的书籍还不是太多。我主要在看这几本:

  • Packt Publishing – Building Websites With Joomla Jan (2006)

这本书可能属于Joomla的权威著作,如果使用Joomla 1.0的版本,绝对需要去读一下,不过Joomla 1.5很多特性非常吸引人,如支持UTF-8,彻底解决了中文的问题。不过现在Joomla 1.5 还是RC2,所以为求稳定还是可以通过此书来架构Joomla 1.0的网站。

  • Packt Publishing – Building Websites with Joomla 1.5 Beta1 (2007)

这本书是上本书的更新版本,不过正式版本还没出版,属于抢鲜版本。

不要以为是对1.0版本内容的部分更新,作者已经完完全全重写了这本书。从书名就可以知道主要针对的是Joomla 1.5的版本,不过由于撰写时参考的版本是1.5 Beta,所以有很多设定内容已经和实际的RC版本不同。

同时此书也增加了Template和Extension的章节,教你如何来扩展和定制你的个人网站。

最后还通过一个葡萄园的例子来手把手的交你如何建立Joomla 1.5的门户网站。

不过不足的是未能看到关于SEO内容的详细介绍,同时可能RC版的SEO 又比Beta改进过,现在对这一部份内容理解比较糊涂,经常连接的页面无法访问。

  • Packt Publishing – Joomla Template Design Jun 2007

这本书出版的时间挺晚的,但内容确实教你如何修改Joomla 1.0的模版,讲的那个Dreamwaver Extensions已经无法使用.不过其中的一些概念流程还是不错,可以部分参考.如果想了解Joomla 1.5的模版定制可以参考"Building Websites with Joomla 1.5 Beta1",里面已经包含了模版定制的内容.

  • Packt Publishing – Learning Joomla Extension Development May 2007

这本书就比较与时俱进,内容跳过Joomla 1.0,直接教你如何撰写1.5的Extension.由于是专门讲述Extension的,所以内容也比"Building Websites with Joomla 1.5 Beta1"具体.

如果有兴趣写Joomla 1.5 的extension,绝对值的一读.

Joomla组件1(Joomla Component1)

Posted in PHP    作者:Ray    2007年九月10日

建立Joomla Component (模块名称:helloworld)

  1. 在根目录的components建立一个com_helloworld
  2. 在administrator\components目录下也建立一个com_helloworld
  3. 在根目录的components\com_helloworld目录下,新增一个空的helloworld.php
  4. 在administrator\components\com_test目录下,新增一个空的admin.helloworld.php
  5. 此时就可以通过http://localhost/joomla/index.php?option=com_helloworld,不过内容为空,并不现实任何信息。:)

虽然简单了些,不过也算第一步,有些小成。