Skip to main content

Home/ Drupal for Developers/ Group items tagged php

Rss Feed Group items tagged

anonymous

Free your content of PHP: Moving PHP code out of blocks, views and nodes | 2bits.com, I... - 2 views

  • From the early days, Drupal had the ability to embed PHP code in its content. This provides flexibility and functionality, most importantly, nodes and blocks can contain dynamically fetched data from the database using custom queries and displayed them in other content. This is an easy approach to get such data without writing a module. All you need to do is assign the PHP input format filter to the node or block and paste your PHP code in it, and voila, you have dynamic content. Code in Content: the issues However, this approach is suboptimal and has serious drawbacks, including:
  •  
    From the early days, Drupal had the ability to embed PHP code in its content. This provides flexibility and functionality, most importantly, nodes and blocks can contain dynamically fetched data from the database using custom queries and displayed them in other content. This is an easy approach to get such data without writing a module. All you need to do is assign the PHP input format filter to the node or block and paste your PHP code in it, and voila, you have dynamic content.
Daniel Gregoire

Ubuntu 10.04 and Drupal | fen | CivicActions - 4 views

  •  
    Good instructions for getting rid of php5.3 and installing php5.2 under Ubuntu 10.04 (Lucid Lynx)
Daniel Gregoire

Theming the User Registration Form in Drupal 6 | Trellon - 0 views

  • <?phpfunction themename_theme($existing, $type, $theme, $path) {  return array(    ...    // tell Drupal what template to use for the user register form    'user_register' => array(      'arguments' => array('form' => NULL),      'template' => 'user-register', // this is the name of the template    ),    ...  );}?>
  • <div id="registration_form">  <div class="field">    <?php      print drupal_render($form['account']['name']); // prints the username field    ?>  </div>  <div class="field">    <?php      print drupal_render($form['account']['pass']); // print the password field    ?>  </div>  <div class="field">    <?php        print drupal_render($form['submit']); // print the submit button      ?>    </div>  </div></div>
  • <?php  print '<pre>';  print var_export($form);  print '</pre>';?>
  • ...3 more annotations...
  • Don't forget to render hidden fields or it won't work ;) echo drupal_render($form['timezone']); echo drupal_render($form['form_build_id']); echo drupal_render($form['form_id']);
  • you also have to print the "token" in order to make the form work print drupal_render($form['form_token']);
  • From my own experience using a form tpl.php, you need to print the whole $form at the very end of the template to ensure that the form will validate upon submission. <?php print drupal_render($form); ?> Just adding the hidden form_build_id and the form_id fields will not mean the form will work. Printing the entire form at the end, however, will mean that all the stuff you wanted to hide in making the template will show. For those fields, include "unset" statements for each one: <?php unset($form['field_to_hide']); ?> Please correct me if I'm wrong or if there is a better way to do this.
Daniel Gregoire

PHP, and Drupal Questions [Archive] - Hostmonster Forums - 4 views

  • * file_uploads * upload_max_filesize * max_input_time * memory_limit * max_execution_time * post_max_size
  •  
    Good list of variables to remember to change if you need to change PHP memory limits, especially for file uploads. I keep forgetting post_max_size
Daniel Gregoire

PHP 5.2.10 .debs for Ubuntu 10.4 (Lucid) | The Jibe Multimedia, Inc. - Business Solutions - 0 views

  •  
    Resource for .deb file for PHP 5.2 on Lucid Lynx (Ubuntu 10.04), since we only have deb's for 5.3 by default, which makes Drupal contributed modules unhappy.
Scott Blackburn

Alternative templates for different block types | drupal.org - 0 views

  •  
    Here's a little trick that will allow you to use a different block.tpl.php for a specific block. You can control by Block name or Block ID. Here' a modified block.tpl.php with a conditional at the top. All you need to do is edit the module == '[modulename
Scott Blackburn

How to get rid of PHPSESSID in Drupal and other PHP applications | The Baheyeldin Dynasty - 0 views

  •  
    PHPSESSID in Drupal and other PHP applications
Scott Blackburn

Views Help: How to get a field to "Link this field to its user" besides username | drup... - 0 views

  • Though one would think the $field object is what we wanted-- the actual object we needed is $row (even though we're only looking at one field in the row). Put the following into the field tpl file to see what the necessary info is: <?phpprint '<pre>';print_r($row);print '</pre>';?> Then, to actually make the link, put the following in your field tpl file: <?php$account = user_load($row->uid);print l($row->profile_values_profile_fullname_value, 'users/' . $account->name);?> Change 'profile_values_profile_fullname_value' to the proper field alias (based on the $row output). Also, be sure to change 'users' to whatever the path is for your user accounts. I also had another thought-- given your use case, you may want to consider the http://drupal.org/project/realname module as well. It will replace usernames with whatever field(s) you designate all over the site. EDIT: I had another thought. I'm not sure of the performance implications of doing a user_load in the template file. Another option is to add the 'User: name' field to the view but exclude it from display. Then you could avoid the user_load and change the code in the tpl file to: <?phpprint l($row->profile_values_profile_fullname_value, 'users/' . $row->users_name);?>
  •  
    theming the field tpl files for Views2
Scott Blackburn

PHP op-code caches / accelerators: Drupal large site case study | 2bits.com, Inc. - Dru... - 0 views

  •  
    Excellent resource for PHP op-code cache information
Jackie Fields

IT Management Conference & Expo in NYC Oct.14-16 - 0 views

  •  
    http://www.manageit.me ---The greatest minds in IT in 50+ presentations : top industry-leaders: Creator of MySQL Michael "Monty" Widenius, Internet Celebrity Gary Vaynerchuk, Co-Creator of PHP & Zend CTO Zeev Suraski, Richard Sheridan, CEO of Menlo Innovations & Pioneer of Agile eXtreme Programmi...
Scott Blackburn

Take control of your Drupal theme | Lullabot - 0 views

  •  
    Want to create a front page that's styled differently from the rest of your site? Perhaps you need a separate admin theme? Or how about a login page which only shows the login block and nothing else? With a little PHP knowledge these problems are easy t
Scott Blackburn

Customising the user registration form | drupal.org - 0 views

  •  
    These snippets allow you to override the default user registration layout using a custom user_register.tpl.php.
Daniel Gregoire

Advanced theme settings | drupal.org - 4 views

  • here. dman - April 6, 2009 - 22:10 This worked fo me. An additional logo (Appeared in the footer everywhere) Not sure why I had to put the submit handler into the #validate pass :-/ It was copied from the existing theme settings funcs. 'campaign_' is the theme name.
  •  
    d.o page for adding theme-settings.php file for custom theme features available at theme configuration page. Highlighting comment that successfully adds an "upload" field for uploading images for custom features.
Daniel Gregoire

Apache Solr and Drupal Default's Search | Trellon - 0 views

  • One issue that comes up from ApacheSolr being a separate search page is that the search form does not go to it by default. This is the $search_box in the page.tpl.php template. The way we change this behavior is to add a new submission handler to that form. You can create a custom module for this or put it in your custom theme. <?php/*** Implementation of hook_form_alter()*/function custommodule_form_alter(&$form, $form_state, $form_id) {  // Add submission handler to redirect to apachesolr  if ($form_id == 'search_theme_form') {    // Add a submit, because the search form redirects to a specific place    $form['#submit'][] = 'custommodule_search_submit';  }}/*** Implementation of form submit function*/function custommodule_search_submit($form, &$form_state) {  // Get form ID  $form_id = $form['form_id']['#value'];  // Create new redirect  $form_state['redirect'] = 'search/apachesolr_search/'. trim($form_state['values'][$form_id]);}?>
Daniel Gregoire

Reducing server resource utilization for busy sites by implementing fast 404s in Drupal... - 3 views

  • // List of extensions for static files $exts = 'txt|png|gif|jpe?g|shtml?|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp|xml'; // It is not an imagecache path, which we allow to go through Drupal if (!strpos($_SERVER['QUERY_STRING'], 'imagecache')) { // It is not our main feed page if ($_SERVER['QUERY_STRING'] != 'rss.xml') { // Is it a static file? if (preg_match('/\.(' . $exts . ')$/', $_SERVER['QUERY_STRING'])) // Just send a 404 right now ... { header('HTTP/1.0 404 Not Found'); print '<html>'; print '<head><title>404 Not Found</title></head>'; print '<body><h1>Not Found</h1>'; print '<p>The requested URL was not found on this server.</p>'; print '</body></html>'; exit(); } } }
  •  
    Fast Drupal 404 handling for static files.
Hendy Irawan

Drupal Development - 0 views

  •  
    Drupal Development - Presentation Transcript Drupal Code: Day 1 where am i, and how did i get all these arrays Hi. I'm eaton. Drupal is... http://www.flickr.com/photos/druclimb/282597447/ Drupal is... Drupal Core http://www.flickr.com/photos/druclimb/282597447/ Drupal is... Node Drupal Core User http://www.flickr.com/photos/druclimb/282597447/ Drupal is... Views Five Star CCK Node Drupal Core User http://www.flickr.com/photos/druclimb/282597447/ Drupal is... Theme Views Five Star CCK Node Drupal Core User http://www.flickr.com/photos/druclimb/282597447/ Drupal is... Theme Views Five Star CCK Node Drupal Core User http://www.flickr.com/photos/druclimb/282597447/ name = Demo description = Just a simple demo module. core = 6.x function demo_nodeapi(&$node, $op) { global $user; if ($op == 'view') { if ($node->uid == $user->uid) { $node->title . ' [YOUR ARTICLE]'; } } } demo.info demo.module name = Tricky description = A slightly trickier module. core = 6.x function tricky_form_alter(&form, $form_state, $id) { if ($id == 'node_form') { $title['#required'] = FALSE; } } function tricky_install() { drupal_set_message('You just installed Tricky!'); } tricky.info tricky.module tricky.install views.info views.module views.inc user.inc node.inc blog.inc comment.inc ui.info ui.module arguments.inc handlers.inc filters.inc query.inc sprout.info sprout.module forum.inc views.pages.inc table.inc views.install sprout.install sprout.admin.inc sprout.inc CHANGELOG README views.info views.module views.inc user.inc node.inc blog.inc comment.inc ui.info ui.module arguments.inc handlers.inc filters.inc query.inc sprout.info sprout.module forum.inc views.pages.inc table.inc views.install sprout.install sprout.admin.inc sprout.inc CHANGELOG README views.info views.module views.inc user.inc node.inc blog.inc comment.inc ui.info ui.module arguments.inc handlers.inc filters.inc query.inc sprout.info sprout.module forum.inc views.pages.inc table.inc views.install
Scott Blackburn

Internet Archive Search: subject:"DrupalCon DC 2009" - 0 views

  •  
    The full list of videos from the DrupalCon DC. Looks like I have a ton of viewing to do.
1 - 20 of 33 Next ›
Showing 20 items per page