background preloader

Drupal

Facebook Twitter

5 Ways to Improve Drupal 7 Performance. When it comes to attracting and keeping site visitors, the research is clear - fast sites win out over slower ones. Users simply don’t have much patience with sites that take too long to load and that impatience isn't measured in seconds, but milliseconds. Here are five ways to speed things up on your Drupal site. Drupal Cache Using Drupal's built-in caching is probably the easiest way to improve performance on your site. After enabling caching, Drupal will begin storing database queries in a special table that allows for faster response times.

You can help manage this by setting the 'Minimum cache lifetime' and 'Expiration of cached pages' options. Also on the 'Performance' settings page are options to aggregate CSS and JavaScript files. Boost Another great way to improve your site’s performance is the Boost module. Boost requires both Poormanscron (included in core with Drupal 7) and clean urls to be working. Memcached Varnish Cache MongoDB Wrapping It Up.

Nice modules

How to programmatically create nodes, comments and taxonomies in Drupal 7. I've been busy with a migration work for my client recently. There is an established website built with some proprietary CMS with a decent amount of articles / pages, different categories and user comments. My team was hired to make a complete migration from this money-sucking old-fashioned proprietary CMS to a modern shiny open-source Drupal 7. I like this kind of tasks.

It’s always a pleasure to help people get rid of an old and proprietary technologies. In today's post I'll show you how to programmatically create nodes, comments and taxonomies in Drupal 7. 1. Initialize a node objectAdd body fieldAdd custom fieldsAdd file / image fieldAdd a term to a nodeSave a node 2. 1.1 Initialize a node object $node = new stdClass(); // We create a new node object$node->type = "page"; // Or any other content type you want$node->title = "Your title goes jere";$node->language = LANGUAGE_NONE; // Or any language code if Locale module is enabled. 1.2 Add a body field 1.3 Add custom fields 2. 3. How to create fields and instances programmatically | realguess. Blog | EchoDitto Labs. Skip to main content EchoDitto Blog Tutorial: How to Group Fields in Views With a Div or Span Tag This is a howto for wrapping a div around a few of your view fields (and not others).

This is useful, for instance, for being able to group all one's content so that it floats left but does not float around an image. EDIT: This technique is a good intro to views templates, however, an easier way exists which seems a little hackish, but would work for many use cases. Thanks to Sr. or Sra. EDIT #2: Another way to create this effect is to use the "Table" layout under "Style" settings for your view. Just use one "Global:Custom" field with a single div tag in it.

Carry on. First, create a template for your view. Create a template file in your theme directory with the same name as the views and paste the code from the level of specificity that you desire. Here is the code from the stock Row Style Output: <? <? You'll see the names of your fields when you refresh the view. $id are the names listed. And <? Drupal 7 multisite step by step tutorial. I had a first site called FIRSTSITE.com. I wanted to add another site called SECONDSITE.com. I wanted the second site to render as a separate website, and I wanted the two sites to share my Drupal 7 installation. I couldn’t find a guide for Drupal 7 multisite, so now that I’ve figured it out from a pastiche of advice, I’m documenting it.

This post is not about updating a multisite from Drupal 6 to Drupal 7. I am a Drupal noob with Drupal 7. Install Drupal 7 for FIRSTSITE.com. Create a new MySQL database and user. Configure SECONDSITE.com to point to the FIRSTSITE.com servers. Park SECONDSITE.com to FIRSTSITE.com. Create a directory /sites/SECONDSITE.com/ inside your main Drupal folder.

