Updating Old FAQ Addon

Open to all! Ask other shopowners for help.
User avatar
tessthepup
Certified Developer
Posts: 383
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Updating Old FAQ Addon

Post by tessthepup »

I have been updating an old faq addon and have the admin side sorted but I am just having a few display issues on the catalog side.

When I have only 2 questions the page displays just fine but 3 or more questions starts to break the layout.

as seen here http://phoenix-demo.co.uk/faq.php

Can aynone see what I am missing as I have tried opening/closing <divs> but just break the page even more :oops:

Code: Select all

<div>
 <h1 class="display-4"><?php echo HEADING_TITLE; ?></h1>  

  <?php 
    $result_query = tep_db_query("SELECT faq_id, question, answer FROM faq WHERE visible='1' and language='" . tep_db_input($language) . "' ORDER BY v_order");
  
     if (mysqli_num_rows($result_query)) {
  ?>

    <div class="accordion" id="accordionFaq">
      <?php
         while ($faq = $result_query->fetch_assoc()) {
      ?>

          <div id="heading<?= $faq['faq_id'] ?>">
            <div class="mb-0"><button class="btn btn-link px-0 mx-0 shadow-none" type="button" data-toggle="collapse" data-target="#collapse<?=  $faq['faq_id'] ?>" aria-expanded="true" aria-controls="collapse<?= $faq['faq_id'] ?>"><?php echo $faq['question']; ?></button></div>
          </div>

          <div id="collapse<?= $faq['faq_id'] ?>" class="collapse" aria-labelledby="heading<?= $faq['faq_id'] ?>" data-parent="#accordionFaq">
            <div>
              <?php echo '<hr>' . $faq['answer'] . '<hr>'; ?>
            </div>
          </div>
        </div>
    <?php
      }
     }
    ?>


Join The Code Co-op to get access to your library in the Code Co-op Forum
raiwa
Certified Developer
Posts: 1641
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 70 times
Been thanked: 152 times

Re: Updating Old FAQ Addon

Post by raiwa »

It seems there is one closing</div> too much

Code: Select all

          <div id="collapse<?= $faq['faq_id'] ?>" class="collapse" aria-labelledby="heading<?= $faq['faq_id'] ?>" data-parent="#accordionFaq">
            <div>
              <?php echo '<hr>' . $faq['answer'] . '<hr>'; ?>
            </div>
    	</div>-> remove this div
        </div>
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
User avatar
tessthepup
Certified Developer
Posts: 383
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Re: Updating Old FAQ Addon

Post by tessthepup »

raiwa wrote: Sun Jan 29, 2023 12:02 pm It seems there is one closing</div> too much

Code: Select all

          <div id="collapse<?= $faq['faq_id'] ?>" class="collapse" aria-labelledby="heading<?= $faq['faq_id'] ?>" data-parent="#accordionFaq">
            <div>
              <?php echo '<hr>' . $faq['answer'] . '<hr>'; ?>
            </div>
    	</div>-> remove this div
        </div>
@raiwa
Thanks Rainer but that did not solve the problem
raiwa
Certified Developer
Posts: 1641
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 70 times
Been thanked: 152 times

Re: Updating Old FAQ Addon

Post by raiwa »

Did you copy my code or did you remove the div where it says to remove it?
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Updating Old FAQ Addon

Post by ecartz »

raiwa wrote: Sun Jan 29, 2023 12:02 pm It seems there is one closing</div> too much
As things stand right now, accordionFAQ and columnLeft and columnRight are peers. The columnLeft and columnRight should be peers of bodyContent. I see this by looking in Web Developer Tools (from Firefox, but the same thing should work in Chrome) and opening and closing DIVs. If I close bodyContent, I should still see the columns below it. But instead, I don't see them until I reopen that div.
User avatar
tessthepup
Certified Developer
Posts: 383
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Re: Updating Old FAQ Addon

Post by tessthepup »

raiwa wrote: Sun Jan 29, 2023 12:52 pm Did you copy my code or did you remove the div where it says to remove it?
@raiwa
I removed the </div>
User avatar
tessthepup
Certified Developer
Posts: 383
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Re: Updating Old FAQ Addon

Post by tessthepup »

ecartz wrote: Sun Jan 29, 2023 12:56 pm
raiwa wrote: Sun Jan 29, 2023 12:02 pm It seems there is one closing</div> too much
As things stand right now, accordionFAQ and columnLeft and columnRight are peers. The columnLeft and columnRight should be peers of bodyContent. I see this by looking in Web Developer Tools (from Firefox, but the same thing should work in Chrome) and opening and closing DIVs. If I close bodyContent, I should still see the columns below it. But instead, I don't see them until I reopen that div.
@ecartz
I sort of followed that lol
User avatar
tessthepup
Certified Developer
Posts: 383
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Re: Updating Old FAQ Addon

Post by tessthepup »

@ecartz @raiwa

All sorted and fixed :D

Thanks for the help guys.

Would this be of interest to people as an addon if I was to upload it?
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: Updating Old FAQ Addon

Post by 14Steve14 »

tessthepup wrote: Sun Jan 29, 2023 5:39 pm Would this be of interest to people as an addon if I was to upload it?
I currently have a large FAQ page on my old 1.0.7.11 site that was coded following something I found online. It is a bit of a nightmare to work with, so if this is easier I would be interested.
User avatar
tessthepup
Certified Developer
Posts: 383
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Re: Updating Old FAQ Addon

Post by tessthepup »

14Steve14 wrote: Sun Jan 29, 2023 6:01 pm
tessthepup wrote: Sun Jan 29, 2023 5:39 pm Would this be of interest to people as an addon if I was to upload it?
I currently have a large FAQ page on my old 1.0.7.11 site that was coded following something I found online. It is a bit of a nightmare to work with, so if this is easier I would be interested.
@14Steve14
pm'd you a oopy to try and give feedback


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply