'redirect' switch
Say, after creating a new story you want to redirect the user to the frontpage instead of presenting the rendered story. Because of editor actions are redirects built-in to the app source we need a snip of javascript to make it work the way we want.

We can use the <% response.message %> macro - it usualy displays status messages above the main content area, depending on the action and the success state of the action. That messages are strings, defined in the 'messages.properties' file of the blog-default language. [1]

E.g. successfully creating a new story sets the response.message to the value of 'confirm.storyCreate'.

This is just what we need to create our own redirect-hook. Whenever a new page is loaded, we check for the value of response.message and let our own action roll.

Example code works like so:

<html>
<head>
<script type="text/javascript">
var msg = "<% response.message %>";
function check_message() { if (msg == 'The story was created successfully.' || msg == 'Die Story wurde erfolgreich angelegt!') {window.location.href='<% site.url %>'}
}
</script>
</head>
<body onload="check_message();">
...
</body>
</html>


comment    

 
Online for 2323 days
Last update: 2008.05.09, 08:12
»Preparing for sodium amytal«
Youre not logged in ... Login
mks @ 25k posts     hohoo - looks like [mks] will see its 25.000th...
by KenoshaKid (2007.12.11, 15:53)
'redirect' switch Say, after creating a new story you want to redirect the user to...
by KenoshaKid (2007.12.02, 12:54)
Ich lass mich überraschen.
by kristof (2007.11.29, 10:33)
im endeffekt wirds nur ein JSON dataset geben, das dann mit scripts frei formatierbar...
by dm42 (2007.11.29, 09:51)
Ach, jetzt auch als "today". Wieviele Clouds wird's denn geben? (Ah, "Yesterday"!)
by kristof (2007.11.29, 09:15)

Oktober 2008
MoDiMiDoFrSaSo
12345
6789101112
13141516171819
20212223242526
2728293031
Dezember
... home
... topics
... Home
... Tags


... antville home

XML version of this page

Made with Antville
powered by
Helma Object Publisher