CodeIgniter Forums
HTML on language lines - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: HTML on language lines (/showthread.php?tid=78065)



HTML on language lines - lucky - 11-25-2020

Is there any way to print HTML using language lines?

For example

PHP Code:
<?php

return [
    'lang' => [
        'in_intl' => 'PHP <a href="https://www.php.net/manual/en/book.intl.php" target="_blank">intl Extension</a>.',
        'in_libcurl' => 'PHP <a href="https://www.php.net/manual/en/book.curl.php" target="_blank">libcurl Extension</a>.',
        'in_mbstring' => 'PHP <a href="https://www.php.net/manual/en/book.mbstring.php" target="_blank">mbstring Extension</a>.',
        'in_json' => 'PHP <a href="https://www.php.net/manual/en/book.json.php" target="_blank">json Extension</a>.',
        'in_xml' => 'PHP <a href="https://www.php.net/manual/en/book.libxml.php" target="_blank">xml Extension</a>.',
        'in_mysqlnd' => 'PHP <a href="https://www.php.net/manual/en/book.mysqlnd.php" target="_blank">mysqlnd Extension</a>.',
    ],
]; 


PHP Code:
echo lang('requirements.lang.in_intl'); 

Currently this is producing the following
Code:
PHP <a href="https://www.php.net/manual/en/book.intl.php" target="_blank">intl Extension</a>.

I was expecting to get the parsed HTML

PHP intl Extension


RE: HTML on language lines - neoneeco - 11-25-2020

Hi
I don't know, I don't have the solution, but have you test some ideas :

echo (echo lang('requirements.lang.in_intl')); or print_r ? (or something like that ?)

or :
PHP Code:
$return lang('requirements.lang.in_intl');

$a = html_entity_decode($return);

echo 
$a


does the eval() function can be applied here ,


RE: HTML on language lines - lucky - 11-26-2020

neoneeco, I've tried that but did not work.

I should explain that I'm using the parser and I'm providing those language lines inside a parser loop.

For example:

PHP Code:
{languages}
    {
lang_line}
{/
languages

The parser is set to use raw data, so it should work. But it does not :/