Link to admin view not working

For Joomla! 3.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Post Reply
infotecnica
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Jan 19, 2024 4:44 pm

Link to admin view not working

Post by infotecnica » Fri Jan 19, 2024 5:10 pm

Good evening, I am a new member and first of all I would like to greet all users.
My problem is this: I'm developing for version Joomla 3.10.12 ( which I will then update to the new versions), a catalog extension and I have a custom admin view (adminlist) for the list of records and another for the detail view (cardview), the code for the link is this:

Code: Select all

<td class = "primo" ><a href="<?php echo'index.php?option=com_cat_prata&view=cardview&id='. $item->id; ?>"><button>Mostra Scheda</button></a></td>
However, it happens that when I click on "Mostra Scheda" nothing happens, but if I copy and paste the link or right-click to open in another tab, the page opens, only structure however without loading the records.
The component is used only on the back end. I thank everyone for the precious help you want to give me.

Michele

User avatar
pe7er
Joomla! Master
Joomla! Master
Posts: 24986
Joined: Thu Aug 18, 2005 8:55 pm
Location: Nijmegen, Netherlands
Contact:

Re: Link to admin view not working

Post by pe7er » Sat Jan 20, 2024 4:18 pm

Welcome to Joomla forum!

Could you try something like:

Code: Select all

<?php 
use Joomla\CMS\Router\Route;
?>
<a href="<?php echo Route::_('index.php?option=com_cat_prata&view=cardview&id=' . $item->id); ?>">Mostra Scheda</a>
Kind Regards,
Peter Martin, Global Moderator
Company website: https://db8.nl/en/ - Joomla specialist, Nijmegen, Netherlands
The best website: https://the-best-website.com

infotecnica
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Jan 19, 2024 4:44 pm

Re: Link to admin view not working

Post by infotecnica » Sun Jan 21, 2024 3:58 pm

Thanks for the reply but I get the following error: syntax error, unexpected token "use"

infotecnica
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Jan 19, 2024 4:44 pm

Re: Link to admin view not working

Post by infotecnica » Sun Jan 21, 2024 4:25 pm

The problem was the button that needs to be moved like this:

Code: Select all

<td class = "primo" ><button><a href="<?php echo 'index.php?option=com_cat_prata&view=cardview&id=1'; ?>" target="_blank">Mostra Scheda</a></button></td>
Now the link works Thanks

User avatar
pe7er
Joomla! Master
Joomla! Master
Posts: 24986
Joined: Thu Aug 18, 2005 8:55 pm
Location: Nijmegen, Netherlands
Contact:

Re: Link to admin view not working

Post by pe7er » Sun Jan 21, 2024 4:26 pm

Good to hear that you've solved it. Thanks for sharing your solution!
Kind Regards,
Peter Martin, Global Moderator
Company website: https://db8.nl/en/ - Joomla specialist, Nijmegen, Netherlands
The best website: https://the-best-website.com


Post Reply

Return to “Joomla! 3.x Coding”