Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [ZF] smarty plugin do headStyle()
Skyline
post
Post #1





Grupa: Zarejestrowani
Postów: 63
Pomógł: 0
Dołączył: 25.07.2007

Ostrzeżenie: (0%)
-----


Witam

Mam zintegrowane smarty z zend_layout. Problem w tym ze w smarty nie mozna wywolac obiektow w ten sposob:

$this->headStyle()->appendStylesheet('/css/site.css')

Mam wiec plugina do smarty z EZ, ktory ma umozliwic wykonanie powyzszej operacji w sposob taki {headStyle method=appendStylesheet args=/css/site.css} Niestety nie dziala. Nie wywoluje bledow, ale tez nie wstawia linku do arkusza styli.

Ponizej kod plugina:

  1. <?php
  2. function smarty_function_headStyle($params, &$smarty) 
  3. {
  4. $method = (isset ( $params ['method'] )) ? $params ['method'] : - 1;
  5. unset ( $params ['method'] );
  6. $args = (isset ( $params ['args'] )) ? $params ['args'] : null;
  7. $toReturn = "";
  8.  
  9. try {
  10. if ($method != - 1) {
  11. //oppress errors
  12. if (is_array ( $args )) {
  13. $toReturn = $smarty->_tpl_vars ['this']->headStyle()->$method ( $args ['src'] );
  14. } else {
  15. $toReturn = $smarty->_tpl_vars ['this']->headStyle()->$method ( $args );
  16. }
  17. } else {
  18. $toReturn = $smarty->_tpl_vars ['this']->headStyle ();
  19. }
  20. return $toReturn;
  21. } catch ( Exception $e ) {
  22. return $toReturn;
  23. }
  24. }
  25. ?>


Problem rozwiazany. Zastapilem headStyle() z headLink().

Ten post edytował strife 24.05.2008, 20:38:47
Powód edycji: A dać bbcode nie łaska? /~strife/
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 04:46