gpt4 book ai didi

php - SilverStripe 主题无法识别主页主题

转载 作者:行者123 更新时间:2023-11-28 08:34:18 24 4
gpt4 key购买 nike

我刚刚恢复了一个 SilverStripe 网站,其中涉及将 silverStripe 从版本 2.4 更新到当前版本 (3.1.9)。在删除并重新安装站点之前,我复制了所有内容,备份了数据库并保存了模板。

网站使用的是自定义主题,我可以将其复制回/Themes 文件夹,然后在设置中选择正确的主题。

我现在有两个问题,因为我没有改变任何东西,所以我不确定为什么它不起作用

首先:SilverStripe 无法识别主页模板SilverStripe 只是读取通用的 Page 模板

主页.ss

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<% base_tag %>
$MetaTags(false)
<title>$Title - Furturo - Design. Build. Outdoor</title>
<script type="text/javascript" src="themes/forturo/javascript/jquery-1.3.2.min.js"></script>
<script src="themes/forturo/javascript/jquery.innerfade.js" type="text/javascript"></script>
<script type="text/javascript" src="themes/forturo/javascript/forturo.js"></script>

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-56783648-1', 'auto');
ga('send', 'pageview');

</script>

<% require themedCSS('reset') %>
<% require themedCSS('reset-font-grids') %>
<% require themedCSS('sifr') %>
<% require themedCSS('forturo') %>
<title>Forturo</title>
</head>
<body id="home">
<div id="custom-doc" class="yui-t7">
<div id="bg">

<div id="hd">
<img src="themes/forturo/images/design-top-left.gif" alt="" id="top-left">
<h1>Forturo - Design. Build. Outdoor - Architectural Design. Draughting. Building Services</h1>
<% include HomeNav %>
</div>
<div id="bd">
<div class="yui-gd">
<div id="pngwrap">
<img src="themes/forturo/images/home/home-blue-stripe.png" alt="" width="123" height="631" id="blue">
<img src="themes/forturo/images/home/home-green-stripe.png" alt="" width="123" height="631" id="green">
<img src="themes/forturo/images/home/home-orange-stripe.png" alt="" width="123" height="631" id="orange">
</div>
<div class="yui-u first nav">
</div>
<div class="yui-u second">
<div id="rotatingImageHolder">
<ul id="mainImage">
<% if HomePageImage1 %><li><img src="$HomePageImage1.URL" alt="" class="image3"></li><% end_if %>
<% if HomePageImage2 %><li><img src="$HomePageImage2.URL" alt="" class="image2"></li><% end_if %>
<% if HomePageImage3 %><li><img src="$HomePageImage3.URL" alt="" class="image1"></li><% end_if %>
<% if HomePageImage4 %><li><img src="$HomePageImage4.URL" alt="" class="image4"></li><% end_if %>
<% if HomePageImage5 %><li><img src="$HomePageImage5.URL" alt="" class="image4"></li><% end_if %>
<% if HomePageImage6 %><li><img src="$HomePageImage6.URL" alt="" class="image4"></li><% end_if %>
</ul>

</div>

<div>
<a href="Design" class="design-button button">Design</a>
<a href="Outdoor" class="outdoor-button button">Green</a>
<a href="Build" class="build-button button">Build</a>
</div>
</div>
</div>

</div>
<div id="ft">
<div id="textholder"></div>
</div>
</div><!-- /#bg -->
</div>
</body>
</html>

页面.ss

   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<% base_tag %>
$MetaTags(false)
<title>$Title - Forturo - Design. Build. Outdoor</title>
<% require themedCSS('reset') %>
<% require themedCSS('reset-font-grids') %>
<% require themedCSS('sifr') %>
<% require themedCSS('forturo') %>

