Page 1 of 3

Updating Old FAQ Addon

Posted: Sun Jan 29, 2023 10:40 am
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
      }
     }
    ?>

Re: Updating Old FAQ Addon

Posted: Sun Jan 29, 2023 12:02 pm
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>

Re: Updating Old FAQ Addon

Posted: Sun Jan 29, 2023 12:07 pm
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

Re: Updating Old FAQ Addon

Posted: Sun Jan 29, 2023 12:52 pm
by raiwa
Did you copy my code or did you remove the div where it says to remove it?

Re: Updating Old FAQ Addon

Posted: Sun Jan 29, 2023 12:56 pm
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.

Re: Updating Old FAQ Addon

Posted: Sun Jan 29, 2023 1:33 pm
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>

Re: Updating Old FAQ Addon

Posted: Sun Jan 29, 2023 1:35 pm
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

Re: Updating Old FAQ Addon

Posted: Sun Jan 29, 2023 5:39 pm
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?

Re: Updating Old FAQ Addon

Posted: Sun Jan 29, 2023 6:01 pm
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.

Re: Updating Old FAQ Addon

Posted: Sun Jan 29, 2023 6:19 pm
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