Jump to content

Joomla дополнительное поле list


Recommended Posts

Есть код который выводит список в строчку через запятую:  значение1, значение2, значение 3....

$fieldValue = (array) $fieldValue;
$texts      = array();
$options    = $this->getOptionsFromField($field);

foreach ($options as $value => $name)
{
	if (in_array((string) $value, $fieldValue))
	{
		$texts[] = JText::_($name);
	}
}


echo htmlentities(implode(', ', $texts));

Знатоки php, помогите! Как сделать как сделать чтоб это список выводился с помощью ul li ? Заранее спасибо!

Link to post
Share on other sites
$fieldValue = (array) $fieldValue;
$texts      = array();
$options    = $this->getOptionsFromField($field);

foreach ($options as $value => $name)
{
	if (in_array((string) $value, $fieldValue))
	{
		$texts[] = JText::_($name);
	}
}


#echo htmlentities(implode(', ', $texts));

<ul>

foreach ($texts as $key => $value){

     echo '<li>'.$value.'</li>';

}

</ul>

Link to post
Share on other sites
21 час назад, desg сказал:

$fieldValue = (array) $fieldValue;
$texts      = array();
$options    = $this->getOptionsFromField($field);

foreach ($options as $value => $name)
{
	if (in_array((string) $value, $fieldValue))
	{
		$texts[] = JText::_($name);
	}
}


#echo htmlentities(implode(', ', $texts));

<ul>

foreach ($texts as $key => $value){

     echo '<li>'.$value.'</li>';

}

</ul>

К сожалению не работает....

Link to post
Share on other sites
$fieldValue = (array) $fieldValue;
$texts      = array();
$options    = $this->getOptionsFromField($field);

foreach ($options as $value => $name)
{
	if (in_array((string) $value, $fieldValue))
	{
		$texts[] = JText::_($name);
	}
}


#echo htmlentities(implode(', ', $texts));

?>

<ul>

<?php

foreach ($texts as $key => $value){

     echo '<li>'.$value.'</li>';

}

?>

</ul>

 

Вот так попробуй

Link to post
Share on other sites
Только что, desg сказал:

$fieldValue = (array) $fieldValue;
$texts      = array();
$options    = $this->getOptionsFromField($field);

foreach ($options as $value => $name)
{
	if (in_array((string) $value, $fieldValue))
	{
		$texts[] = JText::_($name);
	}
}


#echo htmlentities(implode(', ', $texts));

?>

<ul>

<?php

foreach ($texts as $key => $value){

     echo '<li>'.$value.'</li>';

}

?>

</ul>

 

Вот так попробуй

Этот код ошибку не выдает, но ничего не выводит.... пусто!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...