[symfony-users] Re: Accessing arrays from templates turns them into sfOutputEscaperArrayDecorator objects?
On Jan 4, 11:58 pm, Eno symb...@gmail.com wrote: actions.class.php: $this-content_tabs = array('key1' = 'value1', 'key2' = 'value2'); Maybe something like this? $this-content_tabs[] = new array('key1' = 'value1', 'key2' = 'value2'); This is PHP. Why new array? -- You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.
[symfony-users] Re: Accessing arrays from templates turns them into sfOutputEscaperArrayDecorator objects?
thank you ken :) ken wrote: you can use $object-getRaw('property'); On Jan 5, 6:34 pm, chrisyue blizzch...@gmail.com wrote: I also encountered a problem like that: when I pass a DOMDocument object $dom to view, I found that I can't treat $dom as array anymore, I put $dom in a foreach statement: foreach ($dom-getElementsByTagName('name') as $name ) .. It would always ouput names from a xml file untill I set escape option on in settings.yml Gábor Fási wrote: sfOutputEscaperArrayDecorator means you have output escaping enabled, and any data you send to the view gets escaped for safety. You can still use it as an array, like $content_tabs[key1], the only difference you'll see is that you need not use htmlspecialchars() or anything like that. On Tue, Jan 5, 2010 at 04:06, SB oce...@gmail.com wrote: Hello, I'm trying to do something really simple (I thought), send an array from the controller to the template. actions.class.php: $this-content_tabs = array('key1' = 'value1', 'key2' = 'value2'); indexSuccess.php: var_dump($content_tabs); gives: object(sfOutputEscaperArrayDecorator)[69] private 'count' = null protected 'value' = array 'key1' = string 'value1' (length=6) 'key2' = string 'value2' (length=6) protected 'escapingMethod' = string 'esc_specialchars' (length=16) However, if I try to output a simple scalar variable, i.e.: actions.class.php $this-content_tabs = 'test'; indexSuccess.php var_dump($content_tabs); gives: string 'test' (length=4) I get the same result if I try to set a request parameter as an array in a filter, i.e. myFilter.php: $this-getContext()-getRequest()-setParameter('content_tabs', array ('key1' = 'value1', 'key2' = 'value2')); if i output this in myFilter.php: var_dump($this-getContext()-getRequest()-getParameter ('content_tabs')); gives: array 'key1' = string 'value1' (length=6) 'key2' = string 'value2' (length=6) but if i output in indexSuccess.php: var_dump($sf_request-getParameter('content_tabs')); gives: object(sfOutputEscaperArrayDecorator)[69] private 'count' = null protected 'value' = array 'key1' = string 'value1' (length=6) 'key2' = string 'value2' (length=6) protected 'escapingMethod' = string 'esc_specialchars' (length=16) Why is this happening? Is there no way to send arrays to the view layer? thanks! SB -- You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/symfony-users?hl=en. -- You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.
[symfony-users] Re: Accessing arrays from templates turns them into sfOutputEscaperArrayDecorator objects?
It's actually recommended to leave outputscaping on be default. On Jan 7, 10:21 am, chrisyue blizzch...@gmail.com wrote: thank you ken :) ken wrote: you can use $object-getRaw('property'); On Jan 5, 6:34 pm, chrisyue blizzch...@gmail.com wrote: I also encountered a problem like that: when I pass a DOMDocument object $dom to view, I found that I can't treat $dom as array anymore, I put $dom in a foreach statement: foreach ($dom-getElementsByTagName('name') as $name ) .. It would always ouput names from a xml file untill I set escape option on in settings.yml Gábor Fási wrote: sfOutputEscaperArrayDecorator means you have output escaping enabled, and any data you send to the view gets escaped for safety. You can still use it as an array, like $content_tabs[key1], the only difference you'll see is that you need not use htmlspecialchars() or anything like that. On Tue, Jan 5, 2010 at 04:06, SB oce...@gmail.com wrote: Hello, I'm trying to do something really simple (I thought), send an array from the controller to the template. actions.class.php: $this-content_tabs = array('key1' = 'value1', 'key2' = 'value2'); indexSuccess.php: var_dump($content_tabs); gives: object(sfOutputEscaperArrayDecorator)[69] private 'count' = null protected 'value' = array 'key1' = string 'value1' (length=6) 'key2' = string 'value2' (length=6) protected 'escapingMethod' = string 'esc_specialchars' (length=16) However, if I try to output a simple scalar variable, i.e.: actions.class.php $this-content_tabs = 'test'; indexSuccess.php var_dump($content_tabs); gives: string 'test' (length=4) I get the same result if I try to set a request parameter as an array in a filter, i.e. myFilter.php: $this-getContext()-getRequest()-setParameter('content_tabs', array ('key1' = 'value1', 'key2' = 'value2')); if i output this in myFilter.php: var_dump($this-getContext()-getRequest()-getParameter ('content_tabs')); gives: array 'key1' = string 'value1' (length=6) 'key2' = string 'value2' (length=6) but if i output in indexSuccess.php: var_dump($sf_request-getParameter('content_tabs')); gives: object(sfOutputEscaperArrayDecorator)[69] private 'count' = null protected 'value' = array 'key1' = string 'value1' (length=6) 'key2' = string 'value2' (length=6) protected 'escapingMethod' = string 'esc_specialchars' (length=16) Why is this happening? Is there no way to send arrays to the view layer? thanks! SB -- You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/symfony-users?hl=en. -- You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.
[symfony-users] Re: Accessing arrays from templates turns them into sfOutputEscaperArrayDecorator objects?
you can use $object-getRaw('property'); On Jan 5, 6:34 pm, chrisyue blizzch...@gmail.com wrote: I also encountered a problem like that: when I pass a DOMDocument object $dom to view, I found that I can't treat $dom as array anymore, I put $dom in a foreach statement: foreach ($dom-getElementsByTagName('name') as $name ) .. It would always ouput names from a xml file untill I set escape option on in settings.yml Gábor Fási wrote: sfOutputEscaperArrayDecorator means you have output escaping enabled, and any data you send to the view gets escaped for safety. You can still use it as an array, like $content_tabs[key1], the only difference you'll see is that you need not use htmlspecialchars() or anything like that. On Tue, Jan 5, 2010 at 04:06, SB oce...@gmail.com wrote: Hello, I'm trying to do something really simple (I thought), send an array from the controller to the template. actions.class.php: $this-content_tabs = array('key1' = 'value1', 'key2' = 'value2'); indexSuccess.php: var_dump($content_tabs); gives: object(sfOutputEscaperArrayDecorator)[69] private 'count' = null protected 'value' = array 'key1' = string 'value1' (length=6) 'key2' = string 'value2' (length=6) protected 'escapingMethod' = string 'esc_specialchars' (length=16) However, if I try to output a simple scalar variable, i.e.: actions.class.php $this-content_tabs = 'test'; indexSuccess.php var_dump($content_tabs); gives: string 'test' (length=4) I get the same result if I try to set a request parameter as an array in a filter, i.e. myFilter.php: $this-getContext()-getRequest()-setParameter('content_tabs', array ('key1' = 'value1', 'key2' = 'value2')); if i output this in myFilter.php: var_dump($this-getContext()-getRequest()-getParameter ('content_tabs')); gives: array 'key1' = string 'value1' (length=6) 'key2' = string 'value2' (length=6) but if i output in indexSuccess.php: var_dump($sf_request-getParameter('content_tabs')); gives: object(sfOutputEscaperArrayDecorator)[69] private 'count' = null protected 'value' = array 'key1' = string 'value1' (length=6) 'key2' = string 'value2' (length=6) protected 'escapingMethod' = string 'esc_specialchars' (length=16) Why is this happening? Is there no way to send arrays to the view layer? thanks! SB -- You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/symfony-users?hl=en. -- You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.
[symfony-users] Re: Accessing arrays from templates turns them into sfOutputEscaperArrayDecorator objects?
Thanks all! On Jan 5, 5:02 am, ken marfillas...@gmail.com wrote: you can use $object-getRaw('property'); On Jan 5, 6:34 pm, chrisyue blizzch...@gmail.com wrote: I also encountered a problem like that: when I pass a DOMDocument object $dom to view, I found that I can't treat $dom as array anymore, I put $dom in a foreach statement: foreach ($dom-getElementsByTagName('name') as $name ) .. It would always ouput names from a xml file untill I set escape option on in settings.yml Gábor Fási wrote: sfOutputEscaperArrayDecorator means you have output escaping enabled, and any data you send to the view gets escaped for safety. You can still use it as an array, like $content_tabs[key1], the only difference you'll see is that you need not use htmlspecialchars() or anything like that. On Tue, Jan 5, 2010 at 04:06, SB oce...@gmail.com wrote: Hello, I'm trying to do something really simple (I thought), send an array from the controller to the template. actions.class.php: $this-content_tabs = array('key1' = 'value1', 'key2' = 'value2'); indexSuccess.php: var_dump($content_tabs); gives: object(sfOutputEscaperArrayDecorator)[69] private 'count' = null protected 'value' = array 'key1' = string 'value1' (length=6) 'key2' = string 'value2' (length=6) protected 'escapingMethod' = string 'esc_specialchars' (length=16) However, if I try to output a simple scalar variable, i.e.: actions.class.php $this-content_tabs = 'test'; indexSuccess.php var_dump($content_tabs); gives: string 'test' (length=4) I get the same result if I try to set a request parameter as an array in a filter, i.e. myFilter.php: $this-getContext()-getRequest()-setParameter('content_tabs', array ('key1' = 'value1', 'key2' = 'value2')); if i output this in myFilter.php: var_dump($this-getContext()-getRequest()-getParameter ('content_tabs')); gives: array 'key1' = string 'value1' (length=6) 'key2' = string 'value2' (length=6) but if i output in indexSuccess.php: var_dump($sf_request-getParameter('content_tabs')); gives: object(sfOutputEscaperArrayDecorator)[69] private 'count' = null protected 'value' = array 'key1' = string 'value1' (length=6) 'key2' = string 'value2' (length=6) protected 'escapingMethod' = string 'esc_specialchars' (length=16) Why is this happening? Is there no way to send arrays to the view layer? thanks! SB -- You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/symfony-users?hl=en. -- You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.
Re: [symfony-users] Re: Accessing arrays from templates turns them into sfOutputEscaperArrayDecorator objects?
In a template, you can call $sf_data-getRaw('myActionProperty'); after init it like $this-myActionProperty = array('hey'='hoy'); inside an action. So you'll get your raw object : unescaped. Before Printing, Think about Your Environmental Responsibility! Avant d'Imprimer, Pensez à Votre Responsabilitée Environnementale! On Tue, Jan 5, 2010 at 8:26 PM, SB oce...@gmail.com wrote: Thanks all! On Jan 5, 5:02 am, ken marfillas...@gmail.com wrote: you can use $object-getRaw('property'); On Jan 5, 6:34 pm, chrisyue blizzch...@gmail.com wrote: I also encountered a problem like that: when I pass a DOMDocument object $dom to view, I found that I can't treat $dom as array anymore, I put $dom in a foreach statement: foreach ($dom-getElementsByTagName('name') as $name ) .. It would always ouput names from a xml file untill I set escape option on in settings.yml Gábor Fási wrote: sfOutputEscaperArrayDecorator means you have output escaping enabled, and any data you send to the view gets escaped for safety. You can still use it as an array, like $content_tabs[key1], the only difference you'll see is that you need not use htmlspecialchars() or anything like that. On Tue, Jan 5, 2010 at 04:06, SB oce...@gmail.com wrote: Hello, I'm trying to do something really simple (I thought), send an array from the controller to the template. actions.class.php: $this-content_tabs = array('key1' = 'value1', 'key2' = 'value2'); indexSuccess.php: var_dump($content_tabs); gives: object(sfOutputEscaperArrayDecorator)[69] private 'count' = null protected 'value' = array 'key1' = string 'value1' (length=6) 'key2' = string 'value2' (length=6) protected 'escapingMethod' = string 'esc_specialchars' (length=16) However, if I try to output a simple scalar variable, i.e.: actions.class.php $this-content_tabs = 'test'; indexSuccess.php var_dump($content_tabs); gives: string 'test' (length=4) I get the same result if I try to set a request parameter as an array in a filter, i.e. myFilter.php: $this-getContext()-getRequest()-setParameter('content_tabs', array ('key1' = 'value1', 'key2' = 'value2')); if i output this in myFilter.php: var_dump($this-getContext()-getRequest()-getParameter ('content_tabs')); gives: array 'key1' = string 'value1' (length=6) 'key2' = string 'value2' (length=6) but if i output in indexSuccess.php: var_dump($sf_request-getParameter('content_tabs')); gives: object(sfOutputEscaperArrayDecorator)[69] private 'count' = null protected 'value' = array 'key1' = string 'value1' (length=6) 'key2' = string 'value2' (length=6) protected 'escapingMethod' = string 'esc_specialchars' (length=16) Why is this happening? Is there no way to send arrays to the view layer? thanks! SB -- You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.comsymfony-users%2bunsubscr...@googlegroups.com . For more options, visit this group athttp:// groups.google.com/group/symfony-users?hl=en. -- You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.comsymfony-users%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en. -- You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.