symfony1

Disable CSS stylesheet for a specific action in Symfony

我的梦境 提交于 2019-11-30 04:46:58
问题 Is there any way of disabling a stylesheet in view.yml for a specific action in Symfony? For example I've got this in my view.yml: default: stylesheets: [default.css] I want to be able to do something like: displaySuccess: stylesheet: [!default.css] to disable default.css in displaySuccess only Is this possible or do I have to explicitly say which modules/actions should have default.css? 回答1: You can remove or add stylesheets to a modules view.yml by doing the following: displaySuccess:

PHP Post Data Over VPN

一世执手 提交于 2019-11-30 04:37:07
问题 I need to connect to a webservice which is behind of a VPN via PHP. My server is Debian Linux (Squeeze). Is it possible to accomplish this via PHP on Linux? Is it risky to do this if it is possible? (When VPN connection hangs etc., does the operating system or any other what-so-over handles the situation) I have only one network card, therefore I really wonder whether it is possible to keep server online for normal users while "posting data over an accomplished VPN connection in the

Symfony on virtual host (document root problem)

本秂侑毒 提交于 2019-11-29 22:46:19
问题 I'm developing an application in Symfony and on localhost (XAMPP) I want to simulate the same conditions as on the webserver. The web server is configured as follows: /www => mydomain.com /foo => foo.mydomain.com /bar => bar.mydomain.com ... I'm going to put my Symfony application into /www direcotry so there'll be: /www /www/apps /www/apps/frontend /www/apps/frontend/... /www/apps/backend /www/apps/backend/... /www/cache /www/config ... and so on... /www/web The thing is that the document

How do I correctly install PHPUnit with PEAR?

我的未来我决定 提交于 2019-11-29 22:10:15
I have had to de- and reinstall a newer version of PHPUnit following these directions . Now when I'm launching this line sudo pear install --alldeps phpunit/PHPUnit I see an error message, that looks like this. Unknown remote channel: pear.symfony.com phpunit/PHPUnit requires package "channel://pear.symfony.com/Yaml" (version >= 2.1.0) No valid packages found If I install just Yaml by launching sudo pear install symfony/YAML an older version (1.0.6) will be installed that doesn't meet the dependency of PHPUnit. How can I possibly solve this? I had the same problem while upgrading my phpunit.

How to create/use custom classes and helper in symfony 1.4?

蓝咒 提交于 2019-11-29 21:45:15
问题 What is the best way to put custom library or helper methods in symfony? I am using doctrine with my project. One place I consider to put is under project_root/lib/vendor/MyClasses/ But if I want to create a class or helper function which will use some core symfony/doctrine methods and return a result then how to do that and where should I put it? I want it to call from different modules to avoid code duplication. 回答1: As for the custom library part of the question, you might probably want to

Pass a variable to a Symfony Form

自闭症网瘾萝莉.ら 提交于 2019-11-29 21:26:18
问题 I am building a web application using Symfony 1.4 and Doctrine for a school and I want to make a very simple form to add a course to a student. The main problem I have is that in the drop down list I only want to show the courses in which the student is currently not enrolled. I already have a function in the model (in Student.class.php) which returns all the courses in which the student is not enrolled but the problem is I don't know how to pass the student to the configure() of the form. I

How should be kept as HTML tags in database?

徘徊边缘 提交于 2019-11-29 16:42:53
i create my new site. Now i learn and use Symfony. I have few questions. Why default Symfony allow add HTML tags to database? For example i create new module, i go to module/new, in title i enter <strong>test</strong> and next save it. In database MySQL i have <strong>test</strong> . Is it safe? I know - if i use simply $test->getTitle() then this render text <strong>test</strong> , but what if i would like add for user comments WYSYWIG and use RawValue()? Users can not close tags </strong> and all site is broken... They can for example steal cookies? Is any safe WYSIWYG editor for Symfony? If

Email body in Symfony 1.4 mailer?

女生的网名这么多〃 提交于 2019-11-29 16:04:46
问题 I'm using the Symfony 1.4 mailer where I build the various bits needed for an email and then send it out using: $this->getMailer()->composeAndSend($sender, $recipient, $subject, $body); In the email body, I need to able to take advantage of variables generated in the action, so right now I might have this in my action: $body = 'Your username is '.$username.' and this is the email body.'; Does anyone know of an elegant way of storing/organising various email bodies, instead of having to code

Symfony 1.4: Custom error message for CSRF in forms

喜欢而已 提交于 2019-11-29 14:31:19
问题 Can anyone tell me where/how to customise the CSRF token error message for forms in Symfony 1.4. I'm using sfDoctrineGuard for logins and in this form particularly, whenever a session runs out and you still have the page open, it throws a very user-unfriendly error: "CSRF attack detected". Something like "This session has expired. Please return to the home page and try again" sounds better. What's the right way to do this in the form class? Thanks. 回答1: The only way seems to be to overwrite

send two ajax request at the same time in symfony

我们两清 提交于 2019-11-29 12:58:35
When i send two ajax requests together using JQuery .. the response come together for example $.ajax ({ type: "POST", url: 'ajax.php' }); $.ajax ({ type: "POST", url: 'ajax2.php' }); ajax.php , ajax2.php are two files contain a dummy for loop take about 5 sec. FireBug Screen POST localhost/ajax.php 200 OK 4.77s POST localhost/ajax.php 200 OK 4.37s Here every request take about 5 sec to be executed ..... When i do the same example at symfony i got different result $.ajax ({ type: "POST", url: 'module/action1' }); $.ajax ({ type: "POST", url: 'module/action2' }); action1 , action2 are two action