Login | Sign up | Toll-Free: 1-800-752-0455
 
 

Forum

 

14 posts by 4 authors in: Forums > CMS Builder
Last Post: December 15, 2010

Hi,



Someone here helped me out on a previous site, I now need to re-use that code to make 2 columns of my data, but it refuses to work - just gives me a long line?

Code:

<div id="sidebar1"> <span class="sub_heads"><img src="images/arrow_icon.png" alt="icon" width="20" height="20" class="fltlft" />Case Studies<br /></span>
<span class="bodytext"><br />
<table width="357" cellpadding="3" cellspacing="5">
<tr>
<?php foreach ($case_studiesRecords as $record): ?>
<?php echo $record['logo'] ?>
<a href="<?php echo $record['_link'] ?>"&quot;&gt;<?php echo $record['_link'] ?>>Click for more info:</a><br/>
</td>
<?php $maxCols=2; if (@++$count % $maxCols == 0): ?> </tr><tr> <?php endif ?>
<?php endforeach ?>
</tr>
</table>


<?php if (!$case_studiesRecords): ?>
No records were found!<br/><br/>
<?php endif ?></div>



Result:

http://www.corporate-events.co.uk/client_portfolio.php

Thanks!

Jim

Re: [jimbly2] Multi column - again!

By Chris - October 7, 2010 - edited: October 7, 2010

Hi Jim,

I think the only problem is that you're missing an opening <TD> tag:

<?php foreach ($case_studiesRecords as $record): ?>
<td>
<?php echo $record['logo'] ?>


I hope this helps! Please let me know if you have any questions.
All the best,
Chris

Re: [chris] Multi column - again!

Hi Chris,



.. how did I not see that![blush] Thanks again for your help here - been staring at it too long I think!

cheers

Jim

Re: [terryally] Multi column - again!

Hi Terry,

Sure, there's no reason why you couldn't use CSS divs instead of a table.

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] Multi column - again!

Hi Jason,

I admit I do not fully understand. If I used CSS to create two columns are you saying that I could simply use the following code

<?php $maxCols=2; if (@++$count % $maxCols == 0): ?> <?php endif ?>

and this would wrap the data retrieved from the database into two columns?

Do you have a coding example for this?

Thanks
Terry

Re: [terryally] Multi column - again!

Hi Terry,

You would have to put in code that would end 1 div and start another.

For example:

<?php $maxCols=2; if (@++$count % $maxCols == 0): ?></div> <div> <?php endif ?>

You'll have to customize this to use whatever css classes you're using on the page. Give this a try.

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] Multi column - again!

Hi Chris,

That certainly makes sense. I'll give it a try and come back one way or another.

Thanks
Terry

Re: [terryally] Multi column - again!

Hi Chris,

I tried with CSS and it doesn't work. Here is what's happening. I used:

<?php foreach ($public_inputsRecords as $record): ?>
<div class="col1">
<?php $maxCols=2; if (@++$count % $maxCols == 0): ?></div><div class="col2"><?php endif ?>
<?php endforeach ?>
</div>


However, the code that is parsing is:


<div class="col1">Nullam eget lacus leo. Suspendisse nec risus lectus orci aliquam<br /></div>
<div class="col1">Duis tortor mauris, vehicula et tincidunt in, pretium in sem. Praesent porttitor consectetur justo et tristique.<br /></div>
<div class="col2"> <div class="col1">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer dui justo, consectetur ac consequat nec, varius eu purus. Nulla molestie semper faucibus. Mauris at sapien eu orci ultrices massa nunc.<br /></div>
<div class="col1">Quisque convallis dolor at orci bibendum ac vulputate neque rhoncus. Vestibulum neque dolor, varius sed sagittis at, pretium quis dui. Nullam eget lacus leo. Suspendisse nec risus lectus orci aliquam.<br /></div>
<div class="col2"> <div class="col1">Ut tristique fermentum auctor. Duis tortor mauris, vehicula et tincidunt in, pretium in sem. Praesent porttitor consectetur justo et tristique. Vivamus ultrices vehicula massa, sit amet viverra metus.<br /></div>


Any ideas?

Terry

Re: [terryally] Multi column - again!

Hi Terry,

How do you want the output to work? Does it output col1 twice and then col2 twice?

If you could attach the .php file you're working with and give an example of what you would want the html to look like, we can work out a solution.

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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