简体   繁体   English

TYPO3-如何设置 <base> 在生成的html页面的标题中标记?

[英]TYPO3 - how to set the <base> tag in the header of generated html pages?

I have inherited ownership of a website running on TYPO3 version 4.2.1. 我继承了在TYPO3 4.2.1版上运行的网站的所有权。 There are two pages that are not rendering correctly, and this seems to be down to a failure to load css and javascript files. 有两个页面无法正确呈现,这似乎是由于无法加载CSS和JavaScript文件所致。 Inspecting the page source, I can see that the <base href="blah..." /> tag is missing from the page header. 检查页面源代码,可以看到页面标题中缺少<base href="blah..." />标记。

The question: how on Earth do I set the base url property in TYPO3!? 问题:到底如何在TYPO3中设置基本url属性!?

I have poured over the Typo3 website, edited various "typoscript" files, offered sacrafices to the PHP gods, all to no avail. 我倾倒了Typo3网站,编辑了各种“ typoscript”文件,向PHP之神提供了牺牲品,但都无济于事。 The generated code still does not include the tag. 生成的代码仍然不包含标签。

Any help appreciated. 任何帮助表示赞赏。 Please note it is not possible for me to "upgrade to the latest version", and my PHP knowledge is non-existant. 请注意,我不可能“升级到最新版本”,并且我的PHP知识不存在。

Adding this line to the "Setup" field of your site's main TypoScript template ought to do it: 将此行添加到站点的主要TypoScript模板的“设置”字段中即可:

config.baseURL = < URL here >

The "TSRef" (TypoScript Reference) is a key document for every TYPO3 site administrator -- it's available online here: “ TSRef”(TypoScript参考)是每个TYPO3站点管理员的关键文档-可在此处在线获取:

http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/current/ http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/current/

I recommend printing out a copy to keep at your desk, you will be referring to it frequently. 我建议打印出一份副本放在办公桌上,您将经常使用它。 (They provide it in OpenOffice format as well, to make this easy.) (为了方便起见,他们也以OpenOffice格式提供它。)

Section 1.6 ("Setup") describes all the properties you can set via TypoScript's CONFIG object: 第1.6节(“设置”)描述了可以通过TypoScript的CONFIG对象设置的所有属性:

http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/4.3.0/view/1/6/#id2512147 http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/4.3.0/view/1/6/#id2512147

PS While I wasn't going to recommend you download the latest version to fix this problem, I will recommend you download the latest version to be sure you haven't missed any security patches. PS虽然我不打算建议您下载最新版本,以解决这个问题,我建议您下载最新版本,以确保你没有错过任何安全补丁。

Here is how to set the baseurl within the v4.5 introduction package: 以下是在v4.5简介包中设置baseurl的方法:

  1. Template > Home > Edit Whole Template Record 模板>主页>编辑整个模板记录
  2. Includes (between Options and Recources tab ) 包含(在“选项”和“资源”选项卡之间)
  3. Click on the little template icon to the left of ROOT, choose Edit 单击“ ROOT”左侧的小模板图标,选择“ Edit”。
  4. Under Constants > Config, enter the base domain as shown below (leave out the <> 在“常量”>“配置”下,输入基本域,如下所示(忽略<>
  5. Rememember to clear all cache and then to Ctrl + F5 to complete refresh the browser 记住清除所有缓存,然后按Ctrl + F5完成刷新浏览器

TS: TS:

config {
    # cat=config; type=boolean; label=Admin Panel: Turn on admin panel (mainly for testing purposes only)
    adminPanel = 0

    # cat=config; type=boolean; label=Debugging: Turn on debugging (testing purposes only)
    debug = 0

    # cat=config; type=string; label=Domain name for Base URL: (excluding slashes and protocol like http://)
    domain = < ENTER YOUR DOMAIN HERE >
} 

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

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