Jump to:

23491 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » hard coding a javascript and text in an error page

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 534 Views
  • wake2010
    Avatar
    Community Member
    9 Posts

    hard coding a javascript and text in an error page Link to this post

    hey i have getting alot of good help from everyone here so i thought i would come here first

    i have a errorpage.ss file and what i want to do is this.
    below the content inserted using the backend i want to add a javascript:history.go(-1) in there but when i hard code it it does not look the same as the rest, any ideas how to do this

    (link is http://w1.advancetechuk.com/3/notfound) this goes direct to the page not found page

  • Nobrainer Web
    Avatar
    Community Member
    135 Posts

    Re: hard coding a javascript and text in an error page Link to this post

    If you are hardcoding in the template file (.ss) it will be output just as you type it.
    If you add javascript into the Content area (WYSIWYG editor) it will be broken i guess.
    If you want the JS to be added just below the rest of the text, you must hardcode it inside the <div id="Content" class="typography"> tag.

    Other than that please try to explain what you mean with, it does not look the same as the rest.

  • wake2010
    Avatar
    Community Member
    9 Posts

    Re: hard coding a javascript and text in an error page Link to this post

    well if you actually look at the error page link above you would notice what it does,
    I will be adding JS for a 3rd level menu but at present i just want the text to look the same and be below the $content part, however it displays in a <p> tag and then moves to the right of the $Content as if it was in a table

    as for the insert code bit do you mean like this

    ...
    <div id="Header">
                <h1>$Title</h1>
             </div>
             <div id="ContentContainer">
             <div id="Banner">
    </div>
    <div id="Content" class="typography">
             $Layout
          
              <p>Please click <a href="javascript:history.go(-1)">here to go back</a> and try again</p>
             </div>
             </div>
             <div id="Footer">
                <span>&copy;2012 Advancetech. All rights reserved. Design by Advancetech IT Services</span>
             </div>
    ...


    ? mind this is not a layout page its a main template

  • wake2010
    Avatar
    Community Member
    9 Posts

    Re: hard coding a javascript and text in an error page Link to this post

    Sorted!
    I went through the code again and realised 2 things
    1. there was no <div id="Content">
    2nd i had $layout in
    modified that and all is working goooddd
    your info helped alot

    534 Views
Page: 1
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.