Hi,

1)I have a page, the path is "main/param_name1/value1/param_name2/value2"
2)I have a link on this page, say "add new story"
3)When I click this link, it leads to node/add/story

What I want to do is :

After submit the story, I want to return back to "main/param1/value1/param2/value2" automatically, or give a link which enable me to go back.

I have no idea how to do this. Any suggestions? Thanks.

Hang

Comments

foredoc’s picture

Any one know this?

foredoc’s picture

Is this possible?

ghumpley’s picture

Create a block to put your "Add new story" link in, and only show it for the roles you want to be able to add new stories to your site.

Then put this in the block

return l("Add new story", "node/add/story", NULL, drupal_get_destination());

Make sure you select php code as the input format and that should be it!

G

foredoc’s picture

It seems not working(error occured). I checked the "l" function,
http://api.drupal.org/api/function/l/6
There is only three parameters as input.

:(

haroon373’s picture

I don't know how to write the patch file, but I write the simple steps to do this

FILE: include/commen.inc

/**
 Alter the l() function to add the functionality of query string bind with URL 
 */

CHANGE 1: 
---------
Line: ~1535
- function l($text, $path, $options = array()) {
+ function l($text, $path, $options = array(), $query = NULL) {
// Pass new paramter to add the query string with url

CHANGE 2: 
---------
Line: ~1539
- $options += array(
      'attributes' => array(),
      'html' => FALSE,
    );
+ $options += array(
      'attributes' => array(),
      'html' => FALSE,
      'query' => FALSE,
    );
// add query paramter in array on options

CHANGE 3: 
---------
Line: ~1556
+ if($query) {
+    $options['query'] = $query;
+ }
// assign query paramter to options array

now, when you will pass the forth parameter that is query like:

print l("Login", 'login', array(), 'user=me')

Then it will output like:

<a href="example/login?user=me">Login</a>

Hope this will help someone