URI Structures



This section will tell you how to use and edit URL data. The ZN Framework's example URL structure looks like this:

URL
http [s] : // yourdomain.com / [ project-name /] [ lang /] [ controller /] [ function /] [ param1 / param2 ... ]

 The above URL sections are reviewed step by step below.

 

 

# Section Headings


# HTTP / S

# HTTPS Conversion
# Capture HTTP

# Domain Name / Domain Name

# Capture with HTTP Value

# Project Name / Project Name

# Predefined Project Directory
# Nickname Usage
# Capture Project Directory

# Language / Lang

# Change of Language Value
# Active Language Capture

# Controller

# Capture Control Name

# Method / Function

# Capture Method Name

# Parameters / Parameters

# Capture Parameters

 

 

# HTTP / S


The URL :: site () method is used to create a URL in the ZN Framework . The predefined value of the URL that this method will generatehttp: // It is set.

echo URL::site('product/list');
http: // localhost / eip / example / product / list
HTTPS Conversion

When you set up your site security certificate, your links need to be converted to http den HTTPS. The following setting is sufficient for this.

File: Projects / Frontend / Config / Services.php -> uri: ssl
'ssl' => false
echo URL::site('product/list');
https: // localhost / eip / example / product / list
Capture HTTP

To get this value of the URL, you can use the following method.

echo Request::scheme();
http

 

 

# Domain Name / Domain Name


You can use the URL :: host () method to get this value .

echo Http::host();
localhost
Capture with HTTP Value

You can use the following method to capture the value of http: // localhost.

echo URL::host();
http: // localhost

 

 

# Project Name / Project Name


This is the section that contains the name of the project to run from the project directories in the / directory. There is no need to write if the directory to run is the predefined directory. You only need to type the directory name to run the other directories.

Run: localhost / Backend /

We have run Projects / Backend / directory above .

Predefined Project Directory

The project directory that is run by default is Projects / Frontend / . To change the predefined opening project directory, you can make the necessary setting from the following configuration file.

File: Settings / Projects.php -> directory: default
'default' => 'Frontend'
Nickname Usage

To access your project indexes, you can give them aliases to represent these directory names. Use the following configuration file to configure this setting.

File: Settings / Projects.php -> directory: others
'panel' => 'Backend'

After editing above, you can run the Backend / directory via the following URL .

Run: localhost / panel /

You can find detailed information on what this section is used for in the multi-project development department.

Capture Project Directory

You can use the following method to find out the name of the project directory being run on the URL.

echo CURRENT_PROJECT;
frontend

 

 

# Language / Lang


If this section is enabled in the configuration file, it becomes visible in the URL :: site () method. So this section is predefined. Indicates site's adjusted language value. You can activate this section from the configuration file below.

File: Projects / Frontend / Config / Services.php -> uri: lang
'lang' => true

After editing the above URL :: site () method produces the following output.

echo URL::site('product/list');
http: // localhost / en / product / list 
Change of Language Value

The Lang :: set () method is used to change this value .

Lang::set('tr');

echo URL::site('product/list');
http: // localhost / en / product / list 

This change is also possible if the URL is changed and operated by the URL.

Active Language Capture

The Lang :: get () method is used to catch the currently selected language shortening .

echo Lang::get();
t

 

 

# Controller


This section specifies which of the controllers in the Controllers / directory should be run in the ZN Framework . Explanation of this section was made in connection with MVC / Controller .

Capture the Controller Name

The CURRENT_CONTROLLER constant must be used to catch the controller name . With different methods this partition is reachable but gives the real controller name because it is not affected by these fixed routes.

echo CURRENT_CONTROLLER;
producti

 

 

# Method / Function


This section describes the function information of the controller expressed in the previous section. The use of this section is also explained in the MVC / Controller link.

Capture Method Name

The CURRENT_CFUNCTION constant must be used to capture the method name . This constant gives the actual function name that is being executed at that time. It is not affected by fixed rods.

echo CURRENT_CFUNCTION;
list

 

 

# Parameters / Parameters


This is the section used to send data to the controller method that is executed. This and all subsequent chapters are used for parameter submission.

Capture Parameters

The CURRENT_CPARAMETERS constant can be used to trap parameters . Apart from this constant, you can also define the parameters of the corresponding method and also the parameters with the sequential variables.

URL: localhost / product / list / 10/20 / example / value
output( CURRENT_CPARAMETERS );
0 => string '20' (length = 4 )
1 => string 'example' (length = 9 )
2 => string 'value' (length = 7 )