symfony - Symfony2 (version 2.8.13): I am lost on where to place and access my CSS, JS, and Image files -


i'm new symfony2, , struggling rewriting running in existing codeigniter site symfony2 new symfony2 version of site.

after installing symfony2 version 2.8.13, standard edition on remote server, have been able run app.php , app_dev.php pages in computer's chrome browser. used 'create first page' instructions begin learning symfony2, , incrementally applying knowledge begin rewriting old codeigniter index.php page run in new symfony site.

because old codeigniter site used php, css, javascript, jquery, few plug-ins, , codeigniter functions connect supporting database , render output pages, i've decided not rewrite views in twig.

instead i'm using symfony controller house 'logic' of codeigniter controller , view files. later on i'll break controller/view file multiple files of 1 sort or create reusable component files used in codeigniter site, rewritten use symfony2 framework.

with of said, here questions:

1) how 'tell' rendered web-page find third-party plug-in files javascript (js), images, css , other files put under vendor directory? didn't use composer of these files copied on codeigniter site.

2) how 'tell' rendered web-page find non-third-party main.css file put under src/project directory?

3) how 'tell' rendered web-page find non-third-party image files put under src/project directory?

i know javascript, images , css files not tied closely vendor products can placed in few different locations, 1 of app/resources directory, sake of clarity, while i'm still converting codeigniter site pages, i'd rather placed in page-specific directories under src/, @ least me clearer , more direct dumping them resources directory. know of tool automate managing these kinds of files, assetic, no longer automatically installed in symfony2 version 2.8.x, nor convinced make non-vendor files remain tied closely related bundles.

another solution talked creating symbolic link between resources directory , bundle, wasn't sure direction link supposed go , @ directory level created.

can please me understand need respect managing these resources without resorting tools , unnecessary levels of abstraction?

finally, since coming codeigniter, there cheat-sheet of how various things done in codeigniter , how same or similar things should done in symfony2, respect codeigniter function calls?

thank you

=======================================================

follow-up thomas' response.

thank you, thomas.

i'm still not on of symfony terms, yet. when mybundle, find directory?

/var/www/vhosts/symfony2/src/appbundle/controller or /var/www/vhosts/symfony2/app

only app directory has resources subdirectory or put under controller directory in first path?

before use app/console command, want straight.

also, since i'm not using twig, can still use {% %} notation specify html link , img tags there files? said originally, don't want convert html statements twig @ time, html finished , resulting pages want.

thanks again.

p.s., tried respond in comment, doesn't work because takes of line-feeds , spaces out. know there must way add thread without editing original posted question, don't see other answering own question, can't do. kind , please tell me how add own responses thread?

a way using symlinks

first should never put files directly vendor directory can deleted, if composer install/update, , it's not practice @ all.

create public folder in resources folder of bundle using these resources, or in resources folder of app folder.

mybundle/resources/public 

then put resources inside folder, example put js/jquery.min.js

then run cmd , use following command line

app/console assets:install 

with option --symlink

and install assets web folder.

to access assets use {{ asset('myfolder/js/jquery.min.js' }} in twig view example. hope helps.

you can take @ official documentation on using assetic manage assets.

http://symfony.com/doc/current/assetic/asset_management.html

http://symfony.com/doc/current/best_practices/web-assets.html


edit :

i'm still not on of symfony terms, yet. when mybundle, find directory?

when refer mybundle folder assume you've created bundle in app, should maybe take @ page (http://symfony.com/doc/current/quick_tour/the_architecture.html) explains basic architecture of symfony application. generate new bundle basic structure can follow page (http://symfony.com/doc/current/bundles/sensiogeneratorbundle/commands/generate_bundle.html).

only app directory has resources subdirectory or put under controller directory in first path?

when create new bundle application steps described in link gave you'll have resources directory in bundle folder. (if don't need create new bundle in app can use appbundle directory symfony create automatically)

also, since i'm not using twig, can still use {% %} notation specify html link , img tags there files? said originally, don't want convert html statements twig @ time, html finished , resulting pages want.

symfony comes twig it's templating engine if don't want use can. think link may (http://symfony.com/doc/current/templating/php.html) should know {% %} twig syntaxe think won't able use if you're not using twig.

hope helps.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -