在 Sitefinity 4.0 中使用主文件进行模板布局/设计

发布于 2024-10-18 09:49:18 字数 265 浏览 1 评论 0原文

我有一个主模板,其中包含手动编码的 HTML、JS 和 CSS(在 3.7 中工作),我想将其用作 Sitefinity 4.0 项目的模板,但我似乎不知道如何创建模板并使用它主文件,而不是痛苦地拖放一堆布局框并重新制作我所有现有的代码。虽然我可以将我的 master 从 3.7 上的文件系统放入项目中,但它似乎找不到它,或者允许我在 4.0 中使用它

具体来说 - 我似乎无法获取 JS 和 CSS 文件的路径HTML 中正确。 Firebug 表示服务器正在返回某些文件的“禁止”和“未找到”。

I have a master template that contains hand coded HTML, JS, and CSS (that worked in 3.7) that I would like to use as the template for a Sitefinity 4.0 project but I cannot seem to figure out how to create a template and use that master file instead of dragging and dropping, painfully, a bunch of layout boxes and re-crafting all my existing code. Whereas I could drop my master in to the project from the file system on 3.7 it doesn't seem to find it, or allow me to use it in 4.0

Specifically- I can't seem to get the paths to the JS and CSS files correct in the HTML. Firebug says that the server is returning a Forbidden and Not Found for certain files.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

给妤﹃绝世温柔 2024-10-25 09:49:19

您可以使用现有的母版页,但是在 4.0 中,它们不会像 3.x 中那样自动拾取。相反,您首先创建一个设计模板,选择该母版作为基础。应该有一个“选择你自己的主文件”的选项。

以下是此文档的链接:http://www.sitefinity.com/4.0/documentation/Designers-Guide/creating-a-template/creating-a-template-using-master-pages.aspx

希望这很有帮助!

You can use your existing master page, however in 4.0, they don't automatically pickup as they do in 3.x. Instead you first create a design template, choose that master as the base. there should be an option for "choose your own master file".

here's a link to the documentation for this: http://www.sitefinity.com/4.0/documentation/Designers-Guide/creating-a-template/creating-a-template-using-master-pages.aspx

hope this was helpful!

与君绝 2024-10-25 09:49:19

另外,如果您想引用 /App_Data 文件夹中的文件,请注意您需要将该文件夹保留在路径之外

示例:

<script type="text/javascript" src="/Sitefinity/WebSiteTemplates/THEMENAME/App_Themes/SKINNAME/js/script.js"></script>

对于 .master 文件中使用的图片也是如此。

希望这也有帮助。

Also, if you want to refer to a file in your /App_Data folder, be aware that you need to leave that folder out of the path

Example:

<script type="text/javascript" src="/Sitefinity/WebSiteTemplates/THEMENAME/App_Themes/SKINNAME/js/script.js"></script>

Same for pictures which are used in the .master file.

Hope this helps, too.

满地尘埃落定 2024-10-25 09:49:19

Sitefinity 具有实现利用母版页的自定义模板所需的非常具体的文件结构。

  • 创建此处所述的文件结构。
  • 完成后,请确保您所需的 css 包含在 Global 目录中的 main.css/reset.css 文件中,并将您的母版页上传到 App_Master目录。
  • 准备好这些文件后,您必须将 CSS 文件注册为主题。
  • 转到管理>;设置,选择高级选项,然后选择外观>左侧菜单中的前端主题
  • 添加新主题,并提供包含主题的目录的路径(在提供的链接中,图像显示名为 MyGreenTheme 的主题的文件结构。
    它的路径是:~/App_Data/Sitefinity/WebsiteTemplates/MyTemplate/App_Themes/MyGreenTheme)。
  • 完成后,创建一个新模板并浏览到 App_Master 目录以选择您的母版页。在模板编辑器的右侧,单击主题并选择您新注册的主题。

来放置图像

  1. 可以通过 css 将背景图像应用到母版页中指定的容器
  2. ,或者将它们放入设计器后端的占位符中。

如果您选择使用前者而不是后者,请确保 main.cssreset.css 文件中的图像路径相对于这些文件。 (例如background-image:url('../../Images/some_image.png';
(请参阅提供的链接中的文件结构图像以进行澄清)

顺便说一句,我发现 Sitefinity 不会拾取通过 Visual Studio 添加的文件,必须通过转到“管理”>“后端”来添加它们。文件结构。通过后端添加后,对这些文件所做的任何更改都应在页面刷新后生效。

另外,我还没有尝试在 Sitefinity 中包含任何 Javascript/JQuery 代码,但我的假设是该过程会类似。

干杯!

Sitefinity has a very specific file structure necessary for implementing custom templates that utilize a master page.

  • Create the file structure described here.
  • Once that is complete, be sure that your desired css is contained within the main.css/reset.css files within the Global directory, and upload your master page to the App_Master directory.
  • With these files in place, you must register your CSS files as a Theme.
  • Go to Administration > Settings, choose the advanced option, and select Appearance > Frontend Themes from the menu on the left.
  • Add a new theme, and provide the path to the directory containing your theme (In the provided link, the image shows the file structure for a theme called MyGreenTheme.
    It's path would be: ~/App_Data/Sitefinity/WebsiteTemplates/MyTemplate/App_Themes/MyGreenTheme).
  • Once that is done, go create a new template and browse to the App_Master directory to choose your master page. On the right side of the template editor, click Theme and choose your newly registered theme.

Images can be placed by

  1. applying a background image to containers specified in your master page via css, or
  2. by dropping them into placeholders from the designer backend.

If you choose to use the former rather than the latter, be sure that the image paths in your main.css and reset.css files are relative to those files. (e.g. background-image:url('../../Images/some_image.png';)
(See file structure image in the provided link for clarification)

As a side note, I have found that files added via visual studio are not picked up by Sitefinity, they must be added through the backend by going to Administration > File Structure. Once added through the backend, any changes made those files should be picked up after a page refresh.

Also, I have not yet attempted to include any Javascript/JQuery code in Sitefinity, but my assumption is that the process would be similar.

Cheers!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文