Combo code Hierarchical List

5 posts by 2 authors in: Forums > CMS Builder
Last Post: April 29, 2013   (RSS)

By esupport - April 26, 2013

Hi,

I create a "Category Menu" section and generat a combo code.

Here is the left site of the Combo code

<?php foreach ($ec_km_listRecords as $listRecord): ?>
<?php $isSelected = ($listRecord['num'] == $detailRecord['num']); ?>
<?php if ($isSelected) { print "<b>"; } ?>
<a href="<?php echo htmlencode($listRecord['_link']) ?>"><?php echo htmlencode($listRecord['name']) ?></a><br/>
<?php if ($isSelected) { print "</b>"; } ?>
<?php endforeach ?>

<?php if (!$ec_km_listRecords): ?>
No records were found!<br/><br/>
<?php endif ?>

How can I create it as a Hierarchical List item?   

Thanks!

Jac

-Jax H.

By esupport - April 26, 2013

Hi Gerg

I found the Hierarchical List combo code solution:

<ul>
<?php foreach ($categoryRecords as $categoryRecord): ?>
     <?php echo $categoryRecord['_listItemStart'] ?>
        <?php if ($categoryRecord['_isSelected']): ?>
          <b><a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a></b>
          <?php else: ?>
       <a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a>
     <?php endif; ?>
   <?php echo $categoryRecord['_listItemEnd'] ?>
<?php endforeach; ?>
</ul>

Thanks a lot for your help!

Jac

-Jax H.

By esupport - April 26, 2013

Hi Gerg

sorry again!

I have setted correct List Page Url & Detail Page Url on my cmsAdmin Viewer Urls.

I found I couldn't get the detail page for my combo code.

The attachment is my code.

Please kindly help.

Thanks!!

Jac

-Jax H.
Attachments:

categorylist_008.php 3K

Morning Jac,

The issue was that nothing was set to the $selectedCategory value in page. I've changed your system so that the detailed record for the page is retrieved using a getRecords function:

  // load record from 'blog'
  list($categoryDetail, $blogMetaData) = getRecords(array(
    'tableName'   => 'category',
    'where'       => whereRecordNumberInUrl(0),
    'loadUploads' => true,
    'allowSearch' => false,
    'limit'       => '1',
  ));
  $categoryDetail = @$categoryDetail[0]; // get first record
  if (!$categoryDetail) { dieWith404("Record not found!"); } // show error message if no record found

Then I've replaced the selectedCategory data with categoryDetail:

      <td valign="top">
        <?php if (!$selectedCategory): ?>
        No record selected
        <?php endif; ?>
        <?php if ($categoryDetail): ?>
        <h3><?php echo $categoryDetail['name'] ?></h3>
        <?php echo $categoryDetail['content'] ?>
        <?php endif; ?></td>

I've attached my updated code to this post.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com