How do I do to display the extra user fields into a Module?

More
14 years 10 months ago #3787 by jbananero
Hello everyone,

Sorry but I am beginner developping in Joomla.

Then I need your help please.

I wanted to know how to display the extra "user fields" into a module.

I have added extra fields into the articles (like "price", "calendar", "time",...) and I would like to display these fields into a module I have placed in the right column (in this case I am using the EventList).

But when I use the following code into the PHP file used by the module: <?php echo $this->fields->price->display; ?> that doesn´t return nothing.

How can I display the fields into the module?

Many thanks in advance for your help.

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

More
14 years 10 months ago #3830 by orchid1
are you trying to use FLEXIcontent code inside a module because that isn't possible. Modules are independent creatures they don't directly relate to any components framework, they are literaly extensions. At best they share database access
Can you explain a bit more

“Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives.” William A. Foster - USMC

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

More
14 years 10 months ago #3903 by jbananero
Thanks orchid1,

I supposed that. At the end I have accessed directly to the Flexicontents tables using SQL statements.

Here I set the function I have created, perhaps it can help to someone.

Variable $field_id is the field ID set by Flexicontent for each extra field.


function _getValues($field_id)
{
$id = JRequest::getVar('id');
$db = & JFactory::getDBO();
$query =
'SELECT t1.value, t2.label '.
'FROM #__flexicontent_fields_item_relations AS t1 '.
'INNER JOIN #__flexicontent_fields AS t2 ON t1.field_id = t2.id ' .
'WHERE t1.item_id = ' . $id . ' AND t1.field_id = ' . $field_id . ' ' .
'ORDER BY t1.value';

$db->setQuery($query);
$rows = $db->loadObjectList();
foreach ($rows as $row)
{
$temp["label"] = $row->label;
$temp["value"] = $row->value;
}
return $temp;
}

Regards.

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

More
14 years 6 months ago #7247 by alessek
Hi,

I lost in flexi sources..

Could you help me with another problem please ?

I need to have extra user fields in Title of items list in category.
Code:
<?php foreach ($this->items as $item) : ?> <tr class="sectiontableentry"> <!-- BOF item title --> <th scope="row" class="table-titles"> <?php if ($this->params->get('link_titles', 0)) : ?> [url=<?php echo JRoute::_(FlexicontentHelperRoute::getItemRoute($item->slug, $this->category->slug)); ?>]<?php echo $this->escape($item->title); ?>[/url] <?php else : echo $this->escape($item->title); endif; ?> </th> <!-- BOF item title -->

To
Code:
<?php echo $this->escape($item->title); ?>

I need to put here connected extra fields like this.

my_extra_field1 + my_extra_field2 + my_extra_field3

Is it real to do it?

I´m not so good programmer :(

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

More
14 years 6 months ago #7248 by yopyop001
Hi,

You can call a field in your template with the code
Code:
<?php echo $this->fields['field_name']->display; ?>

I hope it will help you.

Regards

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

More
14 years 6 months ago #7261 by alessek
I hope it will be good with your help, but it doesn´t work :(

So I tried some alternatives of your code but unsuccessfully.

Do you have another tip, idea ?

Is it true that escape($item->title) is getting information from table of joomla articles ?

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

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