Advertisement

Custom Fields Improvement

Do you have an idea for the Joomla community that you can help implement? Discuss in here.
Locked
User avatar
ies
Joomla! Apprentice
Joomla! Apprentice
Posts: 43
Joined: Mon Mar 21, 2011 12:38 pm
Contact:

Custom Fields Improvement

Post by ies » Fri Mar 01, 2019 7:18 pm

Hi,

I just wanted to say that custom fields in Joomla is currently the biggest and most important feature.
I believe that custom fields with CSS grid will expand Joomla to a new level.

Actually custom fields have to be treated as equally important as the main text of the article and displayed in the same tab in the administration. This will lead to a multi type and multi structured content that is the main need for the modern websites. We can't just have only title, image (full and intro) and main text.

But custom fields need some improvements. For example:
  • Custom fields have to go out from the container 'fields-container'. At least an option should exist.
  • Custom fields have to be placed in div and not dl/dd. Possibly the option above to put them outside 'fields-container' would place automatically inside divs.
  • Custom fields should be placed in the same level in DOM as the title, image and main text. This is usefull for the CSS grid. At the moment I have to use Javascript in order to put them below the "item-page" element.
  • The main text should have a distinct class and not only itemprop="articleBody".
  • The checkboxes type of custom fields should place each value in a span in order to be able to add more design.
  • Maybe a field for custom html/php code could be added.
Actually Joomla is already some levels higher than other CMSs. :)
Lets increase the difference with one more level.
Maybe the above ideas could be applied in Joomla 4.

Advertisement
annahersh
Joomla! Guru
Joomla! Guru
Posts: 734
Joined: Wed Aug 15, 2018 8:23 pm

Re: Custom Fields Improvement

Post by annahersh » Sat Mar 02, 2019 9:22 pm

In agreement with checkboxes output.

The method used for article element styling has long been via the pseudo selector method, which no doubt you know of:
div[itemprop="articleBody"] {}
but I guess it wouldn't hurt to include a distinct class.

Adding custom html/php field to custom fields could be quite chaotic but certainly useful for a skilled user.

User avatar
stutteringp0et
Joomla! Ace
Joomla! Ace
Posts: 1389
Joined: Sat Oct 28, 2006 11:16 pm
Location: Texas
Contact:

Re: Custom Fields Improvement

Post by stutteringp0et » Mon Mar 25, 2019 4:13 pm

You can create alternate output templates for almost everything in Joomla, in which you can place the field values anywhere you like, formatting them any way you like. Search "overrides" and that'll put you on the right track.

I do this in my site to better utilize custom fields for my extensions. I'd link it, but people in the forums are weird about that. I use the custom field values wherever I want. Joomla doesn't limit you to above or below the article content.

In your custom article override (name it something other than 'default.php'), you have access to the custom fields with just a little setup:

Code: Select all

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
JLoader::register('FieldsHelpler',JPATH_ADMINISTRATOR.'/components/com_fields/helpers/fields.php');
foreach($this->item->jcfields as $jcfield) { $this->item->jcFields[$jcfield->name] = $jcfield->rawvalue; }
Then you have access to their values at $this->item->jcFields['fieldname'];

At that point, you can do anything with the values that you like.

The person who led me to this information uses a half dozen custom fields to define colors for the product articles his customer creates. They have an area for writeup, then several dozen custom fields to select images and choose colors. The result is a series of product pages which are unique, but share a common layout.

Anyway, custom fields are way more powerful than most people realize
My extensions: http://extensions.joomla.org/profile/pr ... ails/18398
Honk if this signature offends you.

User avatar
ies
Joomla! Apprentice
Joomla! Apprentice
Posts: 43
Joined: Mon Mar 21, 2011 12:38 pm
Contact:

Re: Custom Fields Improvement

Post by ies » Tue Mar 26, 2019 9:38 am

This is a good idea stutteringp0et. I will have it in mind next time.
I think that the disadvantages of what you describe are:
- Your idea needs PHP and then CSS but what I describe needs only CSS.
- I (at least) usually have a fear about overrides. I fear that some important features will appear in the future that will be not included in the override.

User avatar
paulala
Joomla! Explorer
Joomla! Explorer
Posts: 303
Joined: Sat Oct 30, 2010 12:32 pm
Location: Scotland
Contact:

Re: Custom Fields Improvement

Post by paulala » Sat Apr 27, 2019 4:16 pm

I agree with the sentiment expressed here. Custom fields have enormous potential and are probably not being talked about more because as you say not everybody is properly aware of them yet. I recently read this article which looks at them in some detail. Quite interesting....

https://magazine.joomla.org/issues/issu ... tom-fields
Warm Regards,
Paula Livingstone, Skydiving Instructor and Network Security Consultant
https://paulalivingstone.com
http://rustyice.co.uk

User avatar
ies
Joomla! Apprentice
Joomla! Apprentice
Posts: 43
Joined: Mon Mar 21, 2011 12:38 pm
Contact:

