I thought I have Symfony all up and running ok on the VM machine I've been trying to set up. However after following the instructions on this link:
http://symfony.com/doc/current/book/installation.html#configuration-and-setup
I'm not getting reassuring 'welcome' page in the screenshot. Instead, I just see an empty page with 'Homepage.' written in the corner. The underlying HTML is:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Welcome!</title>
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
</head>
<body>
Homepage.
<div id="sfwdtc2fded" class="sf-toolbar" style="display: none"></div>
<script>
/* [editor's note: the JS code of the toolbar has been removed] */
</script>
</body>
</html>
I get exactly the same whether I go to: http://localhost/app.php or http://localhost/app_dev.php
Does anyone know what could be causing this? The link http://localhost:8000/config.php works perfectly and I have no errors there (just one recommendation to install INTL extension but I don't suppose that's the problem).
You've probably installed Symfony 2.6, which had an AppBundle delivering your this page. You can comment the line registering the AppBundle in app/AppKernel.php to see the demo homepage.
I had the same problem and solved it by running
composer require symfony/framework-bundle
and it seems to have solved me problem.
Related
This question already has answers here:
Where to put css file in laravel project
(6 answers)
Closed 2 years ago.
I have been trying to access it like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
</head>
<body>
<div class="red">
#yield('content')
</div>
</body>
</html>
I put the background red in the css file but nothing is changing. Any help is appreciated
You need to install laravel mix. As it is added in the package.json in fresh installation of laravel, follow below steps:
run npm install to install package that are added in package.json more
add mix.css('resource/css/app.css', 'css'); to the webpack.mix.js file more
run npm run dev to compile files that are addressed in webpack.mix.js more
link to your app.css as {{ asset('css/app.css') }} in the desired blade file.
Notice: You need to run npm run dev after any changes that you make in the resource/css/app.css file. Or benefit from npm run watch which complies automatically after any changes.
Notice: Press ctrl+f5 to clear cache after every change or use cache busting
put it in public/css and use it like this:
<link rel="stylesheet" href="{{ asset('/css/app.css') }}">
clear your browser cache, and make sure that directory of CSS file was public/css
I am trying to add google map search capability for my project and i found a very nice react code for this (https://github.com/ubilabs/react-geosuggest) but i couldn't add this to symfony 4 based admin panel.
To understand what is wrong i created a new symfony 4 project and just added one controller and a twig template.
Generally i followed the following tutorials
https://www.thinktocode.com/2018/06/21/symfony-4-and-reactjs/ and
https://symfony.com/doc/current/setup.html
But when i ran the example i got the following result
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Welcome!</title>
</head>
<body>
<div id="root"></div>
<script type="text/javascript" src="/build/app.js"></script>
</body>
</html>
As you can see, it is just the same code with the index.html.twig; there is no change. React didn't change anything instead of i expected.
This tutorial is not the one i just tried.Also I tried, React Getting Started tutorial and other Symfony 4 + React examples but the result was always same.
You can access the source codes from here:
https://github.com/bahadirarslan/Symfony4ReactProblem
UPDATE
I also tried steps described here https://artemzhuravlev.com/blog/symfony-reactjs-using-encore/ but couldn't make it.
The only thing i want to mention, when i try to run npm install i always get EACCES: permission denied error so i am running npm install with sudo and --allow-root attributes like described here https://www.fahidjavid.com/fix-error-eacces-permission-denied-mkdir/
Finally i found the solution with helps Vincent Le Biannic (https://github.com/Lyrkan) at github.
He took my attention to lines below at webpack.config.js
// will require an extra script tag for runtime.
// but, you probably want this, unless you're building a single-page app
.enableSingleRuntimeChunk()
This config make necessary to call runtime.js (which was generated by encore) in html file.
But adding only runtime.js didn't help so i also added vendors-app.js and voila!
Interestingly neither symfony's original documentation nor any tutorial about this subject don't contain any single line about this situation.
If you see an EACCES error when you try to install a package globally, you can either:
Reinstall npm with a node version manager (recommended),
or
Manually change npm’s default directory
Source : https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
The same problem for me
I added the line the twig header
<script type="text/javascript" src="{{ asset('build/vendor/app.js') }}"></script>
and it works
I am having some trouble getting a php value into a bootstrap button which is in html
This is my code:
<html>
<head>
<title>Samples</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
</head>
<body>
<?php echo "Samples"; ?> Stuff
</body>
</html>
So instead of the button saying "Samples Stuff" - the button just simple says "Stuff". It is important that the button takes a php value as eventually I will be putting a db value in the button - but I can't even get the basics working
Why is it not working?
Are you running a locally hosted server. If not, you probably should install XAMPP. Ensure the file has a .php extension, I don't see any other reason why a simple echo would not work.
Make sure that the file extension ends with .php. Also make sure that your php/apache is configured correctly.
Try and look at your error logs and see if anything is there
Firstly ensure that your file extension is .php secondly make sure you run .php files on a php enabled webserver. Simply viewing php files on your browser will not actually compile the php. This is done in the back-end on your server.
Using this exact code I've been able to create text fields in HTML, but when I convert (rename) the file to PHP the field dissapears. Why does this happen and how do I stop it?
Code:
<!DOCTYPE html>
<html>
<head>
<title>StatsCalc V1</title>
<link rel="stylesheet" type="text/css" href="Buttons.css">
<link rel="icon" type="image/png" href="favicon.ico">
<link href='http://fonts.googleapis.com/css?family=Raleway:500' rel='stylesheet' type='text/css'>
</head>
<body>
<form>
<input type="text" class="writies" name="writy1" />
</form>
</body>
</html>
make a new file index.php write in it the bellow code and if it shows something you have php installed if not you don't have.
To have php installed you either install manually apache + php or you download a ready made application like xampp or ampps or easyphp which will provide you with everything you need to begin learning php.
tutorial for install of course you can choose any other.
<?php
phpinfo();
I have a strange problem with Yii & Jquery:
When I open a page which uses ajax/jquery on localhost Yii does automatically add asset include calls to the of the page:
<link rel="stylesheet" type="text/css" href="/PATH/assets/f72b359d/style.css" />
<script type="text/javascript" src="/PATH/assets/2e442e1a/jquery.js"></script>
<script type="text/javascript" src="/PATH/assets/2e442e1a/jquery.cookie.js"></script>
However when I run same code on the server Yii does not do it hense no Jquery available.
I'd appreciate if someone could direct to a way to solve it.
It seems like you're not registering jQuery in the correct way. You must add the following line in /protected/views/layout/main.php before </head> tag:
<?php Yii::app()->clientScript->registerCoreScript('jquery'); ?>
It will load jQuery automatically. Remember, if the YII_DEBUG flag is on it will load non-minified version, when deactivated (on production) it will load minified version. Hope this will fix your problem.
If all is working on your local machine it might be a permission problems
Have you checked that /assets is writable on your server ?
Yii publishes the assets it needs at runtime in this directory