Content under category table

More
14 years 7 months ago #6430 by LaughingTear
Hi once again!

I'm using the default category template to display a table with the articles of a category. Well, that works fine. But I'd like to place a text right UNDER this table. I'm not into PHP, so it would be great if there's a simple solution for this.

I already tried the "Placehere" module as workaround, but that would lead to displaying the text under each article too.

Thanks for your help!

Uli

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

More
14 years 7 months ago #6654 by Rehne
Replied by Rehne on topic Content under category table
What type of text should it be?

One possibility would be
create a new position (group) in the template
and after that create an new field (filedtype = text area) also
so you can, when editing a category,
write a text for each category that appears under the table

I do not know whether you mean it.

To implement this you must do the following changes:

1. add a new group (e.g. under_tabe) in the templates\default\category.xml
Code:
<fieldgroups> <group>table</group> <group>under_table</group> </fieldgroups>
2. in the templates\default\category.php
after
Code:
<!-- BOF item list display --> <?php echo $this->loadTemplate('items'); ?> <!-- BOF item list display -->
add the following code
Code:
<?php if ((isset($this->item->positions['under_table'])) : ?> <div class="under_item_table"> <!-- BOF under_item_table block --> <?php foreach ($this->item->positions['under_table'] as $field) : ?> <div class="element <?php echo $field->name; ?>"> <?php echo $field->display; ?> </div> <?php endforeach; ?> </div> <div class="clear"></div> <?php endif; ?> <!-- EOF under_item_table block -->

the code for the css file and the rest of the statement I skip

maybe that is right for you

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

More
14 years 7 months ago #6670 by Rehne
Replied by Rehne on topic Content under category table
excuse me
quite as easy as I wrote it is not yet
Code:
2. in the templates\default\category.php after Code: Select all <!-- BOF item list display --> <?php echo $this->loadTemplate('items'); ?> <!-- BOF item list display --> add the following code

there has to be the following code but not in the templates\default\category.php but in templates\default\category-items.php after
Code:
<?php else : ?> <div class="noitems"><?php echo JText::_( 'FLEXI_NO_ITEMS_CAT' ); ?></div> <?php endif; ?>

the new code
Code:
<?php if ($this->items) : $elements = array(); if (isset($item->positions['under_table'])) : ?> <div class="under_item_table"> <?php foreach ($item->positions['under_table'] as $element_pos) : if (!in_array($element_pos->name, $elements)) : $elements[$element_pos->name] = $item->fields[$element_pos->name]->label; ?> <div class="element"> <div class="label field_<?php echo $item->fields[$element_pos->name]->label; ?>"> <?php echo $item->fields[$element_pos->name]->label; ?> </div> <div class="value field_<?php echo $item->fields[$element_pos->name]->label; ?>"><?php echo $item->fields[$element_pos->name]->display; ?></div> </div> <?php endif; endforeach; ?> </div> <div class="clear"></div> <?php endif; ?> <?php endif; ?>

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.827 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