Jump to:

3445 Posts in 1031 Topics by 872 members

Template Questions

SilverStripe Forums » Template Questions » Changing background on each page without tons of templates

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2 3
Go to End
Author Topic: 5310 Views
  • evsoul
    Avatar
    Community Member
    36 Posts

    Re: Changing background on each page without tons of templates Link to this post

    Yeah I figured that would be a very vague error haha.

    I'll check server logs, but also how do I put the site in dev mode?

  • evsoul
    Avatar
    Community Member
    36 Posts

    Re: Changing background on each page without tons of templates Link to this post

    Ok, I put it into dev mode and this is the error I got in replacement.

    [Notice] Undefined index:
    POST /sites/carreramarble/BETA/images/index/Page/1/Background/EditImageForm

    Line 157 in /nfs/www/WWW_pages/gsarpy/gregsarpy.net/sites/carreramarble/BETA/sapphire/core/ClassInfo.php

    Source

    148    /**
    149     * @todo Improve documentation
    150     */
    151    static function ancestry($class, $onlyWithTables = false) {
    152       global $_ALL_CLASSES;
    153
    154       if(is_object($class)) $class = $class->class;
    155       else if(!is_string($class)) user_error("Bad class value " . var_export($class, true) . " passed to ClassInfo::ancestry()", E_USER_WARNING);
    156
    157       $items = $_ALL_CLASSES['parents'][$class];
    158       $items[$class] = $class;
    159       if($onlyWithTables) foreach($items as $item) {
    160          if(!DataObject::has_own_table($item)) unset($items[$item]);
    161       }
    162       return $items;
    163    }
    Trace

    ClassInfo::ancestry()
    Line 1364 of DataObject.php
    DataObject->db(Name)
    Line 1799 of DataObject.php
    DataObject->getField(Name)
    Line 109 of ViewableData.php
    ViewableData->__get(Name)
    Line 253 of File.php
    File->onBeforeWrite()
    Line 783 of DataObject.php
    DataObject->write()
    Line 737 of Image.php
    Image_Uploader->save(Array,Form,HTTPRequest)
    Line 241 of Form.php
    Form->httpSubmission(HTTPRequest)
    Line 129 of RequestHandler.php
    RequestHandler->handleRequest(HTTPRequest)
    Line 143 of RequestHandler.php
    RequestHandler->handleRequest(HTTPRequest)
    Line 119 of Controller.php
    Controller->handleRequest(HTTPRequest)
    Line 277 of Director.php
    Director::handleRequest(HTTPRequest,Session)
    Line 121 of Director.php
    Director::direct(/images/index/Page/1/Background/EditImageForm)
    Line 118 of main.php

    What do you think? Or do I need more?

  • evsoul
    Avatar
    Community Member
    36 Posts

    Re: Changing background on each page without tons of templates Link to this post

    Is there a way to assign a background image to each page by say ID number? i dunno.
    something that's less involving. i won't have the need for adding pages/backgrounds once the site is done.

  • DowntownScience
    Avatar
    Community Member
    7 Posts

    Re: Changing background on each page without tons of templates Link to this post

    Let me preface by saying that I'm not a programmer!

    I added the suggested code to both page.ss (templates root, not the one in layout) and page.php. I rebuilt/flushed and have the ability to add a background from CMS. I add the background without error and save the page, but when I refresh the page I do not see the background image.

    I have created multiple page types in template that call a specific banner image, ie...

    <% include SideBar %>
    <div class="content-container unit size3of4 lastUnit">
       <article>
          <div id="Banner">
             <h1><img src="themes/simple/images/Molecule2Banner.jpg" alt="Homepage image" /></h1>
          </div>
          <div class="content">$Content</div>
       </article>
          $Form
          $PageComments
    </div>

    Could this be interfering? I tried changing the page type to "page" which has been left at default settings but the banner image just goes away and I still don't see a background.

    Any help you can give is much appreciated.

    5310 Views
Page: 1 2 3
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.