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   1987 Views

Avatar
WebSpilka

Community Member, 83 Posts

22 May 2008 at 7:19pm

Edited: 22/05/2008 7:21pm

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

Community Member, 30 Posts

22 May 2008 at 7:55pm

<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

Community Member, 83 Posts

22 May 2008 at 8:08pm

Edited: 22/05/2008 8:12pm

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

Forum Moderator, 5513 Posts

22 May 2008 at 8:10pm

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

Community Member, 83 Posts

22 May 2008 at 8:21pm

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

Forum Moderator, 5513 Posts

22 May 2008 at 8:24pm

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

Community Member, 83 Posts

23 May 2008 at 2:11am

willr, thank you very much