Faq split in columns

18 posts by 6 authors in: Forums > CMS Builder
Last Post: July 25, 2010   (RSS)

By thenetgirl - June 23, 2010

I see this

</td><td> <?php endif ?> [/#000000]

but about its not a simple split into 2 colums i have other info I want at thetop of the other column

see page please

http://www.californialandlordsolutions.com/2010/FAQ.php

[/#000000]
Patricia

www.thenetgirl.com

By Damon - June 23, 2010 - edited: June 23, 2010

Hi,

Here is another way of splitting the content into two columns that hopefully is easier to follow:

<table border="1">
<tr>
<td valign="top">

<?php $counter = 1; ?>
<?php foreach (faqRecords as $record): ?>
<?php if($counter <= 4) : ?>
<b> <?php echo $record['question'] ?></b><br/>
<?php echo $record['answer'] ?><br/><br />
<?php endif; ?>
<?php $counter++ ?>
<?php endforeach ?>

</td>
<td valign="top">

<!-- ADD CONTENT HERE -->
<?php $counter = 1; ?>
<?php foreach (faqRecords as $record): ?>
<?php if($counter >= 5) : ?>
<b> <?php echo $record['question'] ?></b><br/>
<?php echo $record['answer'] ?><br/><br />
<?php endif; ?>
<?php $counter++ ?>
<?php endforeach ?>

</td>
</tr>
</table>


The first column, you are setting a counter and only outputting records up to four using the if statement ($counter <= 4).

In the second column, you are setting a counter and only outputting records equal and greater than five using the if statement ($counter >= 5).

There is also this comment in the second column (<!-- ADD CONTENT HERE --> ) where you can add the HTML and link for your newsletter.

You can also limit the number of records that display in the second column by changing the if statement to this:
<?php if($counter >= 5 && $counter <= 8) : ?>

This will then only output 4 records in the second column.

Give this a try and let me know how it works out. :)
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Damon] Faq split in columns

By thenetgirl - June 23, 2010 - edited: June 23, 2010

Its perfect Damon ............its wonderful thank you thank you !!!!!!!!

YOU GUYS ARE THE BEST I JUST LOVE WORKING WITH YOU! [cool]
Patricia

www.thenetgirl.com

By thenetgirl - July 22, 2010

Like I said this worked great
..... while i was building it but now that I am adding more articles I find myself have to balance the columns.

There is no way to may the columns equal in length is their?

With like put 50% of the info here and the other 50% in the next column and i am not talking articles I am talking equally spaced text on the page. I like my columns to be some what the same length and of course each article varies in size.
Patricia

www.thenetgirl.com

By Jason - July 23, 2010

Hi,

There is no easy way to go about this since, as you said, it totally dependent on the content. And if you did find a way to balance it more closely, you would end up displaying your articles based on their length and on no other criteria.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Faq split in columns

By thenetgirl - July 23, 2010

Thanks I thought not but it never hurts to ask.



PG
Patricia

www.thenetgirl.com

Re: [gkornbluth] Faq split in columns

By thenetgirl - July 25, 2010

Jerry I will play with this and let you know

thanks
Patricia
Patricia

www.thenetgirl.com