-3

I'd like to start editing a template, the template uses php to create an array. Is their documentation about how to only get an array for a certain category? Or are they channels? Sorry.

I can't modify the code too much, but simply need to get the entries from an archive category / channel.

    <h2><span>Selected Projects</span></h2>
  <ul id="project_list">
  <?php foreach ($entries_query->result_array() as $entry): ?>  <li>
      <h3><a href="/projects/<?= $entry['url_title'] ?>/"><?= $entry['title'] ?></a></h3>
      <?php if ($entry['rollover_image']): ?>
        {exp:imgsizer:size image="<?= str_replace('{filedir_1}', '/images/projects/', $entry['rollover_image']) ?>" width="320" alt="" quality="90"}
      <?php else: ?>
        {exp:imgsizer:size image="<?= $images[$entry['entry_id']] ?>" width="320" alt="" quality="90"}
      <?php endif; ?>
      <ul><?php 
        foreach ($categories_query->result_array() as $cat):
          if ($cat['entry_id'] == $entry['entry_id']) {
            echo '<li><span class="'.$cat['cat_url_title'].'">'.$cat['name'].'</span></li>';
          }
        endforeach; 
      ?></ul>
    </li>
  <?php endforeach; ?>

Thanks for any help.

2

Instead of using the PHP code for populating the entries of category/categories, you should use the channel entry tag like:

{exp:channel:entries channel="CHANNEL_NAME" category="CATEGORY_ID"}
    <P>{title}</P>
{/exp:channel:entries}

take a reference from here to get list of all the parameters and variables to be used with channel entry tag.

http://ellislab.com/expressionengine/user-guide/modules/channel/channel_entries.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.