0

i have a code in php from joomla. its array of languages.. and it shows all languages. how to change this code to display only the first of the language in array with all params as they are here??

thank a lot

<?php foreach ($list as $language) : ?> <a href="<?php echo htmlspecialchars_decode(htmlspecialchars($language->link, ENT_QUOTES, 'UTF-8'), ENT_NOQUOTES); ?>"> <?php echo $params->get('full_name', 1) ? $language->title_native : strtoupper($language->sef); ?> </a> <?php endforeach; ?> 
2
  • 1
    Not sure what $list looks like, but if you only want the first one, just use $list[0] Commented Jun 5, 2020 at 12:47
  • use $list[0] where? if i use it here <?php foreach ($list[0] as $language) : ?> it dont work Commented Jun 5, 2020 at 13:12

1 Answer 1

0

ok. i get it.. its change foreach to

$language = $list[0]; 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.