symfony2 how to access app/Resources/img from browser? - image

I've got some project specific images that I don't want to include in any bundle. I'd like to have them accessible from twig layer. The question is: how can I publish them (I can see neither symlinks in web directory nor assetic config in my project). Any hint will be appreciated.
edit:
When I run
php app/console assets:install help
I get Installing assets for XxxBundle into web/bundles/xxx, but nothing happens for the app/Resources directory.

If you really don't want to put them in a bundle you can just place them directly in the web directory. E.g. image.jpg placed in web/appImages/ can be displayed in a template using img src="/appImages/image.jpg" />.
Nevertheless "the Symfony way" encourages you to keep everything within bundles. If you don't want to have the Resources in one specific bundle where your code lives you can have a separate bundle specifically for the application-wide resources.

You can publish items in the app/Resources/img by doing:
php app/console assetic:dump --env=prod --no-debug
from the root of the project.
That is where you place system wide libraries.

Related

What is the most direct way to push a site update to Laravel?

I've SSH into the server and into the Laravel folder. I updated one of the html footer files but the changes aren't reflected on the website. I feel like I probably need to recompile something.
I tried deleting and re-creating the .env file (I backed it up first).
I've tried running the following commands:
php artisan clear-compiled
php artisan optimize
php artisan cache:clear
The only way I can seem to update the site is by updating the main.min.js file, located at /laravel/public/assets/js/main.min.js which is a terrible way to update the site.
How do I force Laravel to recreate this file or recompile the site based on changes I made to html template files within the site?
What am I missing here? I don't have any Laravel experience and am trying to update this site for a client.
edit:
I think I need to clarify a bit more...
The site appears to be rendered from this file: /public/assets/js/main.min.js
Most of the site's homepage, for example, is located in this js file. But the file is minified and therefore unwieldy to edit directly.
I am assuming (and I could be completely wrong here) that the file is generated from the html files located in the Laravel folder. To support this notion, I have found html files in other directories that correspond to the html located in the main.min.js file.
My assumption is that the previous developer would update the html files and then run something to compile the site into javascript files. But maybe this has nothing to do with Laravel, per se, and more to do with some frontend framework?
Try clearing the cached views...
php artisan view:clear
Laravel assets reside in
resources/assets/js
of your root directory you can have look their
if your file main.js is build using laravel mix have a on webpack.mix.js which compiles all your files you can get idea from that. make sure to run
npm run prod
if you change any file
Hope this helps?

Laravel FileZilla upload/download

Is there a proper explanation as to why when I'm either pulling the complete project from the server, or pushing it on server, views don't get updated? I always have to manually go to the resources folder and transfer views after everything has already uploaded/downloaded.
The solution is to clear your cache like stated in the comments.
php artisan view:clear
The reason why this is happening is because by default the caching is set to File. Which means that the view-cache is stored in files. When you upload everything the old-cache is uploaded. The files are stored in storage\framework\views
If you upload a single folder, laravel notices a change and the cache is busted.
PS: it is recommended that you use git for this kind of stuff, Laravel has .gitignore files to prevent this kind of behavior.

Simple "static" Ruby sites?

For early development, I typically build out a static version of the site. Previously I'd use PHP and have something like...
images
javascripts
stylesheets
templates
-- header.php
-- footer.php
index.php
users.php
And the index.php and users.php would have some basic PHP include code for those header and footer files.
I also got the added benefit of being able to use a few PHP functions.
But I haven't used PHP for anything in ages and use Ruby almost exclusively...so I'm wondering, is there a way to pull off something really basic like this in Ruby?
Primarily looking for something that allows me to:
Do basic file includes (so I can create simple templates)
Run Ruby inside the files
Ideally I could also use LiveReload with it.
Additional details: I'm running this locally on OS X and I typically use Pow as a server.
Peter is right to recommend Sinatra. There are typically two types of Sinatra applications. Modular and classical. For your example, I'll create a classical application. It isn't much work to convert it to a modular if you find that style would better fit your needs.
You'll want to install the gem with gem install sinatra. Create a new directory for your project and two new files as follows:
# app.rb
require 'sinatra'
get '/' do
erb :index
end
# config.ru
require './app'
run Sinatra::Application
Create another directory called views and add this file:
# index.erb
Hello World!
Then type ruby app.rb and viola, you now have a working project on localhost:4567/.
To serve static files like css and js, just create a public directory. From there, any file will be able to accessed after the root url. So if you created a css folder, its respective url would be: yourdomain.com/css/styles.css.
So the entire directory would be as folllows:
app/
app.rb
config.ru
public/
css/
js/
images/
views/
index.erb
Between the Sinatra Book and the read me, you should be able to find all the info you need.
To accomplish the templates, you'll need something called Sinatra Partial.
I'm not too familiar LiveReload but it seems like Compass accomplishes the same thing and has great integration with Sinatra. So long as pow is a rack based, you should have no problem using it.
Here is a Sinatra Bootstrap I use for all my projects. It has Compass and Sinatra Partial preconfigured and makes it really easy to deploy with Heroku. It also uses Slim, Coffeescript, Thin (as the server), Twitter Bootstrap and Sass but it shouldn't be too much work to sub that with your respective favorites or remove them all together.
I gifted my girlfriend a website with her domain name, I chose Jekyll for the job which uses RubyGems for the purpose.
It was easy and fun. Moreover you have lots of themes available which you can configure with .YML files just changing there will work for hole site. Although Linux or Mac OS is suggested by official Jekyll website but i did it in windows which was not much of a problem. They have steps defined for working on windows on their website.
http://jekyllrb.com/
The best part was that i could host the website via the git hub pages only. I didn't have to buy anything. Git hub allows you to host one repo. (funFact : Jekyll was developed by github inventor)
That's the one i used and made the website in 20 hours with no prior knowledge of Ruby and Jekyll.
So i will suggest you check it out!
Perhaps Jekyll will fit the bill?
Its description:
Jekyll is a simple, blog aware, static site generator. It takes a
template directory (representing the raw form of a website), runs it
through Textile or Markdown and Liquid converters, and spits out a
complete, static website suitable for serving with Apache or your
favorite web server. This is also the engine behind GitHub Pages,
which you can use to host your project’s page or blog right here from
GitHub
Yes, i use Sinatra for this, see https://github.com/sinatra/sinatra/ for some samples.
Running ruby inside the files isn't very static but in Sinatra you can do both.
Jekyll won't leave you run Ruby code "inside" the files. Jekyll is a parsing engine bundled as a ruby gem. You basically code templates using HTML and Liquid and write content using markdown that gets embebed generating plain HTML files that you can upload to any web server.

code igniter framework guidance for beginners

I am just a beginner in code igniter. I have just downloaded the code igniter framework. But i don't know that where should i keep my html, php files and stylesheets, images etc. Is there any procedure to do the things? Please guide me.
CodeIgniter has an awesome user guide that will come with the install you can read through (or read it online at - http://codeigniter.com/user_guide/ ), or you can watch some of the videos on their site - http://codeigniter.com/tutorials/
In comparison to most other frameworks you're going to find they have maybe the smallest learning curve and great documentation. I would also recommend learning basic PHP and getting familiar with your web environment maybe before beginning.
I used these tutorials to help get me started with the framework haven't look back since! http://net.tutsplus.com/sessions/codeigniter-from-scratch/
hi I am a weekend coder and picked up CI about a year ago.
It helped me a lot.
The best tutorial I found was on the IBM's developer site. It runs through putting together a simple application. Admittedly, there's nothing in it about directory and file placement but it helps cement ideas about how models, views and controllers (MVC), and why MVC is so helpful. Because the basic idea is quite simple, it's worth running through a simple CI tutorial again and again till you 'feel' or intuit the basic helpfulness of the setup.
Things like JS, CSS files can be kept in their own folders at the first level of your website folder e.g /js or /css or /images. You ask about PHP files as well. PHP files which you, the coder, write, are either 'views', 'models' or 'controllers'. These go in the folders with those names in the /application folder e.g /application/views/yourview.php or /application/controllers/yourcontroller.php. The CI install comes with a default view file and a default controller, which you are probably already aware of.
The files inside /application/config are important as well. Read the user-guide about tweaking these files. The most obvious tweaks are to database.php to connect to your db, autoload to give automatic use of CI helpers/libraries which you can choose, and to config.php to give CI the name of your website e.g the name you give to '/'.
The file 'index.php' comes with the CI installation (/index.php). You don't need to fiddle with it at all really except to determine the level of error reporting you want ('environment') and that's not a priority at all. But it's important to remember this about index.php - that CI uses it as the essential reference for defining paths to useful folders like CSS or images. So even if your view file is in /application/views, if it refers to an image like a logo.gif in /images for example, the path to it is just /images/logo.gif. It is not anything more complicated like ../../images/logo.gif.
I hope that helps.
Tom
Offline version of CodeIgniter user guide is available with CodeIgniter which already downloaded by you.
just extract your CodeIgniter zip file in your localhost server root directory,
Then http://localhost/www/CodeIgniter_2.1.2/user_guide/ open this url with browser ,here you can access offline version of CodeIgniter user guide.
Here I am using wamp server so I used this url, If you are using xampp server then please use http://localhost/CodeIgniter_2.1.2/user_guide/
Okay this is what I would usually do for code igniter
here is my directory structure.
CI App Path (e.g "c:\xampp\htdocs\ci_app_name" )
-application
-system
-assets
--css (new folder , where css files will be included)
--js (javascript and jquery libraries location)
Basic HTML and PHP files should be location
CI_app_pah
-application
--views (this is where to put HTML and PHP files)
For other things such as Controller , Models and Views , you can't put any where but put in their related area.
That will be
CI app
-application
--controllers
--models
--views

wkhtmktopdf on shared hosting does not return any data...?

Hi friends currently i m working on a small business project.
for this project i need to convert my dynamic html page into a PDF file..
I googled for html to pdf and found wkhtml...
in my local-host system its works like charm..
But in my shared server it does not gives any output... errors also. when php wrap execute, it fails silently..
Any idea guys??
another thing.. In my shared hosting, they are disabled exec,proc_open and other process related functions, So i used .htaccess file to point another php.ini for reconfiguring the disabled_functions.
Because your hosting provider has disabled the exec methods, I'm sure they won't be pleased to find out you're trying to use wkhtmltopdf. It might be a good idea to contact them about your plans.
When downloading wkhtmltopdf, make sure you grab the right package (based on the server specs). Your best bet is to use one of the static packages as it provides most of the libraries needed to run wkhtmltopdf. You might also need to change the file permissions to be able to execute the file.
Lastly, make sure your custom php.ini is even used by php (calling phpinfo() will do the trick).

Resources