Support jOOmla! Autoit!
随心所欲的自定义joomla模板的方法 输出PDF 打印 E-mail
Author Author: Autoit | Date Date:2007-01-27 | View Count View: 29435 | Digg Count Digg: 98

还记得joomla的模板分配吗?  本文的目的其实和这个是相同的.只是实现方法不同而已. [本文不介绍默认模板里都可以学习到的用判断来确定某位置输出不输出的问题. ]

通常情况下, 如果只是首页和其他页不同的话, 我们可以在模板里利用些判断, 比如

<? if ($option !="com_frontpage") { ?>

之类的来做, 如果内页涉及到左右分栏, 自动适应等等,或许就比较麻烦了, css 要鼓捣不说,只 if 判断都不晓得要加多少... 想想真不如用 模板分配哈.  

当然,如果是这样的 话, 可以建立另一模板,只 index.php 和templateDetails.xml文件, 而index.php里的所有路径基本都指向原模板.然后在后台利用模板分配来做也是可以实现的了.

 

恩恩, 条条道路通罗马在joomla的模板里也体现的很明朗! 接着我们来看看, 怎么样在一个模板里既简单,又方便的来模拟出 joomla 的模板分配来, 而且比模板分配来的更灵活!

 

now . 凌晨3: 18 该休息了. 等抽时间继续下文....

 

其实也是很简单的:

 

在模板里建立你的不同的页面[相当与你多模板里的index.php],并各自命名比如为 a.php, b.php, c.php, ...

然后把模板里的index.php 改写成一个 case 语句或 if 的判断就可以了。比如:

 

<?php defined( "_VALID_MOS" ) or die( "Direct Access to this location is not allowed." );
 
switch ($option){ 
    case "com_frontpage":  
         require_once( "templates/$GLOBALS[cur_template]/a.php");  
         break;
    case "com_contact":  
         require_once( "templates/$GLOBALS[cur_template]/b.php");  
         break;
    default:  
         require_once( "templates/$GLOBALS[cur_template]/c.php" );  
         break; 
 
         }  
?>

根据自己的需要,可以变换不同的变量或条件或判断嵌套来做吧。

想一想a.php,我可以用表格做出我想要的任何样子. 在空的地方[<td></td>里]插入个位置如 user10 ...在结合本站提供9招玩转 joomla 的文章模块 就可以很丰富的做出想要的任何样子啦.

End by Autoit.

 
joomlaboard签名档乱码问题 输出PDF 打印 E-mail
Author Author: Autoit | Date Date:2007-01-26 | View Count View: 11608 | Digg Count Digg: 60

文件: components/com_joomlaboard/userprofile.php :

$signature=trim(htmlentities(addslashes($signature)));

里使用了  htmlentities 函数导致的问题.暂时可先删除,

$signature=trim(addslashes($signature));

可解决单纯文字乱码的问题.  其他未思考.

 
9招玩转 joomla 的文章模块! 输出PDF 打印 E-mail
Author Author: Autoit | Date Date:2007-01-26 | View Count View: 47506 | Digg Count Digg: 165

1,典型的标题右侧增加 more 的方法:

http://www.autoit.cn/index.php/content/view/95/25.html

 

2,条目前面增加分类的方法:

http://www.autoit.cn/index.php/content/view/99/25.html

 

3,条目后面增加 最新提示图片:

http://www.autoit.cn/index.php/content/view/94/25.html

 

4, 条目后面增加点击数:

http://www.autoit.cn/index.php/content/view/100/25.html

 

5,条目后面增加发布时间:

http://www.autoit.cn/index.php/content/view/78/25.html

 

6,条目增加断字加省略号:

http://www.autoit.cn/index.php/content/view/81/25.html

 

7,css方法实现模块标题使用不同的图片:

http://www.autoit.cn/index.php/content/view/39/25.html

 

8,模块中增加自定义图片:

http://www.autoit.cn/index.php/content/view/92/25.html

 

9,模块两列输出:

http://www.autoit.cn/index.php/content/view/88/25.html

 

以上都可以在后台增加自定义开关。

 
在热门文章模块结尾增加点击数 输出PDF 打印 E-mail
Author Author: Autoit | Date Date:2007-01-26 | View Count View: 13576 | Digg Count Digg: 63

最新文章模块基本相同.

文件 : modules/mod_mostread.php

搜索

, a.title

替换为[有两处] :

, a.title, a.hits

在结尾处的

<?php echo $row->title; ?></a>

后面增加:

<small> (<?php echo $row->hits; ?>)</small>

ok. 这样就可以了。

当然还可以给他增加个开关。

方法:

在"上面我们加的那行"前面加:

<?php if ($show_hits == '1') { ?>

后面加

<?php } ?>

接着在此文件的开始部分的:

$show_front = $params->get( 'show_front', 1 );

下面增加:

$show_hits = $params->get( 'show_hits', 1 );

然后在 modules/mod_mostread.xml 结尾处的

 </params>

上面增加:

  <param name="show_hits" type="radio" default="1" label="show hits" description="Show/Hide hits">
   <option value="1">show</option>
   <option value="0">hide</option>
  </param>

就可以了。在使用中,如果不需要显示单元,只要在后台设置此模块的 show hide 处选 hide 就不显示了。

end by autoit.

 
在最新文章模块条目前面增加此条目所属的分类 输出PDF 打印 E-mail
Author Author: Autoit | Date Date:2007-01-22 | View Count View: 13401 | Digg Count Digg: 67

效果:

  

[此文没考虑 Static 即 调用最新静态文章, 也就是说,你用最新文章mod掉用静态文章的话,下面是有问题的。不过你可以用下面的开关方法来关闭他.]

文件 : modules/mod_latestnews.php

搜索

, a.sectionid

替换为[有两处] :

, a.sectionid, cc.name

在结尾处的

<li class="latestnews<?php echo $moduleclass_sfx; ?>">

后面增加:

[<a href="<?php echo sefRelToAbs("index.php?option=content&task=category&sectionid=$row->sectionid&id=$row->catid$Itemid"); ?>" title='<?php echo $row->name; ?>'><?php echo $row->name;?></a>]

ok. 这样就可以了。

当然还可以给他增加个开关。

方法:

在上面我们加的那行前面加:

<?php if ($show_catid == '1') { ?>

后面加

<?php } ?>

接着在此文件的开始部分的:

$show_front = $params->get( 'show_front', 1 );

下面增加:

$show_catid = $params->get( 'show_catid', 1 );

然后在 modules/mod_latestnews.xml 结尾处的

 </params>

上面增加:

  <param name="show_catid" type="radio" default="1" label="show catid" description="Show/Hide catid">
   <option value="1">show</option>
   <option value="0">hide</option>
  </param>

就可以了。在使用中,如果不需要显示单元,只要在后台设置此模块的 show catid 处选 hide 就不显示了。

end by autoit.

 
« First « 1 2 3 4 5 6 7 8 9 10 » Last »

16 - 20 / 109