Make a for-each for All fields

More
12 years 3 months ago #27579 by igcorreia
I need to make a for each to display all fields assigned to an item in the category view.

Is there any simple code where I code use? I am no expert guys, I am thinking in something like this:
Code:
for each (items as item){ for each (fields as field){ echo field->value; } }

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

More
12 years 3 months ago #27580 by ggppdk
You mean you want to display all field label of fields assigned to the Content Type of the item?


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

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

More
12 years 3 months ago #27581 by igcorreia
Exacly.

Currently in the category_items.php this is the code:

<!-- BOF under-description-line1 block -->
<?php if (isset($items[$i]->positions)) : ?>
<div class="lineinfo line3">
<?php foreach ($items[$i]->positions as $field) : ?>
<span class="element">
<?php if ($field->label) : ?>
<span class="label field_<?php echo $field->name; ?>"><?php echo $field->label; ?></span>
<?php endif; ?>
<span class="value field_<?php echo $field->name; ?>"><?php echo $field->display; ?></span>
</span>
<?php endforeach; ?>
</div>
<?php endif; ?>
<!-- EOF under-description-line1 block -->


but I want to list all items and the respective fields titles for example. After that I can do the rest.

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

More
12 years 3 months ago #27582 by ggppdk
why don't you use the array of fields of each item:

$item->fields
or
$items[$i]->fields

this contain the fields of the item you can do this to see the contents:
Code:
echo "<pre>"; print_r($items[$i]->fields); die('exit in category_items.php');

The above contains the fields of the item that are published and have the access level of current user,
... regardless of having value or not


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

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

More
12 years 3 months ago #27585 by igcorreia
That works perfect.

I have duplicate view.html.php (cateogry view) to view.html2.php

currently this view is limiting the number of items per PAGE what can I change in order to list ALL active item in this cateogry? Thanks.

I don't want to change the category option, I want to change the VIEW CODE in order to list all.

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

More
12 years 3 months ago #27586 by ggppdk
In the your new file, just before:
Code:
// Get data from the model $category = & $this->get('Category'); $categories = & $this->get('Childs'); $items = & $this->get('Data'); ...

Try adding:
JRequest::setVar('limit', 9999);


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

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

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