Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

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

hard coding a javascript and text in an error page


Reply


4 Posts   564 Views

Avatar
wake2010

Community Member, 9 Posts

11 January 2012 at 4:47pm

Edited: 11/01/2012 4:54pm

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 [url]http://w1.advancetechuk.com/3/notfound[/url]) this goes direct to the page not found page

Avatar
Nobrainer Web

Community Member, 137 Posts

12 January 2012 at 11:43am

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.

Avatar
wake2010

Community Member, 9 Posts

12 January 2012 at 12:09pm

Edited: 12/01/2012 12:14pm

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

Avatar
wake2010

Community Member, 9 Posts

12 January 2012 at 12:21pm

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