Custom field for the Template, or how to correctly use my component parameters

More
2 months 2 days ago #12334 by AmbroseVideo
AmbroseVideo created the topic: Custom field for the Template, or how to correctly use my component parameters
We're using the template as a "portal" for a parent main site, so the the url that is used for the logo image needs to point to a different website than that of the current website.

I've tinkered with the code, but I break the "inner workings" when I try to get the parameters from a custom component, and cannot figure out how the site logo and description are configured to appear in the template style settings.

The field I need is essentially identical to the Logo Text, but is a url instead of the text. Can you give me some direction to make this customization?

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

More
2 months 2 days ago #12335 by marcin
marcin replied the topic: Custom field for the Template, or how to correctly use my component parameters
Hi,

The logo code is located in /templates/jm-education/tpl/blocks/bar.php
Simply change the href attribute of the anchor before the logo image.

Regards,
Marcin

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

More
2 months 2 days ago #12336 by AmbroseVideo
AmbroseVideo replied the topic: Custom field for the Template, or how to correctly use my component parameters
I realize that, but my requirement goes beyond just the logo, so would like to parameterize things. Calling a helper would be ideal, but parameters "seemed" like an easier approach when I started.

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

More
2 months 1 day ago #12337 by marcin
marcin replied the topic: Custom field for the Template, or how to correctly use my component parameters
Hi,

If you need to get a parameter from your custom component, you can use the code:
$app = JFactory::getApplication('site');
$componentParams = $app->getParams('com_example');
$param = $componentParams->get('paramName', defaultValue);

Regards,
Marcin

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

More
2 months 1 day ago #12338 by AmbroseVideo
AmbroseVideo replied the topic: Custom field for the Template, or how to correctly use my component parameters
I swear to God I did that many different places and times. Cutting/Pasting your code worked though, so I clearly had some typo in my code.
Thanks for your patience and "code review"!!

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

More
2 months 1 day ago #12339 by AmbroseVideo
AmbroseVideo replied the topic: Custom field for the Template, or how to correctly use my component parameters
WAIT! This breaks the Template settings in the backend, that's why I put in this question. The standard code to get parameter works on the front end, but then template settings no longer work. See screenshot.
Attachments:

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

Time to create page: 0.286 seconds

INDICO S.C.

ul. Wałowa 10/3, 84-200 Wejherowo, registered in Centralna Ewidencja i Informacja o Działalnosci Gospodarczej
NIP/VATID: PL5882424318

Copyright © 2009-2019 Joomla-Monster.com All rights reserved.

Joomla-Monster.com and this site is not affiliated with or endorsed by The Joomla! Project™. Any products and services provided through this site are not supported or warrantied by The Joomla! Project or Open Source Matters, Inc. Use of the Joomla!® name, symbol, logo and related trademarks is permitted under a limited license granted by Open Source Matters, Inc.