如何更改Drupal主题显示首页的方式

时间:2021-06-04 21:11:55

I am trying to build an website for my college's magazine. I used the "views" module to show a block of static content I created on the front page.

我正在为我的大学杂志建立一个网站。我使用“views”模块来显示我在首页上创建的静态内容块。

My question is: how can I edit the theme's css so it changes the way that block of static content is displayed?

我的问题是:我如何编辑主题的CSS,以便改变静态内容块的显示方式?

For reference, here's the link to the site (in portuguese, and with almost zero content for now).

作为参考,这里是网站的链接(葡萄牙语,现在几乎没有内容)。

3 个解决方案

#1


3  

The main css file that drives your content is the styles.css file located in your currently selected theme. In your case that means that most of your site styling is driven by this file: /aroda/roda/themes/garland/style.css with basic coloring effects handled by this file: /aroda/roda/files/color/garland-d3985506/style.css

驱动内容的主要css文件是位于当前所选主题中的styles.css文件。在您的情况下,这意味着您的大多数网站样式由此文件驱动:/aroda/roda/themes/garland/style.css,此文件处理基本着色效果:/ aroda / roda / files / color / garland-d3985506 /style.css

You're currently using Garland, the default Drupal theme included with the core download, so for best practices you shouldn't edit the included style.css file directly. Instead, you should, as Daniel James said, create a subdirectory in /sites/all called "themes".

您目前正在使用Garland,核心下载中包含默认的Drupal主题,因此为了获得最佳实践,您不应直接编辑包含的style.css文件。相反,正如Daniel James所说,你应该在/ sites /中创建一个名为“themes”的子目录。

If you're using Drupal 6, I'd follow Daniel James directions from there. If you're using Drupal 5, I'd go ahead and copy the garland directory into the themes directory and rename it for something specific to your site (aroda_v1) so you would have something like /sites/all/themes/aroda_v1 which would contain styles.css. At that point, you can edit the styles.css file directly to make any changes you see fit. Hope that helps!

如果您正在使用Drupal 6,我会从那里跟随Daniel James的指示。如果您正在使用Drupal 5,我会继续将garland目录复制到themes目录中并将其重命名为特定于您的站点的内容(aroda_v1),这样您就可以使用/ sites / all / themes / aroda_v1这样的内容包含styles.css。此时,您可以直接编辑styles.css文件以进行您认为合适的任何更改。希望有所帮助!

#2


4  

I can't access your site at the moment, so I'm basing this on fairly limited information. But if the home page is static content, the views module might not be appropriate. It might be better to create a page (In the menu, go to: Create content > page), make a note of the page's url, and then change the default home page to that url (Administer > Site Configuration > Site information, 'Default front page' is at the bottom). Although I might be misunderstanding what you mean by 'static content'.

我目前无法访问您的网站,因此我基于相当有限的信息。但是,如果主页是静态内容,则视图模块可能不合适。创建页面可能更好(在菜单中,转到:创建内容>页面),记下页面的URL,然后将默认主页更改为该URL(管理>站点配置>站点信息,'默认首页'位于底部)。虽然我可能误解了“静态内容”的含义。

But however you're creating the front page, don't edit the css in the theme - it'll get overwritten next time you upgrade. Instead you need to create a sub-theme.

但是,无论你是在创建首页,都不要编辑主题中的css - 下次升级时它会被覆盖。相反,您需要创建一个子主题。

As an example, if you want to subtheme Garland, in drupal 6. You first need to setup a directory for your themes. Go to sites/all/ in your drupal installation, and create a subdirectory called themes if it doesn't already exist. Go into that directory, and create a directory for your subtheme, say mytheme (i.e. sites/all/themes/mytheme/). Then use your text editor to create a file called mytheme.info in that directory, with the contents:

例如,如果你想在drupal 6中使用subtheme Garland。你首先需要为你的主题设置一个目录。转到drupal安装中的sites / all /,并创建一个名为themes的子目录(如果它尚不存在)。进入该目录,并为你的子主题创建一个目录,比如mytheme(即sites / all / themes / mytheme /)。然后使用文本编辑器在该目录中创建名为mytheme.info的文件,其内容为:

name = My Theme
version = 0.1
core = 6.x
base theme = garland
stylesheets[all][] = mytheme.css

And then use your text editor to create a file called mytheme.css in that directory, and put the extra CSS in there.

然后使用文本编辑器在该目录中创建一个名为mytheme.css的文件,并将额外的CSS放在那里。

For more information, there's the druapl documentation on .info files and style sheets. Although, you might want to buy a book, as the online documentation isn't great.

有关更多信息,请参阅.info文件和样式表上的druapl文档。虽然,你可能想买一本书,因为在线文档不是很好。

#3


0  

It looks like most of your CSS info is in some *.css files. There is also some inline Style info on the page. Your style for the static info comes from the in-line stuff. I am not sure how Drupal generates the page but the place to start looking is for any properties for "ultima-edicao". That is what the surrounding DIV is called.

