filtering record by type

2 posts by 2 authors in: Forums > CMS Builder
Last Post: November 26, 2018   (RSS)

By petrogus - November 19, 2018

Hi Everyone,

I would to filter 'myrecords' base on articleTypesRecords between tabs. I have two types of records and i want to filter at each tab - type.

At the moment 'myrecords' load at both tabs, could you help me please ?!

<?php
  list($articleRecords, $articleMetaData) = getRecords(array( 'tableName'   => 'myrecords',  
  'loadUploads' => true, 'allowSearch' => false, ));  
  
  list($articleTypesRecords, $articleTypesMetaData) = getRecords(array( 'tableName'   => 'rec_type', 'loadUploads' => true, 'allowSearch' => false, ));  

?>

<div class="tabs">
	<?php foreach($articleTypesRecords as $articleType) { ?>
        <div class="tab-item <?php if ($articleType['num'] == 1) { echo "tab-active"; } ?>">
          	<a class="tab-label <?php if ($articleType['num'] == 1) { echo "active-btn"; } ?>" data-url="<?php echo $articleType['num']; ?>"><?php echo htmlencode($articleType['title_'.$_SESSION['lang']]); ?></a>
			<div class="tab-content">
				<?php foreach($articleRecords as $articleItem) { $articleType = mysql_select("rec_type", "num = '".$articleItem['rec_type']."'"); $articleType = @$articleType[0]; ?>
				<article>
					<h3><a href="sample.php"><?php echo $articleItem['title']; ?></a></h3>
					<a href="blog.php&article=<?php echo $articleItem['num']; ?>">Read more</a>  
				</article>
				<?php } ?>
			</div>  
		</div>
	<?php } ?>	
</div>
PetroGus