2

Perhaps I am not using the Custom Fields properly, but here is my problem:

I have a piece of text which appears in a number of different articles. Rather than have to update each individual article when I need to change the text, I have tried to use a Custom Field.

This displays properly in the articles, BUT when I update the Custom Field (default value), the update is NOT reflected in the various articles.

So, for more specific detail:

I have a number of different articles. Each has a specific piece of text which is common to all these articles... lets say the text is "The Current Account Manager is Mr Blog". So I created a Custom Field called 'Account_Mgr, and it has 'Mr Blog' as the default text. I have added this field into all the relevant articles {field 1} (or whatever the id is), and I want to periodically change 'Mr Blog' to 'Miss Smith', when the account manager changes.

Rather than have to change the same text in multiple articles, when I want to change to 'Miss Smith', I use the Custom Field, and changed that single Field (from Blog to Smith). I was expecting all the articles which had that Custom Field ({ field 1} ) to update automatically, but none of them did.

I cleared the Joomla and browser cache, I am not using a CDN, and I have tried a different browser... all to no effect.

Am I doing something wrong, OR should Custom Fields NOT be used in this manner?

thanks, Mike

2
  • I have just been digging a bit more into this, and of course I now realise that this cannot be done in the way I had planned.... bummer....
    – ml09616
    Jan 29, 2019 at 6:26
  • I think you could use ReReplacer to do what you want. regularlabs.com/extensions/rereplacer/tutorial
    – TryHarder
    Feb 5, 2019 at 7:01

3 Answers 3

1

Actually I would not close this question. Because there are simple answers to it, like what Sharky gave. But there is a simpler, more user friendly solution of this question which is using modules inside articles (or below or above) for the purpose mentioned in the question. If I understood the question well.

If you place any content into a custom module (text, images, anything) with a custom module position and then you change that content of that module later, then anywhere that module is published e.g. using {loadposition custommoduleposition}, the displayed content will be changed too. That is the purpose of the OP here. And that’s what modules are there for in Joomla for example. If he changes the content it has to be reflected everywhere it displayed.

So, create and use custom modules instead of fields for your purpose.

0
0

What you're trying to achieve is possible with custom fields but it's not convenient. What you would need to do is clear the field value every time you create or edit an article. This way it won't be saved to the database and the actual default value set in custom field parameters will be displayed.

But the correct solution would be a proper shortcode extension.

0
0

How to archive that:

  • Create a custom field of type List where you store all your managers
  • Each of item in the list should have its Label (eg. Mr. Bob) and unique Value (eg. 1 or manager1)
  • In article select the manager using just created drop down list of managers
  • When you need to change the manager go to your custom field editing and change the Label of the manager to a new one (eg. Mr. Jenkins)
  • All articles where you selected that particular manager will display the new name (cause the manager is identified by its ID/value)

That's it. All articles where you selected the manager will use the new name.

How it works:

Each article stores only the value (and the value of select list is in our example 1, manager1 or what ever value you set as the ID of manager). So when you change the label you don't touch the value, just the label of that value. That way while displaying the article you use the value to identify the current manager but uses its label to show the manager.

Why using custom field is a better solution?

Manager is a data attached to certain article (entity). Data should be structured and you should be able to query it. Lets say one day you want to look for articles of a selected manager. Doing that using modules would require parsing HTML.

Also have in mind that using a drop down field of available managers is more user friendly. You don't need to remember the short-code or module ID. You have a predefined list. In short: you have more control over your data and less space for mistakes.

Is it the best solution? No. User still have to get into custom fields and look for the Manager field. But it is the most you can get out of Joomla! without creating a custom component.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.