TransWikia.com

Integrating HTML pages to laravel

Stack Overflow Asked by user11195802 on December 23, 2021

I integrated HTML template with multiple pages to my laravel project. The main page is working finely but when I click the links in the main page it isn’t opening the other html pages. But when I type the URL the page is opening up.
Some of my routes code is as follows :

Route::get('/', function()
{
    return view('index');
});

Route::get('icons', function()
{
    return view('icons');
});

Route::get('404', function()
{
    return view('404');
});

Route::get('500', function()
{
    return view('500');
});

Route::get('accordion', function()
{
    return view('accordion');
});

Route::get('alerts', function()
{
    return view('alerts');
});

Route::get('avatar', function()
{
    return view('avatar');
});

Route::get('background', function()
{
    return view('background');
});

Route::get('badge', function()
{
    return view('badge');
});

Route::get('blog', function()
{
    return view('blog');
});

Route::get('border', function()
{
    return view('border');
});

These are the HTML pages, I convert it to .blade.php extension :

enter image description here

An example for the links in my main page is as follows :

<li class="side-item side-item-category">General</li>
                        <li class="slide">
                            <a class="side-menu__item" href="icons.html"><svg xmlns="http://www.w3.org/2000/svg" class="side-menu__icon"  viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M12 4c-4.42 0-8 3.58-8 8s3.58 8 8 8 8-3.58 8-8-3.58-8-8-8zm3.5 4c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5-1.5-.67-1.5-1.5.67-1.5 1.5-1.5zm-7 0c.83 0 1.5.67 1.5 1.5S9.33 11 8.5 11 7 10.33 7 9.5 7.67 8 8.5 8zm3.5 9.5c-2.33 0-4.32-1.45-5.12-3.5h1.67c.7 1.19 1.97 2 3.45 2s2.76-.81 3.45-2h1.67c-.8 2.05-2.79 3.5-5.12 3.5z" opacity=".3"/><circle cx="15.5" cy="9.5" r="1.5"/><circle cx="8.5" cy="9.5" r="1.5"/><path d="M12 16c-1.48 0-2.75-.81-3.45-2H6.88c.8 2.05 2.79 3.5 5.12 3.5s4.32-1.45 5.12-3.5h-1.67c-.69 1.19-1.97 2-3.45 2zm-.01-14C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/></svg><span class="side-menu__label">Icons</span><span class="badge badge-danger side-badge">New</span></a>
                        </li>

When I enter http://localhost:8000/icons the icons page is opening up.

My pages are inside views folder and assets are into the public folder. Can somebody help me on fixing this??

3 Answers

Simply convert href="icons.html" to href="{{ url('icons') }}" and it will work.

When anytime you want to redirect to any page you must either used "url" or "route" (if you have specified name to route).

Answered by Raj Kale on December 23, 2021

Replace href="icons.html" with href="{{ route('icons') }}" // Route name that you have assigned in the web.php // Route file.

Use For icons      =  href="{{ route('icons') }}"
Use For accordion  =  href="{{ route('accordion') }}"
Use For avatar     =  href="{{ route('avatar') }}"
Use For background =  href="{{ route('background') }}"

Answered by Muhammad Yaseen on December 23, 2021

Your link to icons.html is wrong. This should be:


 <a class="side-menu__item" href="{{url('/icons')}}"></a>


Answered by Keith Mifsud on December 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP