Home How do I use Joomla article variables inside modules?
Reply: 1

How do I use Joomla article variables inside modules?

Emiel
1#
Emiel Published in 2018-01-09 16:08:01Z

For getting the article alias of the current/active article, I can use

<?php echo $article->alias;?>

This will work fine if I put that code inside the article itself. However when I put this code inside a Joomla module, it echos nothing; Not even when I insert the module inside the article itself (with Modules Anywhere from Regular Labs).

How can I make use of the Joomla variables (or this one in particular) within a module?

Many thanks!

Emiel
2#
Emiel Reply to 2018-01-14 18:40:23Z

For now I have found an alternate solution that seems to give me the desired result.

<?php $alias=basename($_SERVER['REQUEST_URI']);?>

<?php echo $alias;?>

This apparently returns the last part of an URL string (everything behind the last slash).

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.347535 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO