How to create a KAS Link / URL - getPath()

Since sections are generated dynamically, the URLs are also variable, which means you can't simply make a link to a page because eventually that URL won't be the same. So we need to find a way to generate a stable URL and get the link to a page.

For this task we will use the getPath() function. Get path takes different parameters:

 

getPath('SECTION','SUB SECTION','PAGE NAME','OPTION TYPES','ID VALUE');

 

OPTION TYPES and ID VALUE are optional if the page exists in _SECTIONS.php, if not an ID and an OPTION TYPE is required

getPath() will return the fill url including the .kas extension:

 

echo getPath('CONTENT','HOME CONTENT','ABOUT');

// returns /kas/op_ABOUT-2-6-31.kas,

 

2,6,31 are the ID;s of the section at the moment, but those values will change as new sections are generated

 

It is possible to add query strings like this:

 

getPath('CONTENT','HOME CONTENT','ABOUT')."?var=value";

 

To link to a page that has an ID, we will add the Option Types and ID, in the following example we have a link to the Client Profile page, the Option Types are required by the page and the ID is the ID of the client.

 

getPath('CLIENTS','CLIENTS','CLIENT PROFILE','VFEDLPSIUW','3524')

 

If we need to make a link to a page that doesn't exist in _SECTIONS.php and that doesn't require an ID, add '0' as the ID

 

getPath('CLIENTS','CLIENTS','VIEW PAYMENTS','VLCW','0');

 

If you need to link to a page with pagination, add the pagination values to the ID and skip the option types

 

getPath('CLIENTS','CLIENTS','VIEW QUOTES','','200-50-0');

 

If you need to add the option types make sure to start the ID with a dash '-'

 

getPath('CLIENTS','CLIENTS','VIEW QUOTES',VLCW','-200-50-0');

 

In the previous example it links to a View that shows 50 results per view and it is starting at position 200

Get a Quote

Get a Quote