I have a multi editor named images. Each record in the editor is an upload of an image. There is also a multi select list (checkboxes) using value of num and label of title coming from the tags editor
I have a multi editor named tags. Each record of the editor is a title of a tag name
I am displaying a grid of images for a portfolio.
I will create buttons above this grid / gallery using the tag names. These will filter the images (ads, photography, print, merch)
Typical portfolio gallery, right?
I'm trying to wrap my brain around this array stuff to be able to display the tags for now. Once that works, I can turn them into css classes for filtering out photos.\
I THINK I'm almost there? I can't get the tag names to display which I thought would be the easy part if I understand the rest of this right.
list($case_studiesRecords, $case_studiesMetaData) = getRecords(array(
'tableName' => 'case_studies',
'where' => whereRecordNumberInUrl(0),
'loadUploads' => true,
'allowSearch' => false,
'limit' => '1',
));
$case_studiesRecord = @$case_studiesRecords[0]; // get first record
if ($case_studiesRecord):
list($imageRecords, $imageMetaData) = getRecords(array(
'tableName' => 'image',
'where' => mysql_escapef('the_client = ?', $case_studiesRecord['the_client']),
'loadUploads' => true,
'allowSearch' => false,
));
endif;
list($tagsRecords, $tagsMetaData) = getRecords(array(
'tableName' => 'tags',
'loadUploads' => true,
'allowSearch' => false,
));
$tagsByNum = array_groupBy($tagsRecords, 'num');
//showme( $tagsByNum );
<?php foreach ($imageRecords as $record):?>
<?php $assignedTags = listValues_unpack($record['tags']);?>
<?php foreach ($assignedTags as $key => $value) : ?>
<?php if (array_key_exists($value, $tagsByNum) !== false): ?>
<?php echo htmlencode ($assignedTags [$key]['title']) ?> //illegal string offset 'title'
<?php echo htmlencode ($assignedTags [$value]['title']) ?> // Notice: Trying to access array offset on value of type null
<?php echo htmlencode ($assignedTags [$value]) ?> // Undefined offset: 11 , 13, etc. These tag num's seem right.
<?php endif ?>
<?php endforeach ?>
<?php endforeach ?>