\BHB::$link->ra(), \BHB::$link->raa()
To create a link usually we write:
<a href="www.sitename.com/eng/c_greet__the__world/wordsForSeo">The Link</a> <br />or<br /> <a href="eng/c_greet__the__world/wordsForSeo">The Link</a>
To create a link in BHBSoft there are some ways:
1. To create a new link is equal with the standard html, as written above.
2. To create a link based on actual uri.
Remember: \BHB::$link don't manages tha part of domain or subdomain name, only the eventual dirs and parameters.
Usually, we need to remove one/more and add one/more parameters.
\BHB::$link->ra("[RemoveVar]=", "[ADD=VAL/ADD2=VAL2]");
//"ra" means: Remove, Add.
\BHB::$link->raa( array("var="=>"val",...), array("var="=>"val",...) );
//raa means: Remove, Add, Array. So we may remove and add more in the same istruction.
Lets we consider the actual uri:
www.sitename.com/eng/c_greet__the__world/europe/city=Milan/Duomo/buy_ticket
in a php file ye usually write:
<a href="<?php print PUT_HERE_THE_SNIPPET_DOWN_TO_DO_PRACTICE ; ?>">The Link</a>
Examples: with \BHB::$link->ra("remove", "add");
It is a simple way and do not make a check if the var exist in the actual uri.
<?php //uri: sn.com/dir/subdir/eng/c_greet__the__world/europe/city=Milan/Duomo/where_to_buy_ticket //Change the Var city= from "Milano" to "Roma". print \BHB::$link->ra("city=","city=Roma")."<br />"; // sn.com/dir/subdir/eng/c_greet__the__world/europe/city=Roma/Duomo/buy_ticket //Caution print \BHB::$link->ra("", "city=Roma")."<br />"; // sn.com/dir/subdir/eng/c_greet__the__world/europe/city=Milano/Duomo/buy_ticket/city=Roma //so you will have two param city Milano and Roma and \BHB::$uri->get("city=") will return Milano. //This is not a logic error: You may need to costruct a link after a determinate va to use in the next script. //to Remove print \BHB::$link->ra("city="); // sn.com/dir/subdir/eng/c_greet__the__world/europe/Duomo/where_to_buy_ticket //to Add print \BHB::$link->ra("", "city=Roma/var=itsValue/otherVar=otherValue/wordForSEO/bla_bla_bla_")."<br />"; // sn.com/dir/subdir/eng/c_greet__the__world/europe/city=Roma/var=itsValue/otherVar=otherValue/wordForSEO/bla_bla_bla_/Duomo/where_to_buy_ticket //to Remove everything and add a new link print \BHB::$link->ra("*", "one=ONE/two=TWO")."<br />"; // sn.com/dir/subdir/one=ONE/two=TWO //to Remove all but not controller or router //Caution: This remove the vars on left side of controller or router, too. print \BHB::$link->ra("cr*", "one=ONE/two=TWO")."<br />"; // sn.com/dir/subdir/c_greet__the__world/one=ONE/two=TWO //to Remove all after the var city, but getting it as is. print \BHB::$link->ra("city=*", "one=ONE/two=TWO")."<br />"; // sn.com/dir/subdir/eng/c_greet__the__world/europe/city=Milan/one=ONE/two=TWO //to Remove all after the var without it. print \BHB::$link->ra("city=*^", "/one=ONE/two=TWO")."<br />"; // sn.com/dir/subdir/eng/c_greet__the__world/europe/one=ONE/two=TWO ?>
Examples with \BHB::$link->raa(); //Array to Remove and Array to Add.
//There are five cases for \BHB::$link->raa(); //Array to Remove("name"), Array to Add("name"=>"var"). //uri: sn.com/dir/subdir/eng/c_greet__the__world/europe/city=Milan/Duomo/where_to_buy_ticket //1. //home_page, without c_ or r_ and add these vaiables. print \BHB::$link->raa("*", array("p1"=>"v1", "p2"=>"v2", "p3"=>"v3"))."<br />"; // ns.com/dir/subdir/p1=v1/p2=v2/p3=v3 //2. //but here there is city in a previous position, then revaluate it without changing its position. print \BHB::$link->raa("", array("p1"=>"v1", "city"=>"Roma", "p3"=>"v3"))."<br />"; // ns.com/dir/subdir/eng/c_greet__the__world/europe/city=Roma/citta=Milano/Duomo/where_to_buy_ticket/p1=v1/p3=v3 //3. //delete all vars finded after city= but not the var city= in uri. print \BHB::$link->raa("city=*", array("p1"=>"v1", "p2"=>"v2", "p3"=>"v3"))."<br />"; // ns.com/dir/subdir/eng/c_greet__the__world/europe/city=Milan/p1=v1/p2=v2/p3=v3 //4. //will delete all uri finded after the var city together with the var city. print \BHB::$link->raa("city=*^", array("p2"=>"v2", "p3"=>"v3"))."<br />"; // ns.com/dir/subdir/eng/c_greet__the__world/europe/p2=v2/p3=v3 //5. //will delete all vars in first parameter array and will put the var uri. //If there is a var to remove and there is too in add than will revaluate not changing its position. print "=> ".\BHB::$link->raa(array("city","pb","pc"), array("p2"=>"v2", "p3"=>"v3", "city"=>"Roma"))."<br />"; // ns.com/dir/subdir/eng/c_greet__the__world/europe/city=Roma/citta=Milano/Duomo/where_to_buy_ticket/p2=v2/p3=v3
Examples with other \BHB::->$link tools:
// the uri // www.sn.com/dir/subdir/eng/c_greet__the__world/europe/city=Milan/Duomo/where_to_buy_ticket //to have only the c_ or r_ without any var or seo word. print \BHB::$link->cr()."<br />"; // www.sn.com/dir/subdir/c_greet__the__world //with uri: eng/r_greets/europe/city=Milan/Duomo/where_to_buy_ticket print \BHB::$link->cr()."<br />"; //prints: www.sn.com/dir/subdir/r_greets //with uri: eng/r_greets/europe/city=Milan/Duomo/where_to_buy_ticket print \BHB::$link->cr("c_other__controller__ction", "p1=v1/p2=v2")."<br />"; // www.sn.com/dir/subdir/c_other__controller__ction/p1=v1/p2=v2