when I open "http://localhost/app/public/"
the default laravel home page works perfectly which is a welcome page where in the routes file there is this:
Route::get('/', function () {
return view('welcome');
});
but I'm learning so I just changed the "welcome" to "home" and created a new file resources/views/home.blade.php with the following simple code:
<?php
echo 'hello world of laravel';
?>
but when I open "http://localhost/app/public/"
it shows a blank page.
what am i missing?
You should setup your web server so it point to public directory and then access the app through http://localhost/
Try to change your home.blade.php to just html, remove this
<?php
echo 'hello world of laravel';
?>
and try something like:
<h1> Hello, world! </h1>
and see if works :)
This is the solution open .env file make sure no space in your app name.The app name should be one word for example AppOne not App One
Related
I cannot get laravel blade view to work, removing the blade from file name makes it work. I am using laravel 5.2.22.
Here are the details:
Here is the route:
Route::get('/', function () {
return view('login2');
});
Location and file name of 'login2': /resources/views/login2.blade.php
Inside of login2.blade.php:
<?php
echo "a";
As soon as I change the "login2.blade.php" -> "login2.php" it works.
Any ideas?
I changed rights for folder storage to 777 and now blade views work.
Try to close tag:
<?php echo "a"; ?>
Blade template files are parsed with a template engine, so you need to close tag if you're using raw PHP inside a template.
I use Froala Editor for my project cakephp
I've done every step as in the guidelines, but the results are not as expected
I downloaded it and follow the instructions as here enter link description here
download and put Froala folder in app/Plugin/
in boostrap.php i have loaded CakePlugin::load('Froala');
in controller: i have put line: public $helpers = array('Froala.Froala');
in view: my code is
<div id="froala-editor">
<p>froala-editor</p>
</div>
<?php $this->Froala->editor('#froala-editor'); ?>
but Froala editor not appear, Please help me!!!! Thank so much
I think, today Froala have release a solution for Cake php 3 which might help your problem.
https://github.com/froala/wysiwyg-cake
Do this:
open terminal/command prompt (windows)
type composer require froala/wysiwyg-cake enter
open bootstrap.php (confic folder)
add Plugin::load('Froala'); to the end of page
open AppController.php (your project/src/controller/AppController)
Declare variable public $helpers = array('Froala.Froala');
In the view page (template) you add <?= $this->Froala->editor('#froala-editor'');?>
I have a project in laravel5 and I have directed virtual host on /public directory. Where should be my main page index.php now? There is some index.php in public folder already but it contains some content that I dont understand. So where should be my index now? Maybe in views?
If you are using Laravel 5.1 then your initial page should be this resources/views/welcome.blade.php.
You can change it to any name. But also you should change the same in your Controller.
Note : If you are rendering the view through controller then you should have the file name like this yourfilename.blade.php
Your views should always inside resources/views/*
The index file stays at the same place, to call a new file that you made, could be with HTML, you can put that file in the view and call it from the controller, hope this is the answer you are looking for.
When a request come to your server, the first file that it is executed is index.php. But this is not the file shown. In Laravel you don't have to force any file be named index.php. So let's imagine that you are trying set up a new index file. You have to use routes.php
routes.php
Route::get("/" , "HomeController#index");
HomeController.php
function index(){
return view("home/index");
}
views/home/index.blade.php
<html>
<head>
</head>
<body>
<p>Index page</p>
</body>
</html>
When a GET request to "/" it's done, the index function of the HomeController it's executed and the view index.blade.php, stored in views/home it's shown.
This it's the basic behaviour of Laravel. So you mustn't rename or move the index.php file in public folder.
I have a codeigniter project that is already up and running perfectly on the client server, now after I changed my laptop and installed xammp 1.8.2 the project is not working correctly,
the index page works just fine, and when I try to log in it only displays these two lines
load->view('header');?>
load->view('side_menu'); ?>
These two lines are the only php code in the view Home.php ,so the problem is that load view function in the controller loads the view "Home.php" but only displays the php code
The hierarchy is:
application
controller
main_controller.php
view
home.php
and attached a screen shot of the displaying
Could any one help me with that???
Thanks in advance
Given your example, You will need to open your php document with <?php and end it with ?> (not on each line as you have it.)
You will also need to use $this from the controller class.
<?php
$this->load->view('header');
$this->load->view('side_menu');
?>
Guys I'm a newbie to code igniter.. I do not understanding how to use this framework. Its just opening the user guide. Can anyone tell me the steps I need to follow to execute the "hello world" program on code igniter?
Make a file called hello.php in your system/application/controllers folder. In the file, put this code:
<?php
class Hello extends Controller
{
function index()
{
echo 'Hello world!';
}
}
?>
Then go to http://localhost/codeigniter/index.php/hello , and you should see the hello world. (You might've put it in a different directory than codeigniter, so change the url as needed).
Then you can change the code to:
<?php
class Hello extends Controller
{
function index()
{
echo 'Hello world!';
}
function test()
{
echo 'Second hello world!';
}
}
?>
and going to http://localhost/codeigniter/index.php/hello/test would run the 'test' function from the class.
Using .htaccess and mod_rewrite you can remove the 'index.php' from your url, so you would only visit http://localhost/codeigniter/hello or http://localhost/codeigniter/hello/test.
Dont mistake code igniter with an IDE.
code igniter is a frame work, not an itegrated development enviroment (IDE). An example of an IDE is ECLIPSe. An IDE will have a text editor, mabee some syntax highlighting/bug checking/and even compiling capabilities..
A frame work on the otherhand is a set of functions/classes/scripts that contains code that you can reuse to make your life simpler, or to give it order.
So assuming you have downloaded code igniter and have it on your webserver, you can use the previous users instructions.
My advice is to watch/listen to the video tutorials avaliable here: http://codeigniter.com/tutorials/ and http://video.derekallard.com/ and make notes on them. Should show you how codeigniter works.
<html>
<head>
<title>Codeigniter</title>
</head>
<body>
<?php
include "index.php";
class hello extends CI_Controller
{
function index()
{
echo "Hello world!";
}
}
echo "head<br>";
$t = new hello();
$t->index();
?>
</body>
</html>