Support the ongoing development of Laravel.io →
Configuration Blade

I tried to search for this but couldnt' find it. I'm hoping there is a simple way to do this. I need to be able to display a list of web displayable pages (htm, php etc extentions) I dont' create these files nor do I know what files will be in the directory. I have the route set as such: (please bear with me I am very new to laravel if I mess up I'm sorry)

Route::get('tools', function() { return View::make('tools/index'); });

when I go to /tools I get a list of links:in the views/tools directory there are files (four for now to test) hello.htm, test.php and index.blade.php (and test.junk for verifying I'm only getting the files I want listed

the index.blade.php has the following:

<?php $dir = './tools/'; $files1 = scandir($dir); echo "<br>"; foreach($files1 as $files){ if (strpos($files, ".htm") or strpos($files, ".php")){ echo "<a href='./$files'>$files</a><br>"; } } it all looks very nice. however if I click on the htm file I get a oops something happened error and if I click on the php file I get a no file loaded error for php... Anyone have a suggestion? Again I'm new to laravel, I was wondering if the answer might be in the way routes are built.. but I really have no clue.
Last updated 3 years ago.
0
Solution

If you have static pages you can put them in the /public directory, they will be served as normal files.

Then you can scan the /public/tool directory if you want to list them.

Last updated 3 years ago.
0

thank you.. like I said... very new to laravel... I marked this as solved but I wonder if it really is... part of the problem is I wont be creating the files that are independent. other co-workers will be it's complicated... thats why I was putting them in a subdirectory.. if I put them in a sub off of public. should I be able to pull a directory of that subdirectory and list the appropriate files?

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

xanthakita xanthakita Joined 16 Jul 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.