Drupal as a web framework

2,099 views

Published on

Drupal isn't a content management system. It's an application development platform that happens to ship with a great CMS as it's default implementation. Look at any chart comparing features of development frameworks and you'll see user management and authentication, forms management and validation, data storage, database migrations, internationalization and translation, MVC model with flexible templating, unit testing, and caching. Sounds a lot like Drupal. We'll look at why Drupal is an ideal application development platform for apps beyond content management, talk about where Drupal can improve in these areas, and look at an example application.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,099
On SlideShare
0
From Embeds
0
Number of Embeds
117
Actions
Shares
0
Downloads
21
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Drupal as a web framework

  1. 1. Drupal as a WebFramework
  2. 2. Adam Kalseyadam@tropo.com@akalseyTropowww.Tropo.com@tropo
  3. 3. “A web application framework is a softwareframework that is designed to support thedevelopment of dynamic websites, Webapplications and Web services. Theframework aims to alleviate the overheadassociated with common activitiesperformed in Web development.” - Wikipedia
  4. 4. UserManagement
  5. 5. user.modulefields.module
  6. 6. Database Access
  7. 7. $query = db_select(search_index,i, array(target => slave))->extend(SearchQuery)->extend(PagerDefault); $query->join(node, n, n.nid =i.sid); $query ->condition(n.status, 1) ->addTag(node_access) ->searchExpression($keys, node);
  8. 8. $databases[default][default] = array( driver => mysql, database => databasename, username => username, password => password, host => localhost, prefix => main_, collation => utf8_general_ci,);$databases[default][default] = array ( database => sites/default/files/.ht.sqlite, driver => sqlite, prefix => ,);
  9. 9. function audioblogger_schema() { $schema = array(); $schema[audioblogger] = array( fields => array( uid => array(type => int,unsigned => TRUE, not null => TRUE,default => 0, disp-width => 10), bloguser => array(type =>varchar, length => 255, not null=> TRUE),
  10. 10. $form[audioblogger][phone] = array( #type => textfield, #title => t(Phone), #default_value => empty($edit[phone]) ? : $edit[phone], #description => t(The phone numberyou usually will call in from.));
  11. 11. function audioblogger_menu() { $items = array(); $items[audioblogger/answer] = array( page callback =>audioblogger_answer, access arguments => array(accesscontent), type => MENU_NORMAL_ITEM, );
  12. 12. #: includes/common.inc:344 modules/system/system.admin.inc:1645msgid "@site is currently undermaintenance. We should be back shortly.Thank you for your patience."msgstr ""#: includes/common.inc:1211 modules/blogapi/blogapi.module:739;749 modules/upload/upload.admin.inc:98;107;136;145msgid "MB"msgstr ""
  13. 13. <?php if (isset($primary_links)) : ?> <?php print theme(links,$primary_links, array(class => linksprimary-links)) ?><?php endif; ?><?php if (isset($secondary_links)) : ?> <?php print theme(links,$secondary_links, array(class =>links secondary-links)) ?><?php endif; ?>
  14. 14. What about MVC?
  15. 15. /** * Default implementation ofDrupalEntityControllerInterface. * * This class can be used as-is by mostsimple entity types. Entity types * requiring special handling canextend the class. */class DrupalDefaultEntityControllerimplementsDrupalEntityControllerInterface {
  16. 16. <?php if (isset($primary_links)) : ?> <?php print theme(links,$primary_links, array(class =>links primary-links)) ?><?php endif; ?><?php if (isset($secondary_links)) : ?> <?php print theme(links,$secondary_links, array(class =>links secondary-links)) ?><?php endif; ?>
  17. 17. function audioblogger_menu() { $items = array(); $items[audioblogger/answer] =array( page callback =>audioblogger_answer, access arguments => array(access content), type => MENU_NORMAL_ITEM, );
  18. 18. What does Drupal need?
  19. 19. Demo time
  20. 20. function frameworkdemo_menu() { $items = array(); $items[demo/answer] = array( page callback => demo_answer, access arguments => array(accesscontent), type => MENU_NORMAL_ITEM, ); return $items;}
  21. 21. function frameworkdemo_answer() { include_once tropo.class.php; $tropo = new Tropo(); $session = new Session(); $caller = $session->getFrom(); $number = $caller[id]; $tropo->say(Thanks for coming!); $_SESSION[caller] = $number; $tropo->on(array(event =>continue, next=> url(demo/thanks/))); frameworkdemo_save($number); print $tropo;}
  22. 22. www.Tropo.com
  23. 23. (604) 800-9142
  24. 24. Free developer accounts: http://Tropo.comDemo module source:https://github.com/akalsey/drupal-framework-demoSlides: http://slideshare.com/akalseyFollow us on Twitter: @TropoMe: Adam Kalsey | adam@tropo.com | @akalsey

×