Skip to main content

Home/ foograde/ Group items tagged php

Rss Feed Group items tagged

Adán Muguiro

Easy Ajax in symfony | symfony | Web PHP Framework - 0 views

  • <?php foreach ($sf_user->getAttribute('cart') as $product_id => $quantity): ?> <div> <?php for ($i = 1; $i <= $quantity; $i++): ?> <?php echo image_tag('product'.$product_id, array( 'class' => 'cart-items', 'id' => 'item_'.$product_id.'_'.$i, 'style' => 'position:relative' )) ?> <?php endfor; ?> (<?php echo $quantity ?> <?php echo $products[$product_id] ?>) </div> <?php endforeach; ?>   <?php if (!$sf_user->getAttribute('cart')): ?> nothing yet in your shopping cart. <?php endif; ?>
  • public function executeAdd() { $tmp = split('_', $this->getRequestParameter('id', '')); $product_id = $tmp[1];   $cart = $this->getUser()->getAttribute('cart'); if (!isset($cart[$product_id])) { $cart[$product_id] = 1; } else { ++$cart[$product_id]; } $this->getUser()->setAttribute('cart', $cart); $this->products = $this->getProducts(); }
  •  
    Variables de usuario e imágenes en Symfony
Adán Muguiro

The Definitive Guide to symfony | Chapter 11 - Ajax Integration | symfony | Web PHP Fra... - 0 views

  • <div id="item_list"></div> <?php echo form_tag('@item_add_regular') ?> <label for="item">Item:</label> <?php echo input_tag('item') ?> <?php if_javascript(); ?> <?php echo submit_to_remote('ajax_submit', 'Add in Ajax', array( 'update' => 'item_list', 'url' => '@item_add', )) ?> <?php end_if_javascript(); ?> <noscript> <?php echo submit_tag('Add') ?> </noscript> </form>
  • <div id="feedback"></div> <div id="indicator" style="display: none">Loading...</div> <?php echo link_to_remote('Delete this post', array( 'update' => 'feedback', 'url' => 'post/delete?id='.$post->getId(), 'loading' => visual_effect('appear', 'indicator'), 'complete' => visual_effect('fade', 'indicator'). visual_effect('highlight', 'feedback'), )) ?>
  • <div id="feedback"></div> <div id="indicator">Loading...</div> <?php echo link_to_remote('Delete this post', array( 'update' => 'feedback', 'url' => 'post/delete?id='.$post->getId(), 'loading' => "Element.show('indicator')", 'complete' => "Element.hide('indicator')", )) ?>
  •  
    Formulario que funciona con Ajax o no
Adán Muguiro

The Definitive Guide to symfony | Chapter 7 - Inside The View Layer | symfony | Web PHP... - 0 views

  • <?php   class newsComponents extends sfComponents { public function executeHeadlines() { $c = new Criteria(); $c->addDescendingOrderByColumn(NewsPeer::PUBLISHED_AT); $c->setLimit(5); $this->news = NewsPeer::doSelect($c); } }
  • <div> <h1>Latest news</h1> <ul> <?php foreach($news as $headline): ?> <li> <?php echo $headline->getPublishedAt() ?> <?php echo link_to($headline->getTitle(),'news/show?id='.$headline->getId()) ?> </li> <?php endforeach ?> </ul> </div>
  • // Call to the component <?php include_component('news', 'headlines', array('foo' => 'bar')) ?>   // In the component itself echo $this->foo; => 'bar'   // In the _headlines.php partial echo $foo; => 'bar'
  •  
    Componentes en Symfony
Adán Muguiro

Mover un archivo o directorio con PHP - 0 views

  • <?phprename("/tmp/archivo_tmp.txt", "/home/user/login/docs/mi_archivo.txt");?>
  •  
    Comando rename para mover directorios en PHP. Para lo de Birce.
federico balderas

PHP: rmdir - Manual - 0 views

  •  
    "Here's another version of the recursive directory removal. This version requires PHP 5, and returns TRUE on success or FALSE on failure. "
  •  
    borra una carpeta del servidor con todo y sus subcarpetas y archivos
federico balderas

PHP: copy - Manual - 0 views

  •  
    "Here's a simple recursive function to copy entire directories Note to do your own check to make sure the directory exists that you first call it on. "
  •  
    mover carpeta con todos sus archivos en php
Adán Muguiro

Formularios personalizados - 0 views

  • <?php echo $form->renderFormTag('foo/contact') ?> <table> <?php echo $form['name']->renderRow() ?> <?php echo $form['email']->renderRow() ?> <?php echo $form['subject']->renderRow() ?> <?php echo $form['message']->renderRow() ?> <tr> <td colspan="2"> <input type="submit" /> </td> </tr> </table> </form>
  •  
    Separando los componentes de un formulario hecho con widgets en Symfony
Fernando Vega

ifwebstudio blog » Blog Archive » Calculate image aspect ratio in PHP - PHP, ... - 1 views

  •  
    Calcular la proporcion o aspect ratio de imagenes
Adán Muguiro

Practical symfony | Día 3: El Modelo De Datos | symfony | Web PHP Framework - 0 views

  • php symfony doctrine:generate-module --with-show --non-verbose-templates frontend job JobeetJob
  •  
    Generando un módulo basado en una clase de Doctrine
Adán Muguiro

[PHP] jq_link_to_remote con jq_visual_effect - Pastebin.com - 0 views

  •  
    Sintaxis para jq_visual_effect
Adán Muguiro

