How to make a table in a content item?

More
10 years 4 months ago #43615 by gkhn
Interesting topic :)

I wonder how i can just set up fields like product name/ product price and features
so that user can add these and it creates a nice table

----Product Name
Price -- - - -Features



SOmething like this

Please Log in or Create an account to join the conversation.

More
10 years 4 months ago #43618 by igcorreia
The easy way is to use the DEFAULT TEMPLATE, it is a table.

Create a type of content called PRODUCTS with 5/6/7 custom fields and assign them to the DEFAULT TEMPLATE create a menu item linked to the category and that is it.

Advanced solution is to create a custom module template that is a table.

Please Log in or Create an account to join the conversation.

More
10 years 4 months ago #43622 by gkhn

igcorreia wrote: The easy way is to use the DEFAULT TEMPLATE, it is a table.

Create a type of content called PRODUCTS with 5/6/7 custom fields and assign them to the DEFAULT TEMPLATE create a menu item linked to the category and that is it.

Advanced solution is to create a custom module template that is a table.


thank you for the reply.

What I am actually trying to do is this

<?php if ((isset($item->positions ) ) ) : ?>
<div class="row">
<div class="col-sm-12">
<div class="table-responsive table-bordered table-hover">
<table class="table">

<?php foreach ($item->positions as $field) : ?>
<thead>
<tr>
<?php echo $field->display; ?>
</tr>


</thead>
<?php endforeach; ?>
<?php endif; ?>

<tbody>
<?php if ((isset($item->positions ) ) ) : ?>
<?php foreach ($item->positions as $field) : ?>
<tr>
<?php echo $field->display; ?>

</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php if ((isset($item->positions ) ) ) : ?>
<?php foreach ($item->positions as $field) : ?>
<tr>

<?php echo $field->display; ?>

</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php if ((isset($item->positions ) ) ) : ?>
<?php foreach ($item->positions as $field) : ?>
<tr>
<td> <?php echo $field->display; ?></td>

</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>

</table>
</div>
</div>
</div>


I can dynamically add text field to this using frontend submission.

The problem is if I want to add an image+text inside the table. If I can load the textarea just like the simple text field then my problem is solved :)

Please Log in or Create an account to join the conversation.

More
10 years 4 months ago #43623 by gkhn
I even tried loading a module via field but I cannot add prefix and suffix to modules...(<td> </td>)

I addded fields and using <td> prefix and suffix, I can get them work inside the table...(simple text only)

Please Log in or Create an account to join the conversation.

More
10 years 4 months ago #43625 by igcorreia
Why don't you create 2 positions per <td> ?

This way you can have many fields inside the same td?

Please Log in or Create an account to join the conversation.

More
10 years 4 months ago #43626 by gkhn
Sorry but my head is hurting at the moment :)

Is this what you mean by creating two positions?
Code:
<?php if ((isset($item->positions['tablerow1'] ) ) ) : ?> <?php if ((isset($item->positions['tablerow1a'] ) ) ) : ?> <?php foreach ($item->positions['tablerow1'] as $field) : ?> <?php foreach ($item->positions['tablerow1a'] as $field) : ?> <tr> <?php echo $field->display; ?> </tr> <?php endforeach; ?> <?php endif; ?> <?php endif; ?>

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.301 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline