Including PHP code in Menu Item External URL

Need help with the Administration of your Joomla! 3.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.
Locked
Chopstix Kid
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Sat Jul 25, 2015 2:53 am

Including PHP code in Menu Item External URL

Post by Chopstix Kid » Sat Jul 25, 2015 3:16 am

Hello, I'm fairly new to PHP and VERY new (as of today) to Joomla, although I have a good amount of experience in other webdev languages.

Under Menu Manager-->New Menu Item, I am creating an item as External URL and would like to include some PHP code in the URL as follows:

https://mydomain.com/homedir/<?php $user->username; ?>

I have already added the JFactory code in the template override default.php file and have confirmed its proper functionality with an echo statement.

I have tried a variety of formatting styles but I can not get the PHP recognized as code.

As an alternative, I considered using a conditional statement that would insert a code-level URL when the appropriate $item is retrieved. I'd really like to avoid this if possible though.

We have a small employee portal and I trying to create home folders for each of them. If there is a recommended extension that will do the trick, I am all ears. Another employee suggested Community Builder but that appears to be a bit more than we want to explore at the moment.

Thank you all in advance,
Joe

Chopstix Kid
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Sat Jul 25, 2015 2:53 am

Re: Including PHP code in Menu Item External URL

Post by Chopstix Kid » Fri Jul 31, 2015 8:29 pm

Nevermind. I did a workaround by writing some code and putting in in the template override file.


Locked

Return to “Administration Joomla! 3.x”