<!-- sifr scripts -->
<script src="/themes/forturo/javascript/sifr.js" type="text/javascript"></script>
<script type="text/javascript">
// from sifr 3 site:
var hneue = {
src: 'themes/forturo/fonts/helvetica_neue.swf'
,css: {'.sIFR-root': { 'text-align': 'left', 'font-weight': 'normal', <% if menuImage = "build" %>'color': '#F77419',<% else_if menuImage = "green" %>'color': '#8fe000',<% else_if menuImage = "design" %>'color': '#0193E8',<% else %>'color': '#BEAD75', <% end_if %> 'font-size': '57px', 'z-index': '0'}}
,ratios: [7, 1.32, 11, 1.31, 13, 1.24, 14, 1.25, 19, 1.23, 27, 1.2, 34, 1.19, 42, 1.18, 47, 1.17, 48, 1.18, 69, 1.17, 74, 1.16, 75, 1.17, 1.16],

<% if isGalleryPage %>
// stop flash floating over lightbox
wmode: 'transparent'
<% end_if %>
};
//sIFR.domains = ['novemberborn.net'];
sIFR.useStyleCheck = true;
sIFR.activate(hneue);

sIFR.replace(hneue, {
selector: 'h2'
});

</script>

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-56783648-1', 'auto');
ga('send', 'pageview');

</script>
</head>
<body
<% if menuImage %>
id="{$menuImage}"
<% end_if %>
class="$ClassName">
<div id="custom-doc" class="yui-t7">
<div id="bg">
<div id="hd">
<% if menuImage %>
<img src="/themes/forturo/images/{$menuImage}-top-left.gif" alt="" id="top-left">
<% end_if %>
<% include AuxNavigation %>
<% include CategoryNav %>

</div>
<div id="bd">
<div class="yui-gd">
$Layout
</div>

</div>
<div id="ft"></div>
</div><!-- /#bg -->
</div>

<div class="yui-t7" style="width: 76.92em; padding-bottom: 20px;">
All content, images and designs are copyright Forturo, 2015
</div>

</body>
</html>

主页.php

    <?php

class HomePage extends SiteTree {

public static $db = array(
);

static $has_one = array(
'HomePageImage1' => 'Image',
'HomePageImage2' => 'Image',
'HomePageImage3' => 'Image',
'HomePageImage4' => 'Image',
'HomePageImage5' => 'Image',
'HomePageImage6' => 'Image',
);

function getCMSFields() {
$fields = parent::getCMSFields();
// add image fields
$fields->addFieldToTab("Root.Content.Main", new ImageField('HomePageImage1', 'Image'));
$fields->addFieldToTab("Root.Content.Main", new ImageField('HomePageImage2', 'Image'));
$fields->addFieldToTab("Root.Content.Main", new ImageField('HomePageImage3', 'Image'));
$fields->addFieldToTab("Root.Content.Main", new ImageField('HomePageImage4', 'Image'));
$fields->addFieldToTab("Root.Content.Main", new ImageField('HomePageImage5', 'Image'));
$fields->addFieldToTab("Root.Content.Main", new ImageField('HomePageImage6', 'Image'));
// remove content field (unused)
$fields->removeFieldFromTab("Root.Content.Main", 'Content');
return $fields;
}

}

class HomePage_Controller extends ContentController {

public function init() {
parent::init();

// Note: you should use SS template require tags inside your templates
// instead of putting Requirements calls here. However these are
// included so that our older themes still work
Requirements::themedCSS("reset-fonts-grids");
Requirements::themedCSS("forturo");
}

/**
* Site search form

function SearchForm() {
$searchText = isset($_REQUEST['Search']) ? $_REQUEST['Search'] : 'Search';
$fields = new FieldSet(
new TextField("Search", "", $searchText)
);
$actions = new FieldSet(
new FormAction('results', 'Search')
);

return new SearchForm($this, "SearchForm", $fields, $actions);
}
*/

/**
* Process and render search results

function results($data, $form){
$data = array(
'Results' => $form->getResults(),
'Query' => $form->getSearchQuery(),
'Title' => 'Search Results'
);

return $this->customise($data)->renderWith(array('Page_results', 'Page'));
}
*/

function extension(){
return Page_Controller::extension();
}
}

?>

页面.php

    <?php

class Page extends SiteTree {

public static $db = array(
);

public static $has_one = array(
'ContentImage' => 'Image'
);

public function getCMSFields(){
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Images', new ImageField('ContentImage', 'Content Image (appears at the top of the content)'));
return $fields;
}

// menu function - is this a design page?
function isDesign(){
return Page_Controller::testSectionType('design');
}

// menu function - is this a build page?
function isBuild(){
return Page_Controller::testSectionType('build');
}

// menu function - is this an outdoor page?
function isOutdoor(){
return Page_Controller::testSectionType('green');
}

// stop aux menu items showing in main menu
function isAuxiliary(){
return Page_Controller::testSectionType('Auxiliary');
}

}

class Page_Controller extends ContentController {

public function init() {
parent::init();

// Note: you should use SS template require tags inside your templates
// instead of putting Requirements calls here. However these are
// included so that our older themes still work
Requirements::themedCSS("reset-fonts-grids");
Requirements::themedCSS("forturo");
}


// test which section this page lives in
function testSectionType($sectionName){

$sectionName = strtolower($sectionName);

if (strtolower($this->Title) == $sectionName){
return true;
}

else if(is_object($this->Parent) and isset($this->Parent->Title) and strtolower($this->Parent->Title) == $sectionName){
return true;
}
else if (is_object($this->Parent->Parent) and isset($this->Parent->Parent->Title) and strtolower($this->Parent->Parent->Title) == $sectionName ){
return true;
}
else if(is_object($this->Parent->Parent->Parent) and isset($this->Parent->Parent->Parent->Title) and strtolower($this->Parent->Parent->Parent->Title) == $sectionName){
return true;
}

else{
return false;
}
}

// set menu top image ("design", "outdoor" etc)
function menuImage(){
$imgName = '';
if($this->testSectionType('Design')){
return 'design';
}
else if($this->testSectionType('Build')){
return 'build';
}
else if($this->testSectionType('green')){
return 'green';
}
else{
return false;
}

}


function currentPage(){
if($this->Parent->Title){
return $this->Parent->Title;
}
else{
return false;
}
}

}

?>

PageComponant.php

    <?php
// 'components' which are assembled into page sections at runtime
class PageComponent extends SiteTree {

public static $db = array(
);

public static $has_one = array(
);

// used by nav and content to see if we're processing a component (treated differently)
function isComponent(){
return true;
}
}

?>

其次:主题显示不正确。

主页(索引)应该是这样的 https://web.archive.org/web/20140516185945/http://forturo.co.nz/除了照片是幻灯片

其余的页面应该是这样的 https://web.archive.org/web/20140529044618/http://forturo.co.nz/photo-gallery/

CSS

    /* --------------------------
Home:
- arrows above base category links
- colour panels in bg image
-

Interior
- spash pages for sections
- content images for int pages
- subsection internal links for pages
- sections for gallery page
- design / green / build in templates
- non category pages for aux links
- rework contact page
- browser testing
----------------------------- */

html{
background-color: #eee;
}
div#custom-doc{
width:76.92em;
*width:75.07em;
min-width:1000px;
margin:auto;
text-align:left;
background: transparent url(../images/shadow.gif) bottom right repeat-y;
margin: 0 auto;
padding: 0 20px 20px 0;
}

div#bg{
background: #323232 url(../images/forturo-main-bg.gif) top left no-repeat;
}

#hd img#top-left{
float: left;
display: inline;
margin-left: 0;
}

/**
*
* home page
**/
body#home div#bg{
background-image: url(../images/home/home-bg.gif);
padding-bottom: 163px;

}

body#home img#top-stripes {
position: relative;
top: 12px;
}

body#home .design-button:hover {
color: #0089ee;
}

body#home .outdoor-button:hover{
color: #7bdb00
}
body#home .build-button:hover{
color: #ff6c00;
}

body#home #bd div.first div{
padding-top: 105px;
margin-left: 128px;
}

body#home .yui-gd .second{
padding-top: 0;
position: relative;
top: -2px;
left: 122px;
background-color: transparent;
width: 858px;
}

body#home .yui-gd .second img#mainimage{
display: block;
}

body#home img#desc{
display: block;

}

/* content pages - white bg */
.second{
padding-top: 1px;
overflow: hidden;
left: 2px;
}


.yui-gd .second .content{
background-color: #fff;
min-height: 546px;
margin-left: 10px;
padding: 11px 10px 10px 20px;
}

div#pngwrap {
position: relative;
left: 402px;
top: -42px;
width: 596px;
height: 1px;
overflow: visible;
text-align: right;
}

