Location: PHPKode > projects > Enigma > Enigma2/Enigma2_Install/Themes/Enigma/portal/Articles.template.php
<?php

function template_Art_above()
{
	global $context;

	if ($context['thisAction'] == 'aarticle' || $context['thisAction'] == 'earticle')
	{
		echo '';
	}
	else
	{
		echo '
		<table width="100%" cellpadding="3" cellspacing="0">
			<tr>
				<td><a name="top"></a>', theme_linktree(), '</td>
			</tr>
		</table>';
	}
}
function template_Art_below(){}

function template_archive_body()
{
	global $context, $txt, $scripturl, $settings;

	echo '
<div class="sitenews" style="float: left; width: 100%;">';

	// Something went coocoo for cocoa puffs...
	if (!empty($context['arterror']))
	{
	echo '
	<table width="100%" border="0" cellspacing="1" cellpadding="4">
		<tr>
			<td colspan="2">
				<h1><b>' . $context['arterror'] . '</b></h1>
			</td>
		</tr>';
	}

	// Display category list
	elseif (!empty($context['iscats']))
	{
		echo '
	<table width="100%" border="0" cellspacing="1" cellpadding="4">
		<tr>
			<td colspan="2">
				<h1><b>' . $txt['art07'] . '</b></h1><br />
				' . $txt['art10'] . '
			</td>
		</tr>';
		$cl = 0;
		foreach ($context['artsecs'] as $cat) // loop through the categories
		{
			// Left column
			if ($cl == 0)
			{
				echo '
		<tr>
			<td>
				<br /><br />
				' . $cat['image'] .' [<a href="' . $cat['href'] . '"><b>' . $cat['title'] . '<b>]</a></td>';
			$cl++;
			}
			
			// Right column
			elseif ($cl == 1)
			{
				echo '
			<td>
				<br /><br />
					' . $cat['image'] .' [<a href="' . $cat['href'] . '"><b>' . $cat['title'] . '<b>]</a>
			</td>
		</tr>';
			$cl = 0;
			}
		}
	echo '
	</table>';

	unset($cl);
	}

	// We're only showing 1 Section, and the articles that go with it. 
	elseif (!empty($context['isarchive']))
	{
		// Show the sections image and title.
		foreach ($context['artsec'] as $sec)
		{
		echo '
		<div>
			<a href="' . $sec['href'] . '">' . $sec['image'] . '</a>
			<br /><br />
			<b>[<a href="' . $scripturl . '?op=Articles;sa=archive" alt="' . $txt['art07'] . '">' . $txt['art07'] . '</a>] :: <a href="' . $sec['href'] . '"><i>' . $sec['title'] . '</i></a></b>
		</div>
		<br /><br />
		<div>';
		}
		
		foreach ($context['sitearticles'] as $archive)
		{
			echo '
			<ul>
				<li>
					' . $archive['story'] . '<br />
					<strong>' . $txt['art08'] . ':</strong> ' . $archive['author'] . '
					<strong>' . $txt['art09'] . ':</strong> ' . $archive['time'] . '
				</li>
			</ul>';
		}
		
		echo '
		</div>
		<p>' . $context['art_pages'] . '</p>';
	}

	// Closes opening div,  that opens before if/else checks 
	echo '
</div>';

}
	

function template_Article_body()
{
	global $context, $txt, $scripturl, $settings;

	echo '
<!-- div class="featured" style="float: right; width: 120px; margin-left: 5px;"><strong>', isset($context['articleSum']), '</strong></div -->';

	echo '
	<script language="JavaScript1.2" type="text/javascript"><!--
		function DoConfirm(message, url)
		{
			if (confirm(message))
				location.href = url;
		}
	//--></script>
<div class="sitenews" style="float: left; width: 100%;">';


	if (!is_array($context['sitearticles'])) // if there isn't anything or something went wrong, display msg or nothing
		echo $context['sitearticles'];
	else
		foreach ($context['sitearticles'] AS $post)
		{
			// if Article reviewer, setup the status display
			if (isset($post['status']) &&  $post['status'] != '') // for some reason when setting variables, a comma causes parse errors
				$status = '<strong>** ' . $txt['art11'] . ':</strong> ' . $post['status'] . '<br />';
			else
				$status = '';					

// Note: if you would like to only show the Article Section name, instead of linking to it, change $post['SecLink'] to $post['SecName'] below.
			echo '
	<div class="tborder" style="margin-bottom: 5px;">
		<table border="0" cellpadding="0" cellspacing="1" width="100%">
			<tr class="titlebg">
				<th style="text-align: left; padding: 3px;"><small>' . $status . '
					[' . $post['SecLink'] . '] <a href="'. $post['arthref'] . '">' . $post['heading'] . '</a>
					'. $txt[525] . ' ' . $post['author'] . '<br /> <i> ' . $post['subheading'] . '</i>
				</small></th>
				<th style="text-align: right; padding: 3px;"><small>' . $post['time'] . '</small></th>
			</tr><tr>
				<td style="float: left;" colspan="2">
					<a href="' . $post['href'] . '">' . $post['image'] . '</a> ' . $post['summary'] . '<br /><br />
					' . $post['story'] . '<br /><br />
					<hr />
				</td>
			</tr><tr>
				<td style="text-align: left; padding: 3px;">' . $post['updated'] . '</td>
				<td style="text-align: right; padding: 3px;">' . $post['reviewer'] . '</td>
			</tr>
		</table>
	</div>
	' . $context['articleConsole']
;
	
			unset($status);  // *** Note, this has to be here, or all messages will have the same status
		}


	echo '
	<br />
	<p>';
	
	if (!empty($context['art_pages']))
		echo '
		<b>' . $txt[139] . ':</b> ' . $context['art_pages'] . '<br />';
	
	if (empty($context['home_page']))
	{
		echo '
		<br />
		<a href="' . $scripturl . '?op=Articles;sa=archive">Article Archive</a>';
	}
	
	echo '
	<br />
	</p>
	</div>';
}

