symfony1

how to remove html tags in php?

拜拜、爱过 提交于 2019-11-29 11:18:44
i posted some data using tinymce (in a symfony project).while retrieving back how can i remove html tags? strip_tags not working.. The easies way is to use strip_tags but it's not very reliable. There is a very, very, VERY good project design specifically for this: HTML Purifier . It battle-hardened, tested and very good. strip_tags is the easy, fast and go way, but it can miss out some malformated html that a browser will actually parse and execute. Please, don't use regular expression to parse html! Note that strip_tags returns a new string. It does not modify the original string, i.e: $html

Using routes to generate URLs in a Symfony task

柔情痞子 提交于 2019-11-29 10:28:26
问题 I am running Symfony 1.3.6 on Ubuntu 10.0.4 LTS. I have written a Symfony task that generates a report which contains links (URLs). Here is a snippet of the execute() method in my task class: protected function execute($arguments = array(), $options = array()) { //create a context sfContext::createInstance($this->configuration); sfContext::getInstance()->getConfiguration()->loadHelpers(array('Url', 'Asset', 'Tag')); ... $url = url_for("@foobar?cow=marymoo&id=42"); // Line 1 echo '<a href="'.

MySQL User defined variable within Doctrine and Symfony

◇◆丶佛笑我妖孽 提交于 2019-11-29 07:59:46
I have the following Doctrine statement which works fine. $query = $this->createQuery('r') ->select('u.id, CONCAT(u.first_name, " ", LEFT(u.last_name,1)) as full_name, u.first_name, u.last_name, u.gender, r.run_time') ->innerJoin('r.ChallengeUser u') ->orderBy('run_time') ->execute(array(), Doctrine::HYDRATE_ARRAY_SHALLOW); I need to add a row count into this. Now I know with raw SQL you can do this; SET @rank=0; SELECT @rank:=@rank+1 as rank, u.id, u.first_name ....etc So my question is, how can I get this to run with Symfony 1.4 and Doctrine? I am using MySQL for this project. Edit... I

symfony 1.4 propel:build-all not working on Mysql 5.5

烂漫一生 提交于 2019-11-29 06:54:26
问题 i am using Symfony 1.4.8 and Mysql 5.5 i got this error when i run symfony propel:build-all You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘Type=InnoDB’ at line 1 1 回答1: Fixed the issue. It seems that in the DDL, you can’t say “Type=InnoDB|MyISAM|Foo” anymore. You have to say “Engine=InnoDB|MyISAM” so edit one file symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/classes/propel/engine/builder

Multiple databases support in Symfony

这一生的挚爱 提交于 2019-11-29 05:12:56
I am using Propel as my DAL for my Symfony project. I can't seem to get my application to work across two or more databases. Here's my schema.yml: db1: lkp_User: pk_User: { type: integer, required: true, primaryKey: true, autoIncrement: true } UserName: { type: varchar(45), required: true } Password: longvarchar _uniques: Unique: [ UserName ] db2: tesco: Id: { type: integer, required: true, primaryKey: true, autoIncrement: true } Name: { type: varchar(45), required: true } Description: longvarchar And here's the databases.yml: dev: db1: param: classname: DebugPDO test: db1: param: classname:

Symfony dynamic subdomains

血红的双手。 提交于 2019-11-29 02:55:16
问题 I'm trying to match subdomains to a customer id in symfony. i.e. i have customer1.example.com and customer2.example.com Domains are stored in a table. When a user goes to customer1.example.com, I would like to get the subdomain, look up the domain name in the database, once matched, it will then deploy the app config for that customer and then store the customer_Id in a global attribute so i know exactly which customer I'm dealing with througout the whole application. The virtual host will

symfony admin filter with join

被刻印的时光 ゝ 提交于 2019-11-29 02:35:14
I have a table, heading , that has an import_profile_id . import_profile has a bank_id . On my headings list page in my admin, I'd like to add the ability to filter by bank_id . However, since heading doesn't have a bank_id - it needs to go through import_profile to get that - I can't just add a bank_id field and expect it to work. Can anyone explain how to do this? The closest thing I've found is this post but I don't think it really addresses my issue. This can be done by using virtual columns like the post you found. The virtual column is a way to add a new criteria to filter using the

zend-framework versus Kohana versus Symfony [closed]

天大地大妈咪最大 提交于 2019-11-28 21:40:38
Which one of this frameworks would you recommend to someone who knows the basics of PHP? What are the advantages and disadvantages? I wouldn't suggest any frameworks to someone who knows just the basics. Instead, I'd suggest to get a firm grip on OOP and the most common Design Patterns first, because that is what you will find in these frameworks. It also doesn't hurt to know your way around the various available PHP libs and extensions. I think frameworks are a double edged sword for beginners. You may be able to do more in less time in many cases but in other cases (not a few) you will make

Symfony FOSUserBundle - include login form in layout template

旧巷老猫 提交于 2019-11-28 19:44:02
We've successfully configured the FOSUserBundle; login, register, reset password, etc, are all working just fine. Now we want to incorporate the login form into our general site layout, notably placing the form into the top-right section of the layout header. Doing this would be easy enough if we were just dealing with the username and password fields. However we can't seem to figure out how to obtain the CSRF token which is generated by the FOSUserBundle service: $this->container->get('form.csrf_provider')->generateCsrfToken('authenticate'); I tried calling the above within a Twig extension

Swift Mailer Delivery Status

て烟熏妆下的殇ゞ 提交于 2019-11-28 19:13:25
Does anyone know if SwiftMailer send function returns delivery status? I would like to be able to know that email was delivered or not delivered.Is this possible? Thanks There are at least three layers of checks that SwiftMailer supports, that will report several types of delivery failures. 1) Always check the return code from SwiftMailer's send() or batchSend() commands for a non-zero result. From the documentation : //Send the message $numSent = $mailer->send($message); printf("Sent %d messages\n", $numSent); /* Note that often that only the boolean equivalent of the return value is of