Link's & URL's - Logaty

Link's & URL's Last updated: 26/12/2021

Create Link & URL with selected language OR force it to other language .

Introduction

Link class helps you to create links & url's with language parameter in easy.
you can find Links class in ./Logaty/Helpers/Link.php
there's only one public method called create($link = '', $lang = ''$).
this class helps you to clean url and rebuild it to set language parameter in easy.

Create Links

build url's & link with LOGATY
one function do everything.

<?php
    logaty()->link->create($link = '', $lang = '');
$link (Optional) the link you want to generate (or slug) .
$lang (Optional) the language for generated link.

IF $link parameter not sent (send empty string) that create link to same page.
IF $lang parameter not sent that create link to current language.

Examples:

<a href="<?php echo logaty()->link->create('', $language_code) ?>">My Link</a>

// real example
<a href="<?php echo logaty()->link->create('', 'en') ?>">this page in english language</a>


Generate Link to other Page with selected language

<a href="<?php echo logaty()->link->create('my_link') ?>">
    <?php logaty()->__("My Link")?>
</a>

// real example

<a href="<?php echo logaty()->link->create('/about_me') ?>">
    <?php logaty()->__("Go to About me Page in selected Language")?>
</a>


Generate Link to other Page with forced language

<a href="<?php echo logaty()->link->create('my_link', 'lang-code') ?>">
    <?php logaty()->__("My Link")?>
</a>

// real example

<a href="<?php echo logaty()->link->create('/about_me', 'ar') ?>">
    <?php logaty()->__("Go to About me Page in Arabic Language")?>
</a>