function template_articleIndex()
{
	global $context, $scripturl, $txt;

	if (empty($context['filtercat']) || empty($context['Arts']))
		fatal_error('Articles have not been set up properly, or there are no Articles to display!');

	echo '
	  <script language="JavaScript1.2" type="text/javascript"><!--
	  function DoConfirm(message, url)
		{
			if (confirm(message))
				location.href = url;
		}
	  //--></script>
	<table width="100%" border="0" class="bordercolor" cellspacing="1" cellpadding="3" align="center">
		<tr>
			<td class="catbg" colspan="7"><div style="font-weight: normal">
				<form action="' . $scripturl . '?op=Articles;sa=index" method="post"><b>' . $txt['art420'] . '</b>
				<select name="stagef">';
	// Stage dropdown menu
	foreach ($context['artstage'] AS $opstage)
	{
		echo '
					<option ', $opstage['selected'],' value="', $opstage['stage'], '">', $opstage['option'], '</option>';
	}
	
	echo '
				</select><strong>Category: </strong>
					<select name="catfilter">';

	// Section dropdown menu
	foreach ($context['filtercat'] AS $section)
	{
		echo '
				<option ' . $section['selected'] . ' value="' . $section['value'] . '">' . $section['name'] . '</option>';
	}
	
	echo '
			</select> <input type="Submit" name="filter" value="' . $txt['art421'] . '">
			</form></div></td>
	  </tr>
		<tr>
			<td class="titlebg" align="center">', $txt['art485'], '</td>
			<td class="titlebg" align="center">', $txt['art464'], '</td>
			<td class="titlebg" align="center">', $txt['art424'], '</td>
			<td class="titlebg" align="center">', $txt['art425'], '</td>
			<td class="titlebg" align="center">', $txt['art426'], '</td>
			<td class="titlebg" align="center">', $txt['art427'], '</td>
			<td class="titlebg" align="center">', $txt['art428'], '</td>
		</tr>
';

	foreach ($context['Arts'] AS $arts)
	{
	 		echo '
		    <tr>
			 <td class="windowbg2"><font size="1">', $arts['title'], '</td>
			 <td class="windowbg2"><font size="1"><a href="', $scripturl, '?op=Articles;article=', $arts['ID_ARTICLE'], '">', $arts['heading'], '</td>
			 <td class="windowbg"><font size="1">';

				echo isset($Arts['subuser']['Email']) ?
			('<a href="mailto:' . $arts['subuser']['Email'] . '">' . $arts['subuser']['byline'] . '</a>') :
			('<a href="'.$scripturl.'?action=profile;u='.$arts['subuser']['url_'].'">'.$arts['subuser']['user'].'</a>');

			echo '</font></td>
			 <td class="windowbg2"><font size="1">' . $arts['subdate'] . '</font></td>
			 <td class="windowbg"><font size="1">';

				echo isset($arts['reviewer_id']) ?
			('<a href="'.$scripturl.'?action=profile;u='.$arts['reviewer_lk'].'">'.$arts['reviewer'].'</a>'): '';

			echo '</font></td>
			 <td class="windowbg2"><font size="1">'. $arts['status']. '</font></td>
			 <td class="windowbg2"><font size="1">'. $arts['moddate']. '</font></td>
		    </tr>';
	}

	echo '

	  <tr>
		  <td class="catbg" colspan="7"><div style="font-weight: normal">
		  <form action="' . $scripturl . '?op=Articles;sa=index" method="post"><b>' . $txt['art420'] . '</b>
		  	<select name="stagef">';
		foreach ($context['artstage'] AS $opstage)
		{
			echo '
				<option ', $opstage['selected'], ' value="', $opstage['stage'], '">', $opstage['option'], '</option>';
		}
	
	echo '
			</select><strong>Category: </strong>
			<select name="filter">';
		// Section dropdown menu
		foreach ($context['filtercat'] AS $section)
		{
			echo '
				<option ' . $section['selected'] . ' value="' . $section['value'] . '">' . $section['name'] . '</option>';
		}
		echo '
			</select> <input type="Submit" name="filter" value="' . $txt['art421'] . '">
			</form></div></td>
	  </tr>
	  </table>';
}
Return current item: Enigma