Thread: cosmetic issues
View Single Post
  #7  
Old 1st January 2007, 19:22
danf.1979 danf.1979 is offline
Senior Member
 
Join Date: Dec 2005
Location: Chile
Posts: 247
Thanks: 4
Thanked 3 Times in 2 Posts
Send a message via MSN to danf.1979
Default

When I want to return to the same place after inserting some data to mysql I do it this way, when processing the form

PHP Code:
if ($_POST["save_form"] == LAN_BUTTON_SAVE_AND_COME_BACK)
      
$api->redirect($api->tpl->turl("sameform", array("act" => "edit""id" => $api->db->insert_id())));

else 
$api->redirect($api->turl->("main.php")); 
Uhm, maybe the navigation could use something like that. turl function just worries about the session id and url vars:
PHP Code:
public function turl($url$url_vars=false)
{
    global 
$api$pn_info;

    
$tail "";

    if (
is_array($url_vars))
    {
        foreach (
$url_vars  as $var => $value)
            
$tail .= $var."=".urlencode($value)."&";

        
$tail substr($tail0strlen($tail) - strlen("&"));
    }

    if (
$tail != ""$tail "&".$tail;

    return 
$url."?s=".$pn_info["session"]["id"].$tail;

Is not ideal, but it could be done in some hours...
Reply With Quote