Sign in to follow this  
Followers 0
limonchik

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

6 posts in this topic

Есть код который выводит список в строчку через запятую:  значение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 ? Заранее спасибо!

Share this post


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>

Share this post


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>

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

Share this post


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>

 

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

Share this post


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>

 

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

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.