Next Page After Saving

What options do we have after saving a new item, the right next page depends on the type of the content that we are adding.

On every Action in KAS, VIEW, ADD, EDIT or DELETE, after the action is completed, we need to send the user to the next page. In order to determine best next page, we need to think about the reducing steps for the user and making KAS more efficient:

The variable to use for the next page is called $nexturl and it has the following format:

A) Relaod itself after submtting the form with $self_url

//$self_url is a predefined variable that contains the current url
$nexturl = $self_url;

 

B) set next_url manually to a KAS section

THE KAS URL FORMAT

<?php
//$KMID, $KSMID, $KSMOID ARE PREDEFINED VARIABLES OF THE CURRENT PAGE!!!
/******* VIEW PAGES / ADD PAGES  *****/

//THESE PAGES DON'T NEED AN ID AND THE OPTION TYPE IS ALREADY SETUP IN THE DATABASE
//$nexturl = "op_".FILE~NAME."-".KAS_MENU_ID."-".KAS_SUBMENU_ID."-".KAS_SUBMENU_OPTION_ID.".kas";
$nexturl = "op_".ADD~ITEM~PAGE."-".$KMID."-".$KSMID."-".$KSMOID.".kas";

/******* EDIT PAGES  *****/

//EDIT PAGES NEED AN ID AND AN OPTION TYPE (TO EDIT A NEWLY ADDED ITEM THAT DOENS'T HAVE AN ID YET, USE "self_edit"
//$nexturl = "op_".FILE~NAME."-".KAS_MENU_ID."-".KAS_SUBMENU_ID."-".PLACEHOLDER."_".ITEM_ID."_".OPTION_TYPES.".kas";
$nexturl = "op_".EDIT~PAGE."-".$KMID."-".$KSMID."-".$KSMOID."_1234_".FUSWP.".kas";

//THE PLACEHOLDER IS USUALLY THE KAS_SUBMENU_OPTION_ID OF THE PREVIOUS PAGE (FOR EXAMPLE THE PREVIOUS VIEW PAGE BEFORE GOING TO THE EDIT PAGE) or xxx (lowercase) can be used

?>

 

The getpath() function

<?php
/************ NEW ARRAY FORMAT ************/

$nexturl = getPath([      
'type' => 'self_edit', // self_edit or edit (Optional, only for edit pages)
'menuName' => 'BILLING', // required
'submenuName' => 'INVOICING', // required
'pageName' => 'EDIT INVOICE', // required
'optiontype' => $editoptiontype, //(Optional, only for edit pages or non KAS menu pages)
'id' => 1234, // (Optional, only for edit pages, self_edit will generate the id automatically)
'query'=> '?foo=var&foo2=var2' // (Optional)
]);


/************ DEPRECATED FORMAT ***********/
//$nexturl = getPath('MENU SECTION','SUBMENU SECTION','FILE NAME');
$nexturl = getPath('CONTENT','BANNERS','VIEW BANNERS');

//IF YOU NEED TO SE SEND AN ID AND OPTION TYPE

//$nexturl = getPath('MENU SECTION','SUBMENU SECTION','FILE NAME','OPTION TYPES','ID VALUE');
$nexturl = getPath('CONTENT','BANNERS','EDIT BANNER','FUS',1234);

?>

 

 

You can also append variables at the of any $next_url if necessary (deprecated, use new array format instead)

<?php

​$nexturl = "op_".EDIT~PAGE."-".$KMID."-".$KSMID."-".$KSMOID."_1234_".FUSWP.".kas?FOO=VAR";

$nexturl = getPath('CONTENT','BANNERS','EDIT BANNER','FUS',1234)."?FOO=VAR";

?>

 

  • USE type = 'self_edit' WHEN WE NEED TO CONTINUE EDITING THE NEWLY ADDED CONTENT 
  • WE USE type='edit' WHEN WE WANT TO GO TO ANOTHER EDIT PAGE WITH A DIFFERENT ID VALUE, IN SUCH CASE WE NEED TO SPECIFY THE ID VALUE