ul#categorynavImage {
position: relative;
left: -2px;
}

img.hide {
display: none;
}

body#home img#orange, body#home img#blue, body#home img#green{
position: relative;
overflow: visible;
z-index: 10;
left: 2px;
}

body#home img#green, body#home img#green-button{
left: -125px;
}


body#home img#blue, body#home img#blue-button{
position: relative;
left: -249px;
}


.button {
display: block;
float: left;
width: 150px;
height: 55px;
text-indent: -9999px;
margin-top: 84px;
margin-right: 10px;
position: relative;
left: -5px;
z-index: 11;
}

#textholder {
width: 448px;
height: 29px;
position: relative;
left: 141px;
top: 10px;
background-position: top left;
background-repeat: no-repeat;
}


/* custom widths for body row */
.yui-gd div.first{
width: 39.75%;
}

.yui-gd .yui-u{
width: 58.25%;
}

/*
header
*/
img#home-link{
float: left;
position: relative;
top: -44px;
left: 40px;
}

#hd img{
display: block;
margin-left: 619px;
clear: left;

}

#hd ul li {
display: inline;
}

#hd ul li a{
color: #cccccc;
text-decoration: none;
font-size: 10px;
display: block;
float: left;
text-transform: uppercase;
color: #808080;
padding: 30px 15px 0 15px;
}


#hd ul#aux{
margin: 0 0 30px 632px;
text-align: right;
}

#home ul#aux {
margin-bottom: 31px;
}

#hd #categorynav {
margin-left: 127px;
}


#hd ul#categorynav li{
display: inline;
}

#hd ul#aux li a:hover{
background: transparent url(../images/nocat-aux-hover-bg.gif) top center no-repeat;
color: #fff;
}

body#design #hd ul#aux li a:hover, body#home #hd ul#aux li a.outdoor-button:hover{
background-image: url(../images/build-aux-hover-bg.gif);
}

body#green #hd ul#aux li a:hover, body#home #hd ul#aux li a.outdoor-button:hover{
background-image: url(../images/outdoor-aux-hover-bg.gif);
}

body#build #hd ul#aux li a:hover, body#home #hd ul#aux li a.build-button:hover{
background-image: url(../images/aux-hover-bg.gif);
}

#hd ul#categorynav{
margin-left: 145px;
padding-top: 20px;
}

#hd ul#categorynav li{
padding-right: 30px;
}

#hd ul#categorynav li a{
font-size: 14px;
text-transform: uppercase;
color: #808080;
}


/* section and hover states */
#hd ul#categorynav li a#hdr-design:hover, body#design #hd ul#categorynav li a#hdr-design{
color: #0193e8;
}

body#build #hd ul#categorynav li a#hdr-build, #hd ul#categorynav li a#hdr-build:hover{
color: #f77419;
}

body#green #hd ul#categorynav li a#hdr-outdoor, #hd ul#categorynav li a#hdr-outdoor:hover{
color: #97ce00;
}


h1{
text-indent: -9999px;
height: 1px;
}


/* body row */
.yui-gd{
margin-top: 12px;
}

/**
* nav
**/
#bd .yui-gd .nav div{
margin-top: 37px;
margin-left: 136px;
}

#bd .yui-gd .nav ul{
min-height: 234px;
margin-top: 12px;
width: 278px;
background: transparent url(../images/nav-bg.gif) top left no-repeat;
padding-top: 4px;
}

#bd .yui-gd .nav ul li{
background: transparent url(../images/nav-bg.gif) bottom left no-repeat;
padding: 1px 0 6.75px 15px;
}

#bd .yui-gd .nav ul li a{
color: #92928f;
text-decoration: none;
text-transform: uppercase;
font-size: 85%;
}


/* nested nav */
#bd .yui-gd .nav ul li ul{
background-color: transparent;
background-image: none;
min-height: 10px;
margin-top: 0;
width: 272px;
position: relative;
left: -13px;
}

#bd .yui-gd .nav ul li ul li{
padding: 6.75px 0 1px 23px;
background-position: top left;
}

#bd .yui-gd .nav ul li ul li a{
background: transparent url(../images/nav-indicator.gif) 0 5px no-repeat;
padding: 2px 2px 2px 10px;
display: block;
color: #fff;
}

