【问题标题】:Modify Category Blog Layout Joomla 1.5修改分类博客布局 Joomla 1.5
【发布时间】:2012-07-16 12:40:54
【问题描述】:

我希望在 Joomla 1.5 中修改“类别博客布局”。我想修改它,使偶数行右对齐,奇数行左对齐。我也想对文章标题执行此操作,因此在文章正文中使用 html 或 css(参数中的页面类后缀)不是一个选项,因为它只会影响以下两个生成的表格 html(contentpaneopen)每个博客项目文本的文件:

\components\com_content\views\category\tmpl\blog.php \components\com_content\views\category\tmpl\blog_item.php

我猜,我需要在我的自定义模板中重载这两个文件来实现我想要的。问题是我看不到如何访问 blog_item.php 正在处理的行号。

我发现\components\com_content\views\category\view.html.php中的ContentViewCategory::getItems有以下几行代码:

$item->odd      = $k;
$item->count    = $i;

但我不知道如何访问这些。

有什么想法吗?

PS:这是我想要实现的布局:

---------------------------------------------------
|   --------------   ---------------------------- |
|   |            |   |                          | |     
|   |            |   |                          | |     
|   |   row 1    |   |      row 1 text          | |
|   |   Image    |   |                          | |
|   |            |   |                          | |
|   |            |   |                          | |
|   |------------|   |--------------------------| |   
--------------------------------------------------|
---------------------------------------------------
|   |--------------------------| |--------------| | 
|   |                          | |              | |
|   |                          | |              | |     
|   |      row 2 text          | |    row 2     | |
|   |                          | |    Image     | |
|   |                          | |              | |
|   |                          | |              | |
|   |--------------------------| |--------------| |   
--------------------------------------------------|
---------------------------------------------------
|   --------------   ---------------------------- |
|   |            |   |                          | |     
|   |            |   |                          | |     
|   |   row 3    |   |      row 3 text          | |
|   |   Image    |   |                          | |
|   |            |   |                          | |
|   |            |   |                          | |
|   |------------|   |--------------------------| |   
--------------------------------------------------|

【问题讨论】:

    标签: joomla joomla1.5


    【解决方案1】:

    我不想回答我自己的问题,但是一旦我能够debug Joomla,结果证明这比我想象的要简单得多。我重载了这两个文件:

    \components\com_content\views\category\tmpl\blog.php \components\com_content\views\category\tmpl\blog_item.php

    在我的自定义主题文件夹中:

    \templates\\html\com_content\views\category\tmpl\blog.php \components\\html\com_content\views\category\tmpl\blog_item.php

    以下是我添加到blog.php 的一个班轮:

    $this->assign('itemIndex', $i);
    

    调用前:

    echo $this->loadTemplate('item')
    

    现在我可以在blog_item.php 中调用$this->itemIndex 来获取行索引并用它做我想做的事情。

    【讨论】:

      【解决方案2】:

      更有序的呢? 就像在一侧创建一种尺寸的缩略图一样, 相同的 introtext 和 title 字体 anall

      【讨论】: