Phpbb loops

Hello, trying to create a loops statement in phpbb, but when it appears in html on the site, some of the content is missing, for example, here is the code:

<!-- BEGIN anime -->
		 <div class="anime">
		 <!-- IF BEGIN img -->
		{anime.img.IMG}
		 <!-- ENDIF -->
			<h2>{anime.ANIME_NAME}</h2>
			<p>{anime.ANIME_DESC}</p>
		</div>
		<!-- END anime -->

and heres the result:

<div>
		 
		<img src="images/anime_shows//Guilty_Crown.jpg" alt="Guilty_Crown.jpg" width="80px;" height="100px" />
		 
			<h2></h2>
			<p></p>
		</div>
		
		 <div>
		 
		<img src="images/anime_shows//Oh_My_Goddess.jpg" alt="Oh_My_Goddess.jpg" width="80px;" height="100px" />
		 
			<h2></h2>
			<p></p>
		</div>
		
		 <div>
		 
			<h2>Ai Yori Aoshi</h2>
			<p>Kaoru Hanabishi, a college student who lives alone, met a beautiful but bewildered girl dressed in kimono at train station. He volunteered to guide her way to the address she was looking for, which looked like in his neighborhood but turned out to be an empty lot. Not knowing what to do next, Kaoru invited the devastated girl to his apartment and asked for additional clue -- a photo with two children whom Kaoru immediately identified as himself and Aoi Sakuraba, his childhood friend. It turned out that the girl in front of him is Aoi Sakuraba herself, his betrothed fiancée who came all the way to Tokyo to marry him. Her revelation was not only surprising but also reminded the deepest part of Kaoru's memory for why he left the Hanabishi family in the first place.</p>
		</div>
		
		 <div>
		 
			<h2>Oh My Goddess!</h2>
			<p>Keiichi Morisato is a good-natured, yet hapless and girlfriend-less college sophomore who is often imposed upon by his elder dorm-mates and brow-beaten into taking phone messages and doing other chores for them. One day, while alone in his dorm, he accidentally calls the Goddess Technical Help Line and a beautiful goddess named Belldandy materializes in his room. She tells him that her agency has received a system request from him, so she has been sent to grant him a single wish. Skeptical and thinking someone is playing a practical joke on him, he wishes that she stay with him forever. To his surprise, his wish is granted. Belldandy must stay with him, but as his dormitory is strictly male-only, they are both forced onto the street. They set off on his motorcycle to find alternative shelter, eventually seeking cover in an old Buddhist temple. In the morning, they are greeted by the temple's sole inhabitant, a young monk, who welcomes them and gives them permission to stay until they c</p>
		</div>
		
		 <div>
		 
			<h2>Guilty Crown</h2>
			<p>After the spread of the "Apocalypse Virus" in Japan in the year 2029, the country has been placed in an emergency state. Since the spread of the virus, the Japanese government lost all of its foundations, and the reign of the international organization known as GHQ began ruling the country. Now Japan is in a state of martial law, which is enforced by the GHQ, and is considered a "quasi-independent" nation.  10 years pass, and we see the story through the eyes of Shu Ouma, an average 17-year-old teenager who lives a normal life. However, his normal life style is soon shattered after his chance encounter with Inori Yuzuriha, who eventually involves him with the anti-government group she is a part of, known as Funeral Parlor, or Undertaker.</p>
		</div>
		
		 <div>
		 
			<h2></h2>
			<p></p>
		</div>
		</div>

Could you please post the actual PHP template code that controls the loop values as the template HTML doesn’t help us to help you.

Sorry bout that, here it is:

$dir =			'images/anime_shows/';
$file_display = array('jpg', 'jpeg', 'png', 'gif');


if (file_exists($dir) == false)
{
echo 'Folder \\'', $dir, '\\' not found!';
}
	else
	{
	$dir_contents = scandir($dir);

		foreach ($dir_contents as $file)
		{
		$file_type = strtolower(end(explode('.', $file)));
			
				if ($file !== '.' && $file !== '..' && in_array($file_type, $file_display) == true)
				{
				$animeimg = '<img src="' . $dir . '/' . $file . '" alt="' . $file . '" width="80px;" height="100px" />';
				
				$template->assign_block_vars('anime.img', array(
					'IMG'	=> $animeimg,
					));
				}
		}
	}

$sql = "SELECT name, description FROM phpbb_anime" ;
$result = $db->sql_query($sql);

while ($row = $db->sql_fetchrow($result))
{
	$template->assign_block_vars('anime', array(
		'ANIME_NAME'	=> $row['name'],
		'ANIME_DESC'	=> $row['description'],
	));
}

I’m a little confused as to why your creating a separate block array to store the anime images as you can’t start one loop then attempt to intercept another, the only way to do what you want would be to include the IMG index within your MySQL while loop.

Sorry, I’m only a beginner at PHP, so what exactly is the IMG index? (feeling so stupid right now)