<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title>Filter items by category</title>
        <link>https://interactivetools.com/forum/forum-posts.php?Filter-items-by-category-80690</link>
        <description></description>
        <pubDate>Mon, 20 Apr 2026 06:05:24 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-posts.php?rss=1&amp;Filter-items-by-category-80690" rel="self" type="application/rss+xml" />

                <item>
          <title>Filter items by category</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2239489#post2239489</link>
          <description><![CDATA[<p>Actually, thanks so much for following up on that, because I can use the original approach on something else I have coming up.  :-)  That's going to come in really handy.</p>
<p>Thanks Daryl!</p>
<p>- Jeremy</p>]]></description>
          <pubDate>Thu, 01 Sep 2016 12:45:11 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2239489#post2239489</guid>
        </item>
                <item>
          <title>Filter items by category</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2239486#post2239486</link>
          <description><![CDATA[<p>It's a typo. I was typing too fast. It should be:</p>
<p><code>&lt;?php foreach ($records AS $record): ?&gt;</code></p>
<p>Anyway, I'm glad you got it working.</p>
<p>Cheers,</p>]]></description>
          <pubDate>Thu, 01 Sep 2016 09:18:24 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2239486#post2239486</guid>
        </item>
                <item>
          <title>Filter items by category</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2239482#post2239482</link>
          <description><![CDATA[<p>Well, I may not need help after all. :-)  I decided to change my method of presentation, which I based on this forum post: <a href="http://www.interactivetools.com/forum/forum-posts.php?postNum=2230107#post2230107" rel="nofollow">http://www.interactivetools.com/forum/forum-posts.php?postNum=2230107#post2230107</a></p>
<p>I'm actually much happier with this approach.  I'm not sure why I didn't think of it to begin with.  :-)  </p>
<p>So, everything is working perfectly now.  You can see it here: <a href="http://www.dwellingproductions.com/clients/cvrs/faq.php" rel="nofollow">http://www.dwellingproductions.com/clients/cvrs/faq.php</a></p>
<p>Thanks IT for this great forum!</p>]]></description>
          <pubDate>Wed, 31 Aug 2016 10:46:59 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2239482#post2239482</guid>
        </item>
                <item>
          <title>Filter items by category</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2239480#post2239480</link>
          <description><![CDATA[<p>Hi Daryl!</p>
<p>Thanks for your reply!  Unfortunately, I'm getting an error with this line:</p>
<p><code>&lt;?php foreach ($records =&gt; $record): ?&gt;</code></p>
<p>The error I'm receiving is: "syntax error, unexpected T_DOUBLE_ARROW"</p>
<p>I tried several things to fix it, but can't seem to get anywhere.  I've uploaded the PHP page I'm working with, in case you want to take a look.  Also, I've prepared a scaled back page (faq-simple.php), with all my other code stripped out, for testing purposes.  This page is viewable online here: <a href="http://dwellingproductions.com/clients/cvrs/faq-simple.php" rel="nofollow">http://dwellingproductions.com/clients/cvrs/faq-simple.php</a></p>
<p>I've also posted some screenshots of my CMSB pages, to ensure that I'm referencing fields and editor content properly.</p>
<p>I appreciate any help.  :-)</p>
<p>- Jeremy</p>]]></description>
          <pubDate>Wed, 31 Aug 2016 08:13:46 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2239480#post2239480</guid>
        </item>
                <item>
          <title>Filter items by category</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2239479#post2239479</link>
          <description><![CDATA[<p>Hi Jeremy,</p>
<p>Use array_groupBy() function on your <span>faq_questions records array.<br />For example:<br /></span></p>
<p><code>$faqsTopicsToRecords= array_groupBy($faq_quesitons, 'topics:label', true);<br /><br />// to see how the new array looks like<br />showme($faqsTopicsToRecords);</code></p>
<p>Your foreach loop should now look something like this:</p>
<p><code>&lt;?php foreach ($faqsTopicsToRecords as $topic =&gt; $records): ?&gt;<br />  &lt;h1&gt;&lt;?php echo htmlencode($topic) ?&gt;&lt;/h1&gt;<br /><br />  &lt;?php foreach ($records as $record): ?&gt;<br />    &lt;p&gt;<br />      &lt;?php echo $record['question'] ?&gt;&lt;br&gt;<br />      &lt;?php echo $record['answer'] ?&gt;&lt;br&gt;&lt;br&gt;<br />    &lt;/p&gt;<br />  &lt;?php endforeach ?&gt;<br /><br />&lt;?php endforeach ?&gt;</code></p>
<p>Hope this helps!</p>
<p>Cheers,</p>]]></description>
          <pubDate>Tue, 30 Aug 2016 16:44:37 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2239479#post2239479</guid>
        </item>
                <item>
          <title>Filter items by category</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2239477#post2239477</link>
          <description><![CDATA[<p>Hello!</p>
<p>I am trying to do something similar to this post: <a href="http://www.interactivetools.com/forum/forum-posts.php?postNum=2217470#post2217470" rel="nofollow">http://www.interactivetools.com/forum/forum-posts.php?postNum=2217470#post2217470</a></p>
<p>Unfortunately, I can't seem to make this work and am reaching out for help to save my sanity.  :-)</p>

<p>Essentially, I am trying to arrange FAQ questions and answers underneath their respective category heading.  So, when working, it should appear like this.</p>
<p>Category 1</p>
<ul><li>Question 1<br />Answer 1</li>
<li>Question 3<br />Answer 3</li>
</ul><p>Category 2</p>
<ul><li>Question 2<br />Answer 2</li>
<li>Question 5<br />Answer 5</li>
</ul><p>Category 3</p>
<ul><li>Question 4<br />Answer 4</li>
<li>Question 6<br />Answer 6</li>
</ul><p>For this example, in CMSB, I have a multi editor where the client add questions (<strong>faq_questions</strong>) and they can select a category radio button which is supplied by a category multi-editor (<strong>faq_topics</strong>).</p>
<p>My full implementation will include toggles for each question, as seen here: <a href="http://dwellingproductions.com/clients/cvrs/faq.php" rel="nofollow">http://dwellingproductions.com/clients/cvrs/faq.php</a></p>
<p>But, for now, I've pared down the code to try and get it working before I add the toggle code.  You can see my "progress" here: <a href="http://dwellingproductions.com/clients/cvrs/faq2.php" rel="nofollow">http://dwellingproductions.com/clients/cvrs/faq2.php</a>  Right now, the topic headings display, but no questions and answers display.</p>
<p>The code I currently have is:</p>
<p><code>&lt;?php $questionsByTopic = array_groupBy($faq_questionsRecords, 'topic', true); ?&gt;<br /><br />&lt;?php foreach (getListOptions('faq_questions', 'topic') as $value =&gt; $label): ?&gt;<br /><br />  <br />  &lt;h4&gt;&lt;?php echo $label;?&gt;&lt;/h4&gt;<br /><br />  &lt;?php $faq_questions['topic'] = @$questionsByTopic[$value]; ?&gt;<br />  &lt;?php if (!$faq_questions) { $faq_questions = array(); } ?&gt;<br /><br />  &lt;?php foreach ($faq_questions as $record): ?&gt;<br /><br />    &lt;p&gt;<br />        &lt;?php echo $record['question'] ?&gt;&lt;br&gt;<br />        &lt;?php echo $record['answer'] ?&gt;&lt;br&gt;&lt;br&gt;<br />    &lt;/p&gt;<br /><br />  &lt;?php endforeach ?&gt;<br /><br />&lt;?php endforeach ?&gt;<br /></code></p>

<p>It would also be nice if the category (topic) heading would not display if there were no questions associated with it (as shown in this post: <a href="http://www.interactivetools.com/forum/forum-posts.php?postNum=2217490#post2217490" rel="nofollow">http://www.interactivetools.com/forum/forum-posts.php?postNum=2217490#post2217490</a>).  I left that code out for now because it wouldn't display anything when I added it.  :-)</p>
<p>In case they are needed, the field names I'm working with are:</p>
<p>For Categories: faq_topics: '<strong>title</strong>'<br />For FAQ Items: faq_questions: '<strong>question</strong>', '<strong>answer</strong>', '<strong>topic</strong>' (the list which pulls topic titles from the above 'faq_topics")</p>

<p>Hopefully that all makes sense.  Thanks, in advance, for any assistance!</p>
<p>- Jeremy</p>]]></description>
          <pubDate>Tue, 30 Aug 2016 12:12:24 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2239477#post2239477</guid>
        </item>
              </channel>
    </rss>
  