Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

How I can show content in two columns using a template?


Reply

7 Posts   1944 Views

Avatar
WebSpilka

22 May 2008 at 7:19pm (Last edited: 22 May 2008 7:21pm), Community Member, 79 Posts

Please help me
How can I show content in two columns using a template?
I need 2 collumn. how I mast insert <tr> in next code ?

<table id="ProdList">
<% control Children %>
<td>
<div class="newsDateTitle"><a href="$Link" title="Read more on &quot;{$Title}&quot;">$Title</a></div>
<div class="newsDateTitle">$Year</div>
<div class="newsDateTitle">$Color</div>
</td>
<% end_control %>
</table>

Avatar
lekoala

22 May 2008 at 7:55pm Community Member, 30 Posts

<table>
<tr>
<td>line1 col1</td>
<td>line1 col2</td>
</tr>
<tr>
<td>line2 col1</td>
<td>line2 col2</td>
</tr>
</table>

well.. that's the code for a table... so let's imagine that you want a news list on the left and the news details on the right, you could have

<table id="ProdList">
<% control Children %>
<tr>
<td><div class="newsDateTitle"><a href="$Link" title="Read more on &quot;{$Title}&quot;">$Title</a></div>
<div class="newsDateTitle">$Year</div>
<div class="newsDateTitle">$Color</div> </td>
</tr>
<tr>
<td>$Content</td>
</tr>
<% end_control %>
</table>

is that what you wanted to do?

Avatar
WebSpilka

22 May 2008 at 8:08pm (Last edited: 22 May 2008 8:12pm), Community Member, 79 Posts

no not THIS ((
in php I write
<? $i=0; ?>
<table id="ProdList">
<% control Children %>
<? if ($i==0) echo "<tr>";
?>
<td>
<div class="newsDateTitle"><a href="$Link" title="Read more on &quot;{$Title}&quot;">$Title</a></div>
<div class="newsDateTitle">$Year</div>
<div class="newsDateTitle">$Color</div>
</td>
<?
if ($i==1) echo "</tr>";
if ($i==0){ $i++; }else{ $i=0;}
?>
<% end_control %>
</table>

in HTML I wont get next rezult
<table id="ProdList">

<tr>
<td>
<div class="newsDateTitle"><a href="$Link" title="Read more on &quot;{$Title}&quot;">$Title</a></div>
<div class="newsDateTitle">$Year</div>
<div class="newsDateTitle">$Color</div>
</td>

<td>
<div class="newsDateTitle"><a href="$Link" title="Read more on &quot;{$Title}&quot;">$Title</a></div>
<div class="newsDateTitle">$Year</div>
<div class="newsDateTitle">$Color</div>
</td>

</tr>

<tr>
<td>
<div class="newsDateTitle"><a href="$Link" title="Read more on &quot;{$Title}&quot;">$Title</a></div>
<div class="newsDateTitle">$Year</div>
<div class="newsDateTitle">$Color</div>
</td>

<td>
<div class="newsDateTitle"><a href="$Link" title="Read more on &quot;{$Title}&quot;">$Title</a></div>
<div class="newsDateTitle">$Year</div>
<div class="newsDateTitle">$Color</div>
</td>
</tr>

</table>

Avatar
Willr

22 May 2008 at 8:10pm Forum Moderator, 5511 Posts

Tables?!?!? thats not a solution :D

If you want 2 columns whats stopping you doing

<div class="product">
Blah
</div>

<div class="product">
Blah
</div>

Then just define a width on .product like (50%) and float it left.

Avatar
WebSpilka

22 May 2008 at 8:21pm Community Member, 79 Posts

I do not know how to use php code in my .ss file
How I can make this
<% control Children %>
<? if ($i==0) echo "<tr>";
?>

Avatar
Willr

22 May 2008 at 8:24pm Forum Moderator, 5511 Posts

You cant use PHP in ss templates. You can use $EvenOdd if you only need two.. I think it would be like
<td>Blah</td>
<% if EvenOdd = Even %>
</tr>
<% end_if %>

Avatar
WebSpilka

23 May 2008 at 2:11am Community Member, 79 Posts

willr, thank you very much