Copy the default.settings.php file (found in drupal/sites/default/) to /sites/SECONDSITE.com/ and rename it to settings.php Change its permissions to 666 (make it changeable by everyone) Make a new directory under /drupal/sites/SECONDSITE.com/ and name it “files”, then change permissions of it to 777. Reference: Building Multilingual Sites with Drupal 7. Building Multilingual Sites with Drupal 7. Drush Tutorial: Installation and Main Commands | Friendly Drupal Free Drupal Tutorials. Drush Installation on Ubuntu Download Drush from the project webpage( Drush works with any Drupal release. In command line you can use wget command: $ wget [link to latest release] Then unpack it: You should now have a Drush directory under /home/your_username/ Cd to this directory. You can see the full set of instructions on the readme file (in the module directory or online)

. $ chmod u+x drush Then create a symlink: Basic Drush commands Change to your Drupal directory to run Drush commands (go to the documentation to see full list of Drush commands). $drush status Lets you see the status of your Drush installation. $ drush cron Runs cron, as you might gess. . $ drush help Shows all available commands, with short aliases. Specific commands can also have a help menu: $ drush command --help Other modules can also add their own commands - don't forget to check when you install them. To download a module or a theme type: $ drush dl project_name To enable a project, type. Les hooks : connaître Drupal pour créer vos modules | Julien dubreuil.

Ce qu’il y a de bien avec Drupal c’est que l’on a l’impression de jouer aux lego, un module par ci, un module par là et le tout, imbriqué depuis l’interface d’administration de celui-ci. Mais comme moi, un jour vous avez voulu créer vous même vos structures et non plus seulement réaliser ce qu’il était possible de faire avec une simple boite de lego. Bref, vous avez déjà eu besoin de développer votre propre module afin de tordre le système et le faire coller à votre cahier des charges. Cette nécessité de faire son propre module arrive bien plus vite qu’on ne le croit et c’est pour ça que je me suis dit qu’une petite liste des principales choses à connaître pour jouer avec Drupal serait utile.

Du coup, j’ai essayé de me replacer quelques mois en arrière, à mes débuts avec Drupal et son api et je vous ai listé les principaux hooks que vous pourrez être amenés à utiliser au départ. Concept et implémentation d’un hook Un hook c’est quoi ? Oui mais concrètement comment ça marche ? Thème. Learn Views with NodeOne, part 19: Contextual filters with paths. Theme_flow_6_1. Drupal 7: Load content nodes into a modal overlay using AJAX | fourfightingfoxes. For one of our current projects (Aiko) we are building a site influenced by the Bloomberg L.P., company site, by Frog Design and the website, Pinterest. The design dictates that most of the site content is presented using a dropdown menu approach.

Normally, a dropdown functions best when all of the content is already loaded on the page, and just relies on javascript to animate the display and hiding of each dropdown element. For this design, it is pretty obvious that requiring all of the overlay content to load along with the initial page is excessive for both load times, as well as complicated for the CMS organization and structure. AJAX to the rescue. By loading each of the individual content nodes "on demand" we can cut the unnecessary burden of loading everything up front, and only load the content that is actually requested by the visitor. Now the question becomes... how do we best do this in Drupal 7? My solution involves the following approach: mytheme/template.php mytheme/script.js.

Drupal 7: Load content nodes into a modal overlay using AJAX | fourfightingfoxes. Php - displaying a Drupal view without a page template around it. Adding a module path to Drupal 7 theme registry | Metachunk. Suppose you have a module which contains some templates that follow standard template suggestion criteria. ex: (block--module--delta.tpl.php). By default, Drupal 7 will not search your module directory. It took me hours of googling and cursing to figure out how to do this. The magic is below. Much of this code was lifted from other examples/modules, unfortunately I didn't document where.

Code Block 1: Theme Registry Alter Hook The code above basically creates a copy of the theme registry, works some secret theme_process_magic and appends our module path. It also requires a little helper function for dealing with the array. Examples for Developers. Follow the Examples project on Twitter: The Examples for Developers project has a Gittip team page. You can contribute financially to the project: Code Examples For Drupal The Examples for Developers project aims to provide high-quality, well-documented API examples for a broad range of Drupal core functionality. The Examples project contains many modules which hopefully illustrate best practices for implementing various Drupal APIs.

Developers can learn how to use a particular API quickly by experimenting with the examples, and adapt them for their own use. Note also that these modules demonstrate internals for Drupal development in PHP (and some JavaScript). How To Use These Modules As Modules You can enable these modules just like any others. API.Drupal.Org You can also browse the documentation generated from this project on api.drupal.org. Browse The Repo Adapt The Code Core Only How can you help? I'm glad you asked: