Documentation

helpers.php

Global helper functions for LWT.

These functions are available throughout the application and provide convenient shortcuts for common operations.

PHP version 8.1

Tags
category

Lwt

author

HugoFara hugo.farajallah@protonmail.com

license

Unlicense http://unlicense.org/

link
https://hugofara.github.io/lwt/docs/php/
since
3.0.0

Table of Contents

Functions

url()  : string
Generate a URL with the application base path prepended.
base_path()  : string
Get the configured application base path.

Functions

url()

Generate a URL with the application base path prepended.

url([string $path = '/' ]) : string

Use this for all internal links to ensure they work correctly when the application is installed in a subdirectory.

Parameters
$path : string = '/'

The path to generate URL for (should start with /)

Tags
example

url('/login') returns '/lwt/login' if APP_BASE_PATH=/lwt

example

url('/') returns '/lwt' if APP_BASE_PATH=/lwt

example

url('/assets/css/main.css') returns '/lwt/assets/css/main.css'

Return values
string

The full URL path with base path prepended

base_path()

Get the configured application base path.

base_path() : string
Return values
string

The base path (e.g., '/lwt') or empty string for root


        
On this page

Search results