开发者

Go to anchor point in Dreamweaver server behavior

I´m using a Dreamweaver s开发者_如何学Pythonerver behavior to create an insert into a MySQL database with PHP. In the pop-up menu to configure the insert, I have the option to go to a specific page after that.

I need to:

1) Go to a specific anchor point in some page, and

2) Show a message after the insert.

The problem is that I write page.php#anchor in the goto field, and it doesn´t work, because the result outputs page.php#anchor?, with a final interrogation mark. The original Dreamweaver code for this is:

  $insertGoTo = "page.php#anchor";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }

So, how can I solve this?


Add the anchor at the end instead of the beginning

$insertGoTo = "page.php";
if (isset($_SERVER['QUERY_STRING'])) {
  $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
  $insertGoTo .= $_SERVER['QUERY_STRING'];
}
$insertGoTo .= "#anchor";

Or if you know you won't have a query string to pass along, delete all that logic for keeping it.

$insertGoTo = "page.php#anchor";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