yii

How to deal with javascript internationalization in yii framework

Is there any mechanism in yii framework to translate messages in javascript source files. For example with: yiic message config-message.php I can generate translation .php files for all Yii::t(). Is it possible to generate .js files with the same mechanism. Currently I'm including to my javascript json data with table returned by tr...

Passing dynamic data to javascript.

It is good idea not to hardcode anything that may change in javascript. For example I want to have url generated by php. I may write echo " <script ...> var anUrl = $urlFromPHP; </script>"; and then: <script ...> // some code $.ajax({ url: anUrl ... }); </script>"; Is there any better way to do it? Does anybody know if...

Dynamic creation of subdomains

I'm creating a website using MVC framework (Yii) and I need to dynamically create subdomains, i.e. http://company.website.com So, in order to achieve this I've added a DNS wildcard (*.website.com). Now the problem is that my application controllers are all the same for www.website.com and for company.website.com. For example, I have a U...

Caching smarty view render in Yii framework

I'm working with Yii framework and using smarty view render. I have to working with simpleXML_load_file to load simpleXML element and it's can not be cache using data caching with memcache provided by Yii. So I think may be using cache of smarty instead of caching data. Anyone here had caching smarty page in Yii framework give me some ad...

Render/Redirect to Another View Using Portlets

I have a login portlet up and running that's based on this tutorial. It works just fine, however, if there is an error with the login form the error messages are displayed within the portlet and they aren't very prominent. The portlet follows: class UserLogin extends Portlet { public $title='Login'; protected function rende...

How to obtain all CActiveRecords in yii

I would like to get name of all CActiveRecords in my app, is it possible? ...

how to force to include all classes in a folder in yii framework

I can force to inlcude one model by Yii::import("application.models.modelName", true); What should I do to include all models from models directory? Line: Yii::import("application.models.*", true); doesn't work becouse yii import only when there is need to use it. ...

Which framework is the most friendly for shared hosting environment?

I am currently comparing available web frameworks to be used for my next projects. The only criterion I need are speed and portability, i.e shared hosting friendly. I have tried Ruby on Rails, but its speed/performance is not good enough for me. I am interested in Django, but I think it is not that friendly on shared hosting - correct m...

In Yii, how can I have a form that loops through an array of objects?

I'm trying to create a Yii ActiveForm that edits values from a list of objects, presented in a table. The classes involved: class ResultForm extends CFormModel { /** * @var array[Result] */ public $results; //Filled with an array of Result objects } class Result { public $requiredArea; } My view: <% $form =...

Using JavaScript with Yii (XWF/SWF Charts)

I'm trying to load up XML/SWF Charts with Yii and having some troubles. As far as I can tell, the trouble seems to be the order that Yii is loading the script tags in the header. This is what the resulting source looks like from the header generated by my working test.php script (minus Yii). <HTML> <script language="javascript"> /*<...

colorbox (which uses live) not rebinding after jQuery ajax call

I have a list of elements that I am loading via ajax (using jQuery's .load()). Each of these elements has an (edit) link next to it that lightboxes (using colorbox) a little edit form. When the lightbox is closed I use the onClosed callback to reload the ajax list to show and changes made during the edit. The colorbox call looks likes t...

Yii multi page form wizard best practice

I am trying to build a multi-page form with Yii, but am quite new to PHP and Yii and am wondering what the best practice is for writing a multi page form. So far, what I am planning to do is to add a hidden field named 'step' which contains the current step the user is on in the form (the form is broken into 3 steps/pages). So with tha...

Zend vs Yii vs CI for a Social Networking Website

I have to choose between the above mentioned frameworks for developing a big social networking Web site. Having used Zend framework for several projects before, I am biased towards using it, however, I would like to have a fair opinion. We are mainly looking for performance and extensibility. ...

Yii framework "meta db model" creation + postgres inheritance

I have few DB tables, witch are build using inheritance from one table witch is an sort of "template" for creation of new tables, and now i have set of businesses logic methods witch work on columns inherit from template, additional columns are used only as params for presentation of models, they're have no meaning for logic. The goal i...

MySQL and foreign key conflicts when trying to INSERT.

I'm doing the Agile Yii book. Anyway, I'm trying to execute this command: INSERT INTO tbl_project_user_assignment (project_id, user_id) values ('1','1'), ('1','2'); And I get this error: ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`trackstar_dev`.`tbl_project_user_assignment`, CONSTRAINT `F...

Yii question about relations function in AR Model, many to one relationship.

So here's the scenario: I have two table, Issue & Project. A Project can have many Issue and an Issue can exactly one project. Since Issue is many to one, do you have to define it? Cause I know in Project Model I have: public function relations() { return array( 'issues' => array(self::HAS_MANY, 'Issue', 'project_id'), ...

Generate PHP code from WSDL (for service replacement)

We have few Web Services witch now are handled by an external application, and we plan to replace them as an new own implementation. Is there some tool/class witch will generate stock php interface and structures 100% compatible with those WSDL's we have now? I'll have to re-implement this wsdl interface, and i have to be sure, that in...

Form generation on the fly / Dynamic forms / forms generated from models

Has anyone tips with building applications similar too wufoo.com? I am building an app where the logged in user creates forms in a similar manner...what i am wondering is if zend, symfony or yii is best suited for this? I will be collecting tips here for other to see easier. advantages of the frameworks that could help with this: Sym...

Prevention from entire website downloading?

There is one IP (from China) which is trying to download my entire website. It downloads all my pages and loads the server significantly (I have more than 500 000 pages). Looking at the access logs I can tell it's definitely not a Google bot or any other search engine bot. Temporarily I've banned it (using iptables rules), but it's not ...

how to handle deny all in testing your web interface?

I have controller with access rules: array('deny', // deny all users 'users'=>array('*'), ), Then i want to test that code (every user authorized or not cant access to this controller via WEB). public function testShow() { $this->open('?r=link'); } And i have error in my console: There was 1 error: ...