在 Sitefinity 4.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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用现有的母版页,但是在 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!
另外,如果您想引用 /App_Data 文件夹中的文件,请注意您需要将该文件夹保留在路径之外
示例:
对于 .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:
Same for pictures which are used in the .master file.
Hope this helps, too.
Sitefinity 具有实现利用母版页的自定义模板所需的非常具体的文件结构。
main.css/reset.css
文件中,并将您的母版页上传到App_Master
目录。管理>;设置
,选择高级选项,然后选择外观>左侧菜单中的前端主题
。MyGreenTheme
的主题的文件结构。它的路径是:
~/App_Data/Sitefinity/WebsiteTemplates/MyTemplate/App_Themes/MyGreenTheme
)。来放置图像
如果您选择使用前者而不是后者,请确保
main.css
和reset.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.
main.css/reset.css
files within the Global directory, and upload your master page to theApp_Master
directory.Administration > Settings
, choose the advanced option, and selectAppearance > Frontend Themes
from the menu on the left.MyGreenTheme
.It's path would be:
~/App_Data/Sitefinity/WebsiteTemplates/MyTemplate/App_Themes/MyGreenTheme
).Images can be placed by
If you choose to use the former rather than the latter, be sure that the image paths in your
main.css
andreset.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!