#bd .yui-gd .nav ul li ul li a:hover{
background-image: url(../images/nav-indicator-active.gif);
}

body#design #bd .yui-gd .nav ul li ul li a:hover{
background-image: url(../images/nav-indicator-design-active.gif);
}


/* link hover - sections */
body#green #bd .yui-gd .nav ul li a:hover{
color: #97ce00;
}

body#build #bd .yui-gd .nav ul li a:hover{
color: #f77419;
}

body#design #bd .yui-gd .nav ul li a:hover{
color: #0193e8;
}


#bd .yui-gd .nav img#latest-news {
position: relative;
left: 5px;
margin-top: 25px;
}


#bd .yui-gd .nav img#phone-number {
position: relative;
left: -120px;
top: -22px;
}

img#categoryimage {
margin-top: -80px;
position: relative;
left: -119px;
top: -29px;
}


/* ---------------------------
content area
------------------------------ */
.content h2{
font-size: 47px;
font-weight: normal;
color: #f88635;
margin-top: 19px;
background: #fff url(../images/dots.gif) bottom right no-repeat;
position: relative;
left: 13px;
margin-left: -13px;
}

.content strong {
font-weight: bold;
}

.content h2 + img {
display: block;
margin-top: 10px;
position: relative;
left: 1px;
}

/* header colous for each section */
body#build .content h2{ color: #0193e8;}

body#green .content h2{
color: #97ce00;
}


div.backtotop{
margin-top: 20px;
background: #fff url(../images/backtotop-bg.gif) center right no-repeat;
position: relative;
left: 14px;
}

div.backtotop a{
color: #808080;
font-weight: bold;
text-decoration: none;
font-size: 90%;
padding-left: 15px;
background: #fff url(../images/backtotop-arrow.gif) center left no-repeat;
position: relative;
left: -14px;
}

div.backtotop a:hover{
color: #3f3f3f;
}

/* general text styles */
.content *{
font-family: trebuchet, "trebuchet MS", helvetica, sans-serif;
color: #3b3b3b;
}

.content p{
margin: 10px 0;
}

.content .text, .content textarea {
margin-bottom: 10px;
width: 200px;
}

.content h4{
font-weight: bold;
text-transform: uppercase;
}


/* ---------------------------
gallery pages
------------------------------ */
.gallery strong{
font-weight: normal;
}

body#design .gallery strong {
color: #0193e8;
}

body#build .gallery strong {
color: #F77419;
}

body#green .gallery strong {
color: #8fe000;
}

.gallery #ImageGallery table td {
padding: 0 16px 16px 0;
}

/* ----------------------------
blog
----------------------------- */
h4 a{text-decoration: none}
h4 a:hover{text-decoration: underline}
span.authorDate{
color: #FFBE8F;
}


p#copyright {
width: 1000px;
text-align: left;
}


/*
* filters
**/

/* webkit */
@media screen and (-webkit-min-device-pixel-ratio:0){
/* shift content area right a touch */
.yui-gd .second{
position: relative;
left: 2px;
}

/* shift home rollover images left 1px each*/

}

/* opera 9.5+ */
@media all and (-webkit-min-device-pixel-ratio:10000), not all and (-webkit-min-device-pixel-ratio:0) {
/* home - rotating images and floating png's */
:root body#home .yui-gd .second{
left: 6px; top: 12px;
}

:root body#home img#top-stripes{
top: 26px;
}

:root .yui-gd .second{
position: relative;
left: 11px;
}

}

/* ie 7 */

/* stop nav dropping down */
* + html #bd .yui-gd .nav ul, * + html #bd .yui-gd .nav ul li ul{
width: 262px;
}

* + html div.backtotop {
left: 12px;
}

希望有人能帮助我,提前谢谢

最佳答案

2.4 到 3.1 在兼容性方面是一个相当大的飞跃……您是否阅读了升级指南?首先阅读 2.4 -> 3.0 指南可能会有用。 http://docs.silverstripe.org/en/3.0/changelogs/3.0.0/

也不确定这是在做什么...

function extension(){
return Page_Controller::extension();
}

关于php - SilverStripe 主题无法识别主页主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28124536/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com