0

I bought an template with HTMLs files, CSS and Javascript. Now I want to use Laravel 5.4 so I have resources folder and public folder. After reading this

Click here to redirect to the topic

I understood that all my CSS, Javascript that the template gave me I have to put into my public folder.

What is the problem? My index page (the page that is opened when the user enter in my site www.mysite.com) has to connect to the server to get some staditics data, and the index page is in public folder! If I make a controller for my index I need to put it into resource/view folder with index.blade.php

If I put my index page into resources/view my browser alway redirect to the index of public folder so... I have a Headache for all of this, can you help me to solve my problem?

I think I'm not the first one that need to make a index with a controller to connect to my server.

Thanks!

10
  • I'm not sure I get your issue. Your template needs to be converted to blade syntax and use a controller to pass data to it for it to handle. How else would it work? Commented Jan 29, 2017 at 23:26
  • My template works only with html css and js, not need data to pass at today. I need to do that because in the template now is harcoded some value that now I need to get from my server Commented Jan 29, 2017 at 23:28
  • So just create a route to index.blade.php and put the code from the template file into that and update the directories? Commented Jan 29, 2017 at 23:29
  • /public/ is for files you want to serve publicly like CSS, JS, images etc. Commented Jan 29, 2017 at 23:30
  • haha something like that yes. I put my index.html to my new index.blade.php, but now I have to redirect all my href css and js in my index.blade.php to ../public/css and ../public/js and I'm not sure that it is ok Commented Jan 29, 2017 at 23:30

1 Answer 1

1

As per our conversation in the chatroom, it appears that you modified the index.php file that resides inside the public directory. This file shouldn't be changed or modified, this is partly what powers your Laravel app.

What you need to do is create your blade views, create a controller to return the view and create a route to that controller/view and you should be okay.

The public directory should only be for things you want to serve publicly - such as CSS files, JS files and template images. The actual structure code should be split into Blade views :)

Hope this helps!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.