Contact form miscellaneous information first

Need help with the Administration of your Joomla! 4.x site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Post Reply
User avatar
colin99
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 233
Joined: Tue Nov 22, 2005 6:35 am
Location: Victoria - Canada
Contact:

Contact form miscellaneous information first

Post by colin99 » Fri Oct 27, 2023 9:07 pm

This is likely a template thing - but it would be nice on the contact SPLASH page to have miscellaneous information first.

Is there a quick and easy way to do this?

Many thanks -
Editor-Creator coffeecrew.com | dxer.ca | Coffeecrew.com and a whole bunch of neat websites - Joomla user since DAY 1!

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17510
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: Contact form miscellaneous information first

Post by toivo » Fri Oct 27, 2023 9:28 pm

Are you using the Contacts component that comes with Joomla 4 or a third party extension?
Toivo Talikka, Global Moderator

User avatar
colin99
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 233
Joined: Tue Nov 22, 2005 6:35 am
Location: Victoria - Canada
Contact:

Re: Contact form miscellaneous information first

Post by colin99 » Fri Oct 27, 2023 11:33 pm

Contact component that comes with Joomla 4

and I am reading about template over-rides so I now have a handle on this, thanks! ;-)
Editor-Creator coffeecrew.com | dxer.ca | Coffeecrew.com and a whole bunch of neat websites - Joomla user since DAY 1!

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17510
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: Contact form miscellaneous information first

Post by toivo » Sat Oct 28, 2023 1:52 am

Template override is the way to go. In Joomla 4 they work the same as in Joomla 3. One just has to remember to refactor the code after major version updates, but nowadays Joomla Pre-Update Check reminds about that.
Toivo Talikka, Global Moderator

Peace Freak
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 101
Joined: Fri Aug 17, 2007 2:24 am

Re: Contact form miscellaneous information first

Post by Peace Freak » Thu May 02, 2024 11:21 pm

I'm trying to move Miscellaneous Information to the top of the built-in Contact Form in Joomla 5 using a template override. I've been following this guide: https://docs.joomla.org/J4.x:Template_Overrides

I've added a com_contact override. In default.php, I found the code below, but I'm not sure what needs to be changed. Could someone assist?

Thank you!

========

<?php if ($this->item->misc && $tparams->get('show_misc')) : ?>
<?php echo '<' . $htag2 . '>' . Text::_('COM_CONTACT_OTHER_INFORMATION') . '</' . $htag2 . '>'; ?>

<div class="com-contact__miscinfo contact-miscinfo">
<dl class="dl-horizontal">
<dt>
<?php if (!$this->params->get('marker_misc')) : ?>
<span class="icon-info-circle" aria-hidden="true"></span>
<span class="visually-hidden"><?php echo Text::_('COM_CONTACT_OTHER_INFORMATION'); ?></span>
<?php else : ?>
<span class="<?php echo $this->params->get('marker_class'); ?>">
<?php echo $this->params->get('marker_misc'); ?>
</span>
<?php endif; ?>
</dt>
<dd>
<span class="contact-misc">
<?php echo $this->item->misc; ?>
</span>

SharkyKZ
Joomla! Hero
Joomla! Hero
Posts: 2966
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: Contact form miscellaneous information first

Post by SharkyKZ » Fri May 03, 2024 5:27 am

You have to move the entire "if" block. It terminates with "endif":

Code: Select all

    <?php if ($this->item->misc && $tparams->get('show_misc')) : ?>
        <?php echo '<' . $htag2 . '>' . Text::_('COM_CONTACT_OTHER_INFORMATION') . '</' . $htag2 . '>'; ?>

        <div class="com-contact__miscinfo contact-miscinfo">
            <dl class="dl-horizontal">
                <dt>
                    <?php if (!$this->params->get('marker_misc')) : ?>
                        <span class="icon-info-circle" aria-hidden="true"></span>
                        <span class="visually-hidden"><?php echo Text::_('COM_CONTACT_OTHER_INFORMATION'); ?></span>
                    <?php else : ?>
                        <span class="<?php echo $this->params->get('marker_class'); ?>">
                            <?php echo $this->params->get('marker_misc'); ?>
                        </span>
                    <?php endif; ?>
                </dt>
                <dd>
                    <span class="contact-misc">
                        <?php echo $this->item->misc; ?>
                    </span>
                </dd>
            </dl>
        </div>
    <?php endif; ?>
To have it appear in the form block, you'd have move the code from default.php to default_form.php. Also copy the used variables. They should be placed somewhere before the misc code:

Code: Select all

$tparams = $this->item->params;
$htag2   = ($tparams->get('show_page_heading') && $tparams->get('show_name')) ? 'h3' : 'h2';


Post Reply

Return to “Administration Joomla! 4.x”