Modificando los widgets en la acción - 0 views

  • // in modules/foo/actions/actions.class.php // Define the form $this->form = new ContactForm();   // Add an empty option to the list of choices of a 'choice' widget $form->getWidget('language')->setOption('add_empty', 'Please choose a language'); // Add a 'gender' list of options widget $form->setWidget('gender', new sfWidgetFormChoice(array('expanded' => true, 'choices' => array('m' => 'Male', 'f' => 'Female')), array('class' => 'gender_list'))); // Change the HTML attributes of the 'subject' widget $form->getWidget('subject')->setAttribute('disabled', 'disabled'); // Remove the 'subject' field unset($form['subject']) // Note: You cannot remove just the widget. Removing a widget will also remove the related validators   // Change the 'min_length' error in the 'message' validator $form->getValidator('message')->setMessage('min_length', 'Message too short'); // Make the 'name' field optional $form->getValidator('name')->setOption('required', false);
  •  
    Varias cosas que se pueden modificar en los widgets desde la acción.
Adán Muguiro

Modificar template de los widgets - 0 views

  • $this->getWidgetSchema()->getFormFormatter()->setRowFormat('<div >%field%%help%%error%%hidden_fields%</div>');
  •  
    En caso de no querer poner los labels o cualquier otro componente de un widget por default.
Adán Muguiro

Configuración de Apache para un sitio con Symfony - 2 views

  • NameVirtualHost 127.0.0.1:8080 # This is the configuration for your project Listen 127.0.0.1:8080 <VirtualHost 127.0.0.1:8080> DocumentRoot "/home/sfproject/web" DirectoryIndex index.php <Directory "/home/sfproject/web"> AllowOverride All Allow from All </Directory> Alias /sf /home/sfproject/lib/vendor/symfony/data/web/sf <Directory "/home/sfproject/lib/vendor/symfony/data/web/sf"> AllowOverride All Allow from All </Directory> </VirtualHost>
  •  
    Lo que debería ir en /etc/apache2/httpd.conf
Adán Muguiro

sfWidgetFormPropelChoice y el valor seleccionado - 0 views

  • in BaseFormPropel i have the function : public function setValue($field,$value){ $this->widgetSchema[$field]->setDefault ($value); } and in my action : $this->form->setValue('idtype_doc',$this->getUser()->getAttribute('dossier_rec[type_doc]'));
  •  
    Cómo modificar el valor seleccionado dentro de un select de propel o cualquier otro.
Adán Muguiro

Campos i18n en Admin Generator - 0 views

  • //generator.yml form: display: Espanol: [es] Italiano: [it] fijos: [forma_pago, moneda_code]
  •  
    Agregar campos i18n en una personalización del Admin Generator de una tabla
Adán Muguiro

Doctrine NestedSet - 0 views

  • $treeObject = Doctrine_Core::getTable('Category')->getTree(); $rootColumnName = $treeObject->getAttribute('rootColumnName'); foreach ($treeObject->fetchRoots() as $root) { $options = array( 'root_id' => $root->$rootColumnName ); foreach($treeObject->fetchTree($options) as $node) { echo str_repeat(' ', $node['level']) . $node['name'] . "\n"; } }
    • Fernando Vega
       
      fetch para deplegar nodos padres e hijos con doctrine
  • First lets create the query we want to use to retrieve our tree data with: // test.php // ... $q = Doctrine_Query::create() ->select('c.name, p.name, m.name') ->from('Category c') ->leftJoin('c.HottestProduct p') ->leftJoin('p.Manufacturer m'); Now we need to set the above query as the base query for the tree: $treeObject = Doctrine_Core::getTable('Category')->getTree(); $treeObject->setBaseQuery($q); $tree = $treeObject->fetchTree(); There it is, the tree with all the related data you need, all in one query.
  •  
    Agregar una subconsulta a un objeto NestedSet
Fernando Vega

symfony framework forum: symfony 1.3 and 1.4 => is there anyone can tell me how to use ... - 0 views

  • in the form $this->widgetSchema['login_id'] = new sfWidgetFormJQueryAutocompleter(array( 'url' => '/ajax/getUser', )); and in the action of executeGetUser $this->getResponse()->setContentType('application/json'); $users=Doctrine::getTable('user')->getLoginIDList(); return $this->renderText(json_encode($users)); And in the userTable which inside Doctrine $q=Doctrine_Query::create()->select('login_id')->from('user')- >execute(); foreach($q as $row){ $login_id[$row->login_id]=$row->login_id; } return $login_id; hope this help =]
    • Fernando Vega
       
      autocompletar con doctrine y sf 1.4
Fernando Vega

Doctrine - Doctrine ORM for PHP - Behaviors - 0 views

  • $newsItem = new NewsItem(); $newsItem->Translation['en']->title = 'some title'; $newsItem->Translation['en']->body = 'test'; $newsItem->Translation['fi']->title = 'joku otsikko'; $newsItem->Translation['fi']->body = 'test'; $newsItem->save();
    • Fernando Vega
       
      guardar un registri i18n con doctrine
Fernando Vega

Alternativo layout por accion - 0 views

  • Just use $this->setLayout('popup') in your action or use in the view.yml of your module: actionSuccess: layout: popup
  •  
    layout diferentes por accion, util para peticiones de ajax por iframes
Adán Muguiro

jq_input_auto_complete_tag - 1 views

  • <?php echo jq_input_auto_complete_tag('servicio''','servicios/ buscarServicio',array('class'=>'fs11'),array('use_style'=> true,'autocomplete' =>...)) ?> En la acción, el parámentro no se recoge mediante "$request- >getParameter('servicio')" sino mediante "$request->getParameter ('q')".
  •  
    Autocompletado con AJAX y Symfony
  •  
    Autocompletado con AJAX y Symfony 1.4
1 - 20 of 25 Next ›
Showing 20 items per page