Records count and adding +1

3 posts by 1 authors in: Forums > CMS Builder
Last Post: September 18, 2012   (RSS)

Re: [kovali] Records count and adding +1

By kovali - September 18, 2012

Searching the forum I came up with this solution:

<ul class="tabs">
<?php $recordCount = 0; ?>
<?php foreach ($haakarmsystemenRecords as $record): ?>
<li><a href="<?php echo $record["#tab".++$recordCount];?>"><?php echo htmlencode($record['title']) ?></a></li>
<?php endforeach ?>
</ul>

The titles are showing ok now in the tabs, but the actual links are not working: Instead I get: "Notice: Undefined index: #tab1 in /home/ajkhydro/public_html/test.php on line 139"

Re: [kovali] Records count and adding +1

By kovali - September 18, 2012

Got it working now with this adjustment to the code:

<ul class="tabs">
<?php $recordCount = 0; ?>
<?php foreach ($haakarmsystemenRecords as $record): ?>
<li><a href="<?php echo "#tab".++$recordCount ?>"><?php echo htmlencode($record['title']) ?></a></li>

<?php endforeach ?>
</ul>