Re: Custom Fields Improvement

Post by ies » Sun Apr 28, 2019 9:04 am

I have seen the page you mentioned in the past and I was impressed.
Recently, I created a website that presented an article (with custom fields of course) like an eshop product page. Everything in the article page was looking like an eshop, except the add to cart button that was missing. This is the moment I realized, in action, the importance of custom fields. And the whole job was easier than I expected and I still don't know what I would have done if I couldn't use the custom fields.

Except of cases like mine or the cases described in the page you mentioned and many cases of special content representation, custom fields are very good just for giving more design to the simple article text.

Imagine the single article text to be broken to the custom fields (along with the main text) and each one of these parts to have a different design (like different font size, font color, background color or image, position etc.). The possibilities for the template makers are becoming enormous and easier and we don't need to break the content in modules in order to separate its design from the main content.

But the changes described in the first post have to be done in order to avoid using Javascript for the 'fields-container' group and additional CSS for handling the dl/dd tags.

User avatar
paulala
Joomla! Explorer
Joomla! Explorer
Posts: 303
Joined: Sat Oct 30, 2010 12:32 pm
Location: Scotland
Contact:

Re: Custom Fields Improvement

Post by paulala » Sun Apr 28, 2019 9:07 am

stutteringp0et wrote: Mon Mar 25, 2019 4:13 pm You can create alternate output templates for almost everything in Joomla, in which you can place the field values anywhere you like, formatting them any way you like. Search "overrides" and that'll put you on the right track.

I do this in my site to better utilize custom fields for my extensions. I'd link it, but people in the forums are weird about that. I use the custom field values wherever I want. Joomla doesn't limit you to above or below the article content.

In your custom article override (name it something other than 'default.php'), you have access to the custom fields with just a little setup:

Code: Select all

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
JLoader::register('FieldsHelpler',JPATH_ADMINISTRATOR.'/components/com_fields/helpers/fields.php');
foreach($this->item->jcfields as $jcfield) { $this->item->jcFields[$jcfield->name] = $jcfield->rawvalue; }
Then you have access to their values at $this->item->jcFields['fieldname'];

At that point, you can do anything with the values that you like.

The person who led me to this information uses a half dozen custom fields to define colors for the product articles his customer creates. They have an area for writeup, then several dozen custom fields to select images and choose colors. The result is a series of product pages which are unique, but share a common layout.

Anyway, custom fields are way more powerful than most people realize
Just read this properly, great tip
Warm Regards,
Paula Livingstone, Skydiving Instructor and Network Security Consultant
https://paulalivingstone.com
http://rustyice.co.uk

User avatar
ies
Joomla! Apprentice
Joomla! Apprentice
Posts: 43
Joined: Mon Mar 21, 2011 12:38 pm
Contact:

Re: Custom Fields Improvement

Post by ies » Sun Apr 28, 2019 9:49 am

I always felt, all these years using Joomla, that overrides are the last (but good) solution to a problem.

But what I am talking about is not only a solution. It is about making it better.
After all, why to improve a CMS if we can always override it?

romaan
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Thu Feb 27, 2014 5:39 pm

Re: Custom Fields Improvement

Post by romaan » Fri Jul 12, 2019 8:57 am

I use custom fields in content overrides very successfully. It opens tons of possibilities for me.
But I cannot make them working in search result override (defult_result.php).
Is there any way?

$this->item->jcfields NOT WORKING
$this->result->jcfields NOT WORKING
$result->jcfields NOT WORKING

Please help!

peterbe
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Sun Oct 06, 2019 8:47 pm

Re: Custom Fields Improvement

Post by peterbe » Sun Oct 06, 2019 8:51 pm

stutteringp0et wrote: Mon Mar 25, 2019 4:13 pm You can create alternate output templates for almost everything in Joomla, in which you can place the field values anywhere you like, formatting them any way you like. Search "overrides" and that'll put you on the right track.

I do this in my site to better utilize custom fields for my extensions. I'd link it, but people in the forums are weird about that. I use the custom field values wherever I want. Joomla doesn't limit you to above or below the article content.

In your custom article override (name it something other than 'default.php'), you have access to the custom fields with just a little setup:

Code: Select all

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
JLoader::register('FieldsHelpler',JPATH_ADMINISTRATOR.'/components/com_fields/helpers/fields.php');
foreach($this->item->jcfields as $jcfield) { $this->item->jcFields[$jcfield->name] = $jcfield->rawvalue; }
Then you have access to their values at $this->item->jcFields['fieldname'];

At that point, you can do anything with the values that you like.

The person who led me to this information uses a half dozen custom fields to define colors for the product articles his customer creates. They have an area for writeup, then several dozen custom fields to select images and choose colors. The result is a series of product pages which are unique, but share a common layout.

Anyway, custom fields are way more powerful than most people realize
Appreciate the snippet poet.

Advertisement

Locked

Return to “Joomla! Ideas Forum”