简体   繁体   English

Joomla中的多栏文章

[英]Multiple column articles in Joomla

I've got a client that requires that an article be displayed in two, sometimes three, columns in Joomla. 我有一个客户,要求一篇文章在Joomla中显示为两列,有时显示为三列。 I am fairly sure they won't be happy with having to edit 3 articles for 3 columns so the splitting would have to be done automatically. 我相当确定他们不会为3列编辑3篇文章而感到满意,因此拆分必须自动完成。

I've done something similar before where it'll split a chunk of HTML into n columns, but have no real idea how to accomplish this within Joomla itself. 在将HTML的大块拆分为n列之前,我已经做过类似的事情,但是不知道如何在Joomla本身中完成此工作。

Any ideas gratefully recieved! 任何想法表示感谢!

This doesn't seem to be easy. 这似乎并不容易。

At first thought this should be an CSS attribute, but if it exists, it is part of CSS 3.0 and as such only understood by modern browsers (if at all). 最初认为这应该是CSS属性,但是如果存在,它就是CSS 3.0的一部分,因此只有现代浏览器才能理解(如果有的话)。 But I didn't find any way to do this in CSS. 但是我没有找到任何在CSS中执行此操作的方法。

So you actually have to modify your HTML code. 因此,您实际上必须修改HTML代码。 I would propose the following: 我将提出以下建议:

  • A Button (editor-xtd plugin) that splits the article into several parts, each one for one column, showing a dotted line in the editor box (similar to the "read-more"-Button). 一个Button(editor-xtd插件),用于将文章分为几部分,每一部分为一栏,在编辑器框中显示一条虚线(类似于“ read-more” -Button)。
    Eg it inserts in the article: (you will have to define hr.column in /templates/system/css/editor.css). 例如,它插入到文章中:(您必须在/templates/system/css/editor.css中定义hr.column)。
  • A (content) plugin that creates the multiple colum-style, 一个(内容)插件,可创建多个列样式,
    Eg replacing the hr-Tag with table or floating divs. 例如,用表格或浮动div替换hr-Tag。

This way, it is half-automized, without mangeling in the Joomla! 这样,它可以实现半自动化,而无需在Joomla中进行操作! files but only adding to extensions to it. 文件,但仅添加扩展名。

An alternative approach: 替代方法:

Use Javascript to split up the Article in several column in the browser. 使用Javascript将“文章”拆分为浏览器的几列。 Here I could imagine a full-automated approach could work. 在这里,我可以想象全自动的方法可以奏效。

Advantages (over the first approach): 优点(相对于第一种方法):

  • As Javascript can know, which height the paragraphs actually have in the browser (unlinke PHP), you could find the optimum split more accurately. 如Javascript所知,段落在浏览器中实际具有的高度(取消链接PHP),您可以更准确地找到最佳拆分。
  • This can be implemented in the template php-File: you tell the template to include the js-File. 这可以在模板php-File中实现:您告诉模板包括js-File。 So it could be made context-dependent, 因此可以使其与上下文相关,
    Eg: If the left column is collapsed (because there are no modules in it), tell the JavaScript-File to initialize to 3 columns, else 2 columns. 例如:如果左列折叠了(因为其中没有模块),请告诉JavaScript文件初始化为3列,否则初始化为2列。

However, have in mind that it should rest usable for those who have Javascript disabled. 但是,请记住,它应该对禁用Javascript的用户可用。

the CSS 3 rules for multi-columns are: CSS 3的多列规则是:

-column-width -列宽

-column-gap -column隙

-column-rule -column规则

-column-count -column数

with the vendor label (-moz, -webkit) before. 之前带有供应商标签(-moz,-webkit)。

More info at http://www.css3.info/preview/multi-column-layout/ 有关更多信息, 请访问http://www.css3.info/preview/multi-column-layout/

I would use css and tell the people with Explorer to change browser! 我会使用CSS并告诉具有Explorer的人员更改浏览器! (i'm jocking of course) (我在开玩笑)

Otherwise javascript is the way like said before. 否则,javascript就像之前所说的那样。 This script should do (not tested) http://13thparallel.com/archive/column-script/ 该脚本应该执行(未经测试) http://13thparallel.com/archive/column-script/

This should be done through the template, some PHP coding is involved. 这应该通过模板来完成,其中涉及一些PHP编码。

One of our clients asked us to do the exact same thing before, and we have done it through template. 我们的一位客户要求我们之前做完全相同的事情,并且我们已经通过模板完成了。 Note that for very small articles we increased the font in order to split the article into 3 columns. 请注意,对于非常小的文章,我们增加了字体,以将文章分为3列。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM