I have several symfony apps (different vhosts) with the same skin, i.e. layout.php. I have one instance of the layout.php and asset files "someplace," and I symlink them into each app.
I would like to use Google Analytics with these apps, which requires each app to include its own key. How can I inject it into the layout.php?
Best answer I could come up with is to set the analytics JS code as a slot in myActions::preExecute() and extend sfActions. Anyone have a better idea?
Many thanks!
Why not just use an sfConfig value to set the tracker id? Then the value can be configured in the app.yml file for each app.
Related
I am new to canJs. Looking for a good application structure for building a canjs app. I would like to separate the Model, controller and view/template logics to separate folders. The todo app available in canjs site is a simple one which has everything written on a single file. Any help is appreciated.
Thanks in advance
Justin Meyer always says "The secret to building large apps is to NEVER build large apps. Break up your applications into small pieces. Then assemble those testable, bite-sized pieces into your big application."
Let's assume that I have 2 models in CRUD app, so we can break the app into small apps lets say accounts app, transactions app, each app is broken into small testable pieces so the adviced structure:
in this example accounts and transaction are traditional controller that listen to can.route to update the state of the app; list, edit ...etc are views that are extended from control too but they listen just for their events (Single responsability principal) the communication between the different controllers and views is made by can.Map and can.compute (Observer pattern) to make them decoupled, take a look here and here this can be helpful too.
Previous answer is quite good but you can do it automatically by using yeoman.
You can also use yoeman to create your canjs application structure automatically.
All you need to do is in your terminal type this commands:
npm install -g yo
yo canjs
and write the directory and app name it will be asked during the app creation.
If you want to add AMD support then type Y when you have been asked for requirejs.
For more information visit yeoman website
I would like to include static content as part of my normal rails views e.g. marketing content which can be text or images or both.
I would want marketing content to be separate from my rails code so that it can be separately updated.
I do not want to use content management systems.
Oh and I cannot not use DB, its an api driven app.
Is there a proper rails way of achieving this?
Update:
sorry for not being clear. I can probably explain it better with an example: I need to place some images/text on my login screen that are not part of my apps source code. That live some where on the server that can be updated async without going through my apps revision control system so they cannot be in the public folder of my app
You can put your static marketing content in the public folder of your rails app. Your question is a little unclear and so I'm assuming you are creating a rails app to do api stuff and then have static marketing content/website.
I need to be able to serve different versions of my whole site per client. Certainly beta vs production but it would be nice to serve one or two prior production versions. Client customization is encouraged and I don't wish to force all clients to follow the (anticipated) pace of development.
Which version to serve is stored in the db.
From what Ive read so far a custom view engine may be the most straightforward way to accomplish this but before heading down this road I would welcome any advice and comment.
Thanks for insight!
Eric
EDIT: It isn't just the views that are different; controllers, master pages, images, CSS...
If the rules regarding which version is displayed to which user, I'm guessing they need to authenticate first. If that's the case you'll have opportunity to set a cookie on the user.
I would probably set a cookie on authentication that determines which version to show the user and then use a URL Rewriter like IIRF to direct requests with that cookie set to the beta version of the site.
Has the added benefit of users being able to opt back to the production site if they have issues with the beta.
I went down the view engine route How do I implement a custom RazorViewEngine to find views in non-standard locations?
Basically it's pretty stright forward, we have the same controllers models, etc. All the code is shared. The rendering of the views though is based on a "brand". So the view engine is clever enough to say if I'm brand A then the view will live in {standard view location}/brand/viewname.
It's hierachical though so if the view is in the branded folder it uses that one, else it falls back to the default location. It's basically an extension of the standard model used by MVC to find the location of the view source.
I am trying to create a portfolio site and am stuck finding a good approach to deal with images. I have integrated the SonataAdmin Bundle and have setup Admin classes for "Projects" and "Images". My goal is to go into a Project and add images to it and select one of these images as the Project thumbnail.
Ideally I would like to integrate an AJAX multi-uploader. I am not sure the best approach for this and am looking for any suggestions / thoughts.
I have looked at the Sonata Media Bundle, though it seems more robust than I actually need and the learning curve to customize it seems a bit steep. I have already setup an image entity (symfony2 cookbook for uploading documents) I imagine I can create a many-to-one on images and projects rather than using the MediaBundle, though I am still at a loss of how to integrate an AJAX script for this.
Thanks in advance for any advice!
Shawn
I suggest you to look at https://github.com/punkave/symfony2-file-uploader-bundle
This bundle is based on the excellent blueimp jQuery-File-Upload package and provides multiple file uploads.
Edit 28/04/14: There is now also OneupUploaderBundle which supports a variety of uploaders and seems to be under more active development.
checkout https://github.com/ruian/RuianUploadifyBundle its support multiupload but only with flash plugin.
Also this bundle is worth a shot. Not really mentioning AJAX, but seems really strong in basic uploading features. Once you get that done, you can ajaxify by yourself. I'm planning to try this bundle in few days, I may update this answer later.
So I endedup using Valumns Ajax multi uploader: http://valums.com/ajax-upload/
I tried to customize the Sonata Admin Page but this proved a bit difficult, Instead I simply created a route / controller / view specifically for uploading batch images. It seems to be working great!
Does anyone know of a web app that can do all of the above in one place? We are currently working with Vtiger (support), Confluence (documentation), Joomla (website, user management & custom file transfer area).
We've tried using various Joomla components, but we've found nothing as good as the individual web apps listed above... We need something really robust & easy to use. And something that can be controlled with varying group permissions.
Cheers :)
I personally use Redmine for all of the mentioned needs.