1

I have this piece of code that already runs on the pages I need this done. (The entire Joomla 3.9 site is a Frankenstein of custom code, components, etc. )

   $placeholder_country = JText::_('COM_ACME_PLACEHOLDER_COUNTRY_'.strtoupper(str_replace('-','_',$var['country'])));
    if($placeholder_country === 'COM_ACME_PLACEHOLDER_COUNTRY_'.strtoupper(str_replace('-','_',$var['country'])) || !$placeholder_country) $placeholder_country = '';

    $article->text = JString::str_ireplace("{%placeholder_country%}", $placeholder_country, $article->text);

I tried adding the following to see if I can get this to set the title the same way.

     $placeholder_country = JText::_('titlenick_'.strtoupper(str_replace('-','_',$var['country'])));
    if($placeholder_country === 'titlenick_'.strtoupper(str_replace('-','_',$var['country'])) || !$placeholder_country) $placeholder_country = '';

    $document->setTitle = JString::str_ireplace("{%placeholder_country%}", $placeholder_country, $article->text);

Meaning, I go into the Joomla Language overrides section, add the Language Constant, for example, "TITLENICK_PERU"

In the "text" Id enter the page title I want. "Cheap Peru vacations" for example.

2
  • You might find the 'alt' option of the TEXT API, api.joomla.org/cms-3/classes/Joomla.CMS.Language.Text.html, helpful. I am not really clear what it is you are trying to achieve to be more specific but the alt option is quite handy once you understand how it works.
    – Irata
    Dec 11, 2021 at 10:06
  • Not sure thats what I need. I basically need a way to enter custom titles for URLs that are created by a custom component. Im trying to see if its possible to customize the top peice of code I posted to fit my request.
    – Nick
    Dec 11, 2021 at 18:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.