看起来你的大部分CSS信息都在一些* .css文件中。页面上还有一些内联样式信息。您的静态信息样式来自内嵌的东西。我不确定Drupal如何生成页面,但是开始查找的地方是“ultima-edicao”的任何属性。这就是所谓的周围DIV。

#1


3  

The main css file that drives your content is the styles.css file located in your currently selected theme. In your case that means that most of your site styling is driven by this file: /aroda/roda/themes/garland/style.css with basic coloring effects handled by this file: /aroda/roda/files/color/garland-d3985506/style.css

驱动内容的主要css文件是位于当前所选主题中的styles.css文件。在您的情况下,这意味着您的大多数网站样式由此文件驱动:/aroda/roda/themes/garland/style.css,此文件处理基本着色效果:/ aroda / roda / files / color / garland-d3985506 /style.css

You're currently using Garland, the default Drupal theme included with the core download, so for best practices you shouldn't edit the included style.css file directly. Instead, you should, as Daniel James said, create a subdirectory in /sites/all called "themes".

您目前正在使用Garland,核心下载中包含默认的Drupal主题,因此为了获得最佳实践,您不应直接编辑包含的style.css文件。相反,正如Daniel James所说,你应该在/ sites /中创建一个名为“themes”的子目录。

If you're using Drupal 6, I'd follow Daniel James directions from there. If you're using Drupal 5, I'd go ahead and copy the garland directory into the themes directory and rename it for something specific to your site (aroda_v1) so you would have something like /sites/all/themes/aroda_v1 which would contain styles.css. At that point, you can edit the styles.css file directly to make any changes you see fit. Hope that helps!

如果您正在使用Drupal 6,我会从那里跟随Daniel James的指示。如果您正在使用Drupal 5,我会继续将garland目录复制到themes目录中并将其重命名为特定于您的站点的内容(aroda_v1),这样您就可以使用/ sites / all / themes / aroda_v1这样的内容包含styles.css。此时,您可以直接编辑styles.css文件以进行您认为合适的任何更改。希望有所帮助!

#2


4  

I can't access your site at the moment, so I'm basing this on fairly limited information. But if the home page is static content, the views module might not be appropriate. It might be better to create a page (In the menu, go to: Create content > page), make a note of the page's url, and then change the default home page to that url (Administer > Site Configuration > Site information, 'Default front page' is at the bottom). Although I might be misunderstanding what you mean by 'static content'.

我目前无法访问您的网站,因此我基于相当有限的信息。但是,如果主页是静态内容,则视图模块可能不合适。创建页面可能更好(在菜单中,转到:创建内容>页面),记下页面的URL,然后将默认主页更改为该URL(管理>站点配置>站点信息,'默认首页'位于底部)。虽然我可能误解了“静态内容”的含义。

But however you're creating the front page, don't edit the css in the theme - it'll get overwritten next time you upgrade. Instead you need to create a sub-theme.

但是,无论你是在创建首页,都不要编辑主题中的css - 下次升级时它会被覆盖。相反,您需要创建一个子主题。

As an example, if you want to subtheme Garland, in drupal 6. You first need to setup a directory for your themes. Go to sites/all/ in your drupal installation, and create a subdirectory called themes if it doesn't already exist. Go into that directory, and create a directory for your subtheme, say mytheme (i.e. sites/all/themes/mytheme/). Then use your text editor to create a file called mytheme.info in that directory, with the contents:

例如,如果你想在drupal 6中使用subtheme Garland。你首先需要为你的主题设置一个目录。转到drupal安装中的sites / all /,并创建一个名为themes的子目录(如果它尚不存在)。进入该目录,并为你的子主题创建一个目录,比如mytheme(即sites / all / themes / mytheme /)。然后使用文本编辑器在该目录中创建名为mytheme.info的文件,其内容为:

name = My Theme
version = 0.1
core = 6.x
base theme = garland
stylesheets[all][] = mytheme.css

And then use your text editor to create a file called mytheme.css in that directory, and put the extra CSS in there.

然后使用文本编辑器在该目录中创建一个名为mytheme.css的文件,并将额外的CSS放在那里。

For more information, there's the druapl documentation on .info files and style sheets. Although, you might want to buy a book, as the online documentation isn't great.

有关更多信息,请参阅.info文件和样式表上的druapl文档。虽然,你可能想买一本书,因为在线文档不是很好。

#3


0  

It looks like most of your CSS info is in some *.css files. There is also some inline Style info on the page. Your style for the static info comes from the in-line stuff. I am not sure how Drupal generates the page but the place to start looking is for any properties for "ultima-edicao". That is what the surrounding DIV is called.

看起来你的大部分CSS信息都在一些* .css文件中。页面上还有一些内联样式信息。您的静态信息样式来自内嵌的东西。我不确定Drupal如何生成页面,但是开始查找的地方是“ultima-edicao”的任何属性。这就是所谓的周围DIV。