Latest Entries »

I’ve just solved a tricky alias problem, I write down to remember

Drupal settings

  • a drupal 6 site with several language with english as default and french as the second language.
  • the possibility to a user to change manually the alias in the node edit form
  • the possibility to change aliases gloablly using the page at admin/build/path/add
  • the language content negotiation settings is set as Path prefix with language fallback

The problem

When you have a node in english and you want to set a custom alias for it. Say it’s www.mysite.com/node/134 and you want to give it the alias www.mysite.com/aboutus.

When you navigate without to www.mysite.com/aboutus it’ll not work, when you go to www.mysite.com/en/aboutus it’ll work and when you go to www.mysite.com/fr/aboutus it won’t

Now add another node which is the translation of node/134 and is at www.mysite.com/node/145. Then add the alias www.mysite.com/apropos. It’ll be visible at www.mysite.com/apropos www.mysite.com/fr/apropos but not www.mysite.com/en/apropos

Why ?

It behave like this because

  • the alias set in a defined language version of a node is of the same language as the node : if a node is an english node, the path created is visible only if the site is in english.
  • When the content negotiation is set as path prefix with language fallback, and their is no path prefix in the path which is the case of our aliases, the site current language will be the user’s preference if the user is connected or the browser preference if he isn’t.
  • So In our case when their is no path prefix in the path, the site is in french, and as the alias is in english for our www.mysite.com/aboutus alias so it’ll show only at this url  www.mysite.com/en/aboutus
  • In the second case as the alias is in french, it show in both www.mysite.com/apropos and www.mysite.com/fr/apropos

The solution

I’ve not found the solution for the path input field of the node edit form. We should have a checkbox, make this alias valid for all language.

As it doesn’t exist for what I know, the solution is to use only the admin/build/path/add interface and to select always all language as the language of the alias.

Well tricky no !

The node reference field allow to limit the node being referenced not only by node type but also by a a view. Waouhh! great flexibility! The principle is to make a view of type node with display type field and to output all the nodes that can be referenced by other node.Then we go back to our node reference cck settings and we choose the view name we’ve just done.

Till there it’s good, but what if you want to give to this view a bit of the context. For example your are on a content profile describing a society, and you want to allow this society to reference other society, but depending of the value of a field in the content profile of this society. In my  case it was the society type.

The solution is to use the possibility to give the view used to populate the node reference field with a argument. This argument can be fix or can be dynamic, that is generated by a php snippet. When it’s fix it need to be set in the cck node reference settings as describe in the following image

When it’s dynamic you’ve got nothing to put in the text field ‘Views arguments’. The setting is in the view. And the view can grab it’s context from the url of the node modify or the node create form path.

As I’m talking about a content profile node, the url is a bit different as it is a sub url of the user account url for example

user/11/profile/societe

So we want to extract the uid of the profile, load it’s content profile of type societe and then pick a field information of it that is 0 or 1 depending of the society type.
I’ve used the following snippet in the argument section of my view :

//grab the uid of the content profile being edited
$uid = arg(1);
//load the associated content profile
$node_ste = content_profile_load('societe',$uid);
//find a field that have the information about society type (0 or 1)
$ste_type = $node_ste->field_ste_type_simple[0]['value'];
//Inverse this relation as we want only the society not of use type to be referenced
($ste_type == 1)? $ste_type =0 : $ste_type = 1;
//We return this argument
return ($ste_type);

To improve the handling of error messages, a great way is to display the error close to the field it’s related to.
There is two drupal module that allow this, the two have a D7 version in preparation.
It’s inline_messages and ife modules

I’ve just tried both and try to figure out the difference

inline_messages is based on javascript and especially a small js utility jquery.scrollTo. I think the principle is that it move the div with js and scroll the screen to see it
For the selection of module to be selected the author describe in a blog post the enhancement she made. It’s a two way selection mode of form to be handled by this module, three category of forms site, content editing or administration pages
It’s not totally clear for me which form ar included in which category. And complementary to this is a text area that allow to put form_id to include or exclude explicitaly.
The main problem for this module is that I’ve not seen any result per aps a js problem. So I’m waiting to found the solution to give you a opinion on the ui. I’ve described my issue along with others so I’m waiting !

ife is not based on javascript. It’s using form_api to move messages div just below the field it’s related to. It work for me, the thing it doesn’t is the scrolling utility inline_messages do. For the selection of form to be applied it provide a list of predefined form, and you can add form id.

Three possibility are given to do with the original form area, You can set this settings by default and override it for a specific form_id.
The settings are :
- Leave message in place : They will be duplicated inline and at the top of the page
- Display a generic message : To make people think to scroll the page to discover inline messages
- Remove the message : The top message will be removed, only the inline messages will be removed

In the following screen shot you can see the general default settings.

To conclude, both modules use different technique to move the message inline, javascript or form API. I’ve got a problem to try inline_messages module, so I can’t really compare the utility. For IFE module it do what it say without problem till now, and I’ll certainly implement it in my sites, as I think this behavior is pretty generic.

How to mix Drupal Content profile module and node reference fields to let create user’s company profile in a wiki / proprietary mode

In this post we’ll try to figure out how to :
- Combine content profiles with extended Profiles built with a node reference field
- Compare different way to build them in Drupal based on a use case of the site archiref.com
- Create a mix wiki proprietary permission scheme for those extended profile nodes
- Put this solution in perspective to be portable to Drupal 7

Often a user need to have a content that is related to him.
This is due to the fact that a user is in drupal 6 a seperate entity and not fieldable.
In drupal 7 the fieldable property of the user would simplify the thing.

That could be as simple as an additional image picturing the user face or
a complicated content describing the user company.
The basic strategy is to use the content profile module that allow to link a user to a node of one or various content type.
This modules is very useful, but it has also its drawbacks not because of bugs but because of the way it is conceived.
There is also some other ways to link a node to a user that we will examine further. They are a bit more complicated to implement, but could achieve more flexibilty.

1/ Content profile module

What does it do :
You define a content type that should be handled as a content profile.
This will have a consequence on how this content will behave. This choice is reversible, so don’t panic !
Once’s set as a content profile, the content will obey content profile rules :
- One user can only have one content profile of a defined type
- It can have different content profile of different content type but only one of a type
- The link between a content profile and its user is made by the author property

Advantages of using content profile :
- the content profile will manage for you a content edit form accessible on the my account page
- it dispose of view integration that allow to load a specific content profile from the relationship part of view UI
- it has API function that allow to easily load a content profile account of a defined user.

Drawbacks :
- it has limited way to filter content profile type by role using the permission to filter them out
- it has no way to let other users create the content profile node before the actual user, whose society is described by this content profile. This behavior is what I call a wiki/proprietary mode where the node that describe a society, is first created by a user of the site and then if it occur that the legitimate society’s user create an account, will later be assigned to him.
- What if you want a user need to have more that one profile of one type, more than one society ?

Turn arrounds of the drawbacks described above
- If you want to filter the available content profile type by role, you can use the node permissions allowing only defined role to create and modify the content profile they are suppose to use.
- If you want other people to create a content profile node even if the legitimate user has not created an account I will describe some possibilies. The problem is that when somebody create a new node that is used as a content profile, it’ll be considered as this user content profile and a user can only have one (remember the association is made via the author properties of the node). To be clearer I’ll use my usecase example :
I have two roles ‘photographer’ and ‘architect’. I want the architect to have a content profile of type ‘architect’, and photographer to have a content profile of type ‘photographer’. I want architect to reference architect ‘content profile’, when indexing their images but without this architect node being considered as their content profile. When later the architect described in the node, create effectively an account, I want him to be able to inherit this content profile and all the information and architectural projects linked to it.

I see two main solutions to achieve that with the profile nodes being managed by content profile module :
- hook form alter the creation form of architect node to set the author property only if the user has the architect role.
If the user is not an architect set the author to anonymous : it’s the wiki mode. This allow the node not to be associated with the acting user, and let him create more than one pre-content profile node
The drawbacks of this strategy is that an architect could not create other architect that him, and has not a standard wiki user role.
It need also to patch some other module involved in node creation to undo the author property to be written. It need also to grant the user with the ‘administrate node’ permission (I don’t know exactly why) and that bypass the fine grain permission the content access module can give us.
It seem us for all this reasons a bit too tricky.
- create a false user in advance every time an architect node is created, and change the author to this fake user. This can be realized thanks to a rule when a photographer create a new architect node
The drawbacks of this strategy is the creation of false users that probably would never be used. It complicated the user management.

So let’s examine other solutions :

2/ Use a userference field in the profile node that point to the user

In normal cases, the node architect node is only created, and the cck user reference node is not populated
When the node is supposed to be the profile of the architect user the field is populated.

But when this cases could be identified, so that we can create the adequate rules.
First case, the architect doesn’t exist yet in the system, each time a new architect user account is created, a new architect node is created and assigned to this user with the userreference field referencing the newly created user.
Second case the user want to associate its profile with an existing architect profile.
Here is how it could occur :
- An architect create an account with a account creation form that have the folowing fields :
. login or email
. password
. type of account
. name of the compagny

After he submit the form he is redirected to a second screen that let him do the following :
. create my company profile

A view found existing architect node that have part of their title in common with the name of the company field.
If this view has a result a second option is available to the user to select existing profile he wants to use instead of creating a new one.
He can choose only one choice between the possible various view results.

If he choose to create a new profile, a content of type architect is created,
the userreference field is populated by the userid and the user is redirected to fill some information about it’s company.
The interface need to let the user understand he could fill this content later if he doesn’t have time.

If he choose an existing node to be its profile, an action should be created via a rules set for example.
This rule set will do the following on the node selected by the new user via the View VBO interface :
. populate the node with the userid
. set this user as the author of the node

The problem of this technique is how to select the profile node :
. to make a link to it in the interface of the user
. in other context when we want to show the profile related to a user
In a view we could use reverse reference module, but to what I know it doesn’t work for userreference.
We could use auto populated reverse reference, but I don’t know it exist such a module for user reference.
In a menu it is more difficult, and this menu item needs to be a view result.

So this solution doesn’t seem to work mostly because of the user of user reference and the node > user relation. We’ll try to use a node reference instead, and has a user > node relation which is more easily manageable.

3/ Use a nodereference field in a simple content profile node that point to the complete company node

The problem with the previous solution was mostly the difficulty to retrieve the content that point a user.
It’s a reverse reference, I have one user. I want to find in all the nodes of this type, that point this user and thus I need a sql select query.

It’s easier to use content profile solution that make a link between the user and the content, and to create in the content profile a nodereference fields that point to a different detailed profiles the user can have.
The greatness of this strategy is that it allow to reference several content profile by user of every type.
A user can then have different companies if he need to. I don’t know how facebook really work, but if I try a comparison, the content profile managed by content profile module would be the user facebook profile, and the other profiles would be the facebook pages.
This profiles could be described as extended profiles, connected but not identical to the main profile attached to the user account.

A view can be used to retrieve this extended profiles node, the view can retrieve different node if the user have several profiles.
A architect user can then have several architect companies if he want and a photographer and media owner profile if he has several activities.

To ease the selection of this node a reverse node reference field in the profile node can reference the content profile of the user. This could be achieved throught the use of the excellent CNR module or Corresponding Node Reference.

When an architect create an account a rule create for him a profile, an architect profile and populated the node reference field of architect profile with the nid of the content profile node.

When an architect want to reuse an existing profile, a rule set define an action that populate the nodereferenc field for him.

Possible solutions for permission management in a wiki/proprietary node

For my use case I needed also that when a architect profile be assigned to a user, the other users could no more modify the node. It’s what I call the wiki/proprietary mode. As long as the content has no propriétary, it’s in wiki mode, it could be modified by every user. When the appropriate people has created an account, the node is locked for others.

For the moment I can see two solutions to achieve such a permission limitation :
- Use the content mode of content access module, that allow to content access to work at the node granularity (and not the content type one). The node that have a owner would only be modifiable by him, the others could be modified by every body. Content_access need to be changed automatically via a custom module or a rule
- a version of user reference access module that would allow only a node being user referenced to modify it. The problem is that the rights would be modified during the node’s life. When the user reference field is empty everybody could modify it, when it’s filled only the user referenced will can. I don’t know if this is possible.

This permission issue sould be part of a future blog post comparing permission and access solution.

Drupal 6 to Drupal 7 migration perspective

This solution describe in the point 3 seem the most adecate to allow wiki/proprietary profile node. In the perspective of a migration to drupal 7 let’s examine how it’ll behave.
In drupal 7, the user is an entity as a node and is fieldable alike. There is no need to use the content profile module any longer. As far as I know the user is a pretty private entity, not sure it’ll be possible for other users to modify it in a wiki mode. So the separation of node related to the user and the user’s content profile in D6, user’s fields in D7, seems accurate.
But if the user entity is sufficient to create fields without the content profile and the content profile module is not ported to D7, what will occure to our node reference field referencing the content profile node? The node reference fields that link the extended profile node to the content profile won’t be valid any more ? We’ll need to tranform it in a usereference instead ? These are open questions as I’ve not try sufficiently D7 to answer it but need to think be thought about.

Conclusion :

Content profile module is the easyest way to link a user to a node that describe it’s profile
It a very stable module, but it cannot be use when the usecase allow other people to create in advance this type of content.
This is mostly due to the authoring property used to make the relation and the condition that a content profile need to be unique.
The association of a basic profile common to all users whatever are their type, and specialized extended profile linked via a node reference field to this content profile seems to be a good solution to answer this use case and give more flexibility.
This d7 porting of this solution needs to be clarified, and the permissions change when then the node change from wiki to proprietary mode.

Nodereference selection

It exists various solution to let the user select nodereferenced field.
Let’s examine the one that provide the ndoereference module it self :
It let you choose between three widgets :
- Select list
- Check boxes/radio buttons
- Auto complete text field

The choice between this three widgets depends mostly of the quantity of possible nodes that could be referenced.
We can assume that check boxes are good for a limited number of choice (below 10 items)
Select list can allow more choice, the different choices are not shown permanently on the screen as with checkbox. This is the advantage of select list that take less space on the screen, but also its drawbacks depending of the cases. The user could miss an option because he don’t take time to examine all of them.

The autocomplete widget is a must when you may choose between a lot of potential nodes (more that 20-30).
The user start to type, depending of an settings of this widget, it retrieve the nodes which title begin or contain the string that the user start to type. A potential problem with it that the number of potential node grow, and the autocomplete start to be slow, the user feel impatient and write to much and recreate a node with a slightly different orthograf. The user need to undesrtand that it is an autocomplete field. An icon show that but peraps it’s not so universal

Multiple choice
The multiple choice version of the select list widget is not so useful.
It’s like a small rectangle that shown 3 or 4 option, and you need to press CTRL to select more than one option.
This form of multiple selection doesnt give the impression of having made a “solid” choice. This is because we don’t see all the options at once. A module permit to make a mix between select list and checkbox allowing to have a more secure form of selection.
So when you have muliple choice, it could be a good option to use checkboxes instead.

The autocomplete widget
The autocomplete version of multiple choice is good but good be better.
The main critic I could make, is that is show at once two input box, and a button to add more.
This is when you define the number of node to be chosen to unlimited. When it is set to a number between 1 to 10, it’ll shown the 5, 6 …input boxes.
For a defined number of node, it’s comprehensible and its use case appear to be clear. For example “Choose Five friend to send and invite”. It’s logical to show five input box to the user.
But when set to unlimited the two input boxes doesn’t seemed to me very evident

Choose what node to be selectable
To define a bit more precisely which node could be referenced, the simplest way is to restrict the referencable node by type. But when you need to be more precise about which node could be referenced, you can use a view which has no more utility that selecting this node. The view could receive arguments.

Referenced node that does not exist yet

This is a commun utility that is not being provided by the autocomplete widget.
There is different module with sometimes similar name that try to fufill this functionality
Lets list them here :
Modules that allow a seemless creation of newnodes just by typing their name

- noderefcreate : create a new node from a template file. This template is a node that has been identified as a template with a special string. There is a general setting of this module, that allow to append a string to the node title. The node title is the one that the user type if the autocomplete field has given no result.
But as if is a template, you can define some g√©n√©ral field, for example taxonomy that are auto filled. This module seem good, but infortunaltely I could’nt manage to select a template. The one that I’ve been created have not been recongnized

- nodereference_autocreate : This module is simpler than the preceding, but per aps more usefull. If the autocomplete widget give no result, it create and reference a node, with the current user as the author, and the texte typed as a title. This way to node is created and could be modified by another way, in the node edit form of the node thus created for example

- Node relationship : This module is a big module, with a lot of functionnality. Mainly it permit to edit, search or create new nodes directly in the node edit form of the original node. The modal frame is useful but not so elegant. I’m trying to customize it but had no time for it till now. There is no problem with jquery in it for example by using cck group tab contrary to other module

- popups_reference : this module act as the node reference module and intergrate directly in its settings (it’s not a different widget). But it provide just below the text input box a add and reference link. This link open a window not so big that the node relation ship one and less stable with jquery element inside teh node edit form of the referenced node. On the other hand, its design by default (3 skin availables) is more elegant. For me this method is very user friendly,it could be better if when the autocomplete doesn’t give result, the windows would open automatically. I don’t know if it would be possible. But the size by default, the problems with jquery inside the windows, make me say that in its default state, it’s good for small size node edit form.

- nodereference_url : Allow to create a node from the node that it’ll reference and lock the nodereference field so it would not be more editable by hand. This module is ideal to make a parent child relationship. You have let’s say a festival which are one node type and events in that festival. If you reach the url node/add/event/id_of_the festival, this module will auto populate the id_of_the_festival in all the node event created in that maner.
From a user point of view, it’s very intuitive and efficient. But It create a unique relation, the node event has one and only one festival. You can retrieve all the events in a festival, by using a view that use a reverse relation ship.
It’s not useful, when you have several node reference field to be filled, when you want to have a one to many node reference….

What to choose

Localized taxonomy :

The term (and tid) between each language is the same.
The terms are localized by the means that drupal offer or the excellent translation table module .
The good point of it is it’s simplicity. One’s a localization have been written in a language, and that language has been activated, the localized term show up to the user.
The unicity of terms is also a simplification if one want to show nodes of this tid. whether they are fully translated or not. They simply show up in their translated form if it exist and in it’s origin form if not.

Difficulty to deal with international contributor
The bad point is how to deal with content entered in different language. If a french user create a content with the free taxonomy tag “bleu” which is being localized by an editor. And then another english user enter a term “blue” which is another term : the two posts will show on different pages. How to relation this two terms as the translation of term is not available in localization mode ?

From which language the terms are being localized from
They are localized from default language, the current default language. In translation table interface you see a column with the name of the default language. this column and localization is not use as long as this language continue to be default language. If it change, the localization you provide here could be used.
But the problem is that my strings could be entered in all the languages available and I want it to be translated in one way or the other.
Per aps the solution would be to have an intermediary language which serve only to enter data and from which all would be localized in all the languages.

Good points :
- content don’t need to have been translated to the language in which the term have been localized.
- When somebody create a new content, the terms to select form (if we use a select liste widget) will show up in the localized version. This is not the case as my test conclude with the translatable terms.

Translatable terms :

Synchronization of taxonomy terms thanks to isync taxonomy : The behavior of the terms that belong to a translatable vocabulary is odd. Whatever language is my default language, when I create a content the list of content is show in the original language.
The translation don’t occur if I do not translate the content in which the term is used.

It’s sad because It could be a more versatile and elegant solution. I’ll try to figure out why it’s behaving like this.

Internationalization in Drupal is a quite tough and hard subject.
But often things are simpler than one think.
Here is a serie of how to that I’ll write as long as I discover it :

1- How to have a drupal site in french and interface in english for the admin User

I’m french, but I like to have the Drupal admin Interface in french, because I’m used to this terms. And also because the adminsitration menu is ordered by alphabetical order, and thus all the terms are reordered when we change the language.
The task is thus not only to remember the terms, face bad or aproximative traduction but also to remember how this menu items are being placed in the current language.

So I needed this configuration and I’ve found how to set it up.

You define two language french and english. You set french as the default language. Default language should be in the language in which the site will be (if it’s a site with only one language).

You set the fallback negotiation to Path prefix with language fallback
And you verify that the language prefix have been set properly.
Then you set you user account to use the english language.
And if everything work fine, you should have all your url prefixed with en if it’s the prefix you’ve chosen, and your other user can have the site in french, as it’ll be their preferred language.

I’ve installed the translation and internationalization Drupal provide in my current working site www.archiref.com and thus I’ve realized that it will be a time consuming process to translate all the taxonomy terms of different vocabulary, that partially overlap.
I’ve realized also that it is possible in the settings of the CCK taxonomy field to designate a parent term under which to store the new terms, and also to specify a parent term that will limit the autocomplete search.
All the ingredients are here to change my taxonomy strategy for some of my vocabularies like for exemple ‘material’ a vocabulary to store architectural material definition, vegetation to store plant related terms to one big TAGS vocabulary with sub section defined by a simple one level hierarchy.
The candidat for such a change are open freetaging vocabulary. For closed small size vocabulary, this translation problem is not such a problem and this should not be useful.

But once I’ve started with several vocabularies and want to merge them into one vocabulary and under a parent term
This my actual scheme
VOC TAGS (more general tags)
- bottle
- people
- cat
VOC Vegetation
- tree
- oak
- grass

VOC Material
- brick
- Concrete
- Wood

I wanted to switch to this scheme

VOC TAG
- bottle
- people
- cat
- Vegetation
- tree
- oak
- grass
Material
- brick
- Concret
- Wood

How the hell I can do this ?
I know how to merge taxonomy terms thanks to taxonomy manager module, but what about taxonomy Vocabulary ?

I’ve studied a bit and found this SQL Query to do the job.
I first create a Term in the destination vocabulary (VOC TAGS) and note its tid here 2631
I then change all terms of the vocabulary I want to merge to have its tid as parent.

UPDATE `term_hierarchy`
INNER JOIN `term_data`
ON `term_data`.`tid` = `term_hierarchy`.`tid`
SET `term_hierarchy`.`parent` = 2631
WHERE `vid` = 45

I then change all the vid information from the old vocabulary 45 to the new

UPDATE `term_data`
SET `term_data`.`vid` = 34
WHERE `term_data`.`vid` = 45

And the job is done very quickly.
I only have to setup the CCK taxonomy terms to use the parent term 2631 as a sub set of the vocabulary both for storing new terms and for the autocomplete functionnality to search

This two settings are Extra parent for new terms that define the term under which the new terms store by this CCK taxonomy terms will be stored

And Parent terms beneath that define the term under which the autocomplete will search

The limitation of such a strategy I’ve found so forth is If I wanted to use the faceted search module which define facet with the whole vocabulary, and surely other modules, but for this site and for what I know, it has more advantages than drawbacks.

How to revert this manipulation

A bit later I’ve changed my mind about how I would store the terms. The translation problem remains (duplication of specialized terms like a color name “blue” in the general tags vocabulary.
But I’ve found other reasons strongest that motivate me to have separate vocabulary.
The manipulation is reversible, I’ll write it soon. The principle is to localize the terms in the general vocabulary that is parent of the sub-terms.
To change terms vocabulary for the terms that has this terms as parents.
It required to make a join between term_data and term_heriarchy table to select the terms.

The holy grail have been found since 2006 and explained thoroughly inthis a list apart article.
For those who don’t know, it’s a css technic that allow to have a main content area with fluid width with two sidebar with fixed width.
This technique is quite difficult to figure out and the use case is so common, that the author Mattew Levine has named ironically the Holy Grail

But in my site archiref.com I needed to use this recipe in various configuration with or without sidebar, whit a big one and a small one…
So I wanted to have a generic solution to use the holy grail.
I’ve recently discover SaSS which is a dynamic CSS system which is awesome.
I wanted to rewrite my rules so as to easily confugure some pages with different sidebar setup.

I’ve nearly succeed in my attempt to configure all the rule in one mixin.
The last problem that I need to solve is to have a parent selection some how.
I mean I have
body id=”page-images” ….

And I use the mixin like this

#pages-images {
@include sidebar(200px , 400px);
}

Where 200px is the sidebar-left and 400px is the sidebar-right.
I configure things in this mixin that ar html tags inside But I can’t configure body it self which is important in the holy grail.
I mean the body wich has the page-images id.

I use the SaSS & parent selector, but it don’t work, so my selector are two instead of one and there is a repetition of the variable.

I’ve tried body& but Sass say to me
error scss/_archiref_layout.scss (Line 154: Invalid CSS after ” body”: expected “{“, was “& {”
My sass code was
#page-images {
body& {

And I wanted it to output
body#page-images {
Which is a valid css selector the body tag that have the page-images Id
So I don’t know it is possible

As it’s better than nothing and I spent time to achieve it here is my code in two part

the definition of the mixins


@mixin sidebar-float {
  float: left;
  position: relative;
}
@mixin sidebar-body($width-left , $width-right) {
   min-width: 2 * $width-left + $width-right;
}
@mixin sidebar-double($width-left , $width-right) {
  #wrapper {
    #container {
      border: 0;
      padding-left: $width-left;
      padding-right: $width-right;
        #main,
        #sidebar-left,
        #sidebar-right {
          float: left;
          position: relative;
        }
        #main {
           border: 0;
           width: 100%;
         }
        #sidebar-left {
          border: 0;
          left: - $width-left;
          margin-left: -100%;
          width: $width-left;
        }
        #sidebar-right {
          border: 0;
          margin-right: -100%;
          width: $width-right;
        }
     }
  }
}

//Some variables
$sidebar-width-big: 300px;

the usage in my code in one case


body#page-images {
    @include sidebar-body($sidebar-width-big, 200px);
}
#page-images {
   @include sidebar-double($sidebar-width-big, 200px);
}

For a long long time I wander mysel how the hell I could install this so called simple install of php module.
I listen they use a sort of good stuff to install them that was named PECL.
The tuto I’ve found was complicated as they say that it was necessary to download the source, compile it, move it to its folder. …
A lot of time I’ve tried it and it fail.

And I’ve just found a new tuto that say just
sudo pecl install uploadprogress
to install uploadprogress and get rid of the related drupal message (link to file field or upload I suppose)
And this pecl script do all the stuff and at the end of the script say to add a simple line in the php.ini file

You should add “extension=uploadprogress.so” to php.ini
To found the php.ini file you should type
locate php.ini
and normally you’ve found it at /etc/php5/apache2/php.ini
You add the line at the end typing GG to go to the end of vim editor, and adding the line
after you need only to restart the web server with
/etc/init.d/apache2 restart
And the thing is done you’ve installed uploadprogress , xdebug or other cool php extension.

Features are great but very intimidating when things go wrong.
The bad thing is that when it’s wrong it’s not so wrong.

It’s just that the programm don’t show you the way to fix the problems.
So It occured to me en error 500 because of the dependencies that enable a module that could not be available in the sites/all/module directory.

Some tools to debug error 500 due to the activation of a feature

So you have a 500 error, a blank screen and no way to bring it back, drush don’t work because the bootstrap is interupted by the error.
First how to see the error or how to debug http 500 error put this lines at the very beginning  in your index.php of your drupal installation

ini_set("display_errors","1");
error_reporting(E_ALL);

Now you can see why the bootstrap is failing.
In my cases, it was one module, that was installed, but was calling a function of another module that wasn’t present in my module directory.

To desactivate the module without drush nor the ui, you can use phpmyadmin, and put 0 on the status column of the module’s row in the system table.
It works drupal don’t load that module more, and the request is no more interupted by this error.

You only need to make the condition, the error don’t appear again, in my case copying or downloading the module in the module directory.

The module feature direct save works, just check the permissions

The module feature direct save allow you to save a feature and update its version in the current site, without doing the tedious, download, upload process (I don’t understand why it’s not part of features it self. Though I had problem because it say to me that the save was sucessful despite, the files hadn’t changed at all. It took me a while to fogure out It was a permissions problem, there is no specific message telling that in fact it had a probleme saving. So give all the permission to write in the feature directory to your web server, and it’ll save.

Is it good to use feature to activate modules in a other site ?

It was a question I ask myself. Is it good to pack in a feature a lot of dependencies, to activate the modules in the site.

I’v partially answered. NO because, it’ll introduce dependencies between the feature module and the module, which mean that you couldn’t disable the module without disabling the whole dependencies.

Think of dependencies as true dependencie, which mean your features could not work without this module. If it doesn’t work without, It’s better for the feature to be dissbled.

If you want to pass a bunch of module to be installed in the new installation, make a list of them, using

drush sm | grep "installed"
and make a
drush en module1 module2 module3
to enable them.
These modules could be disabled later without disabling the feature.

Features is a great module that aliviated drupal site builer in one of the most complicated point of Drupal state of art : the staging. Or how to move my part of site, improvement, features of a site, into an existing site without overriding the whole database.

How can we put together all the little moving part that make the complexity of a drupal site into an export that will be the most efficient ?

In the future I hope that i’ll exist a one off export button that will export in one action all the specificity of mys site, export that could be imported in whatever site in drupal exist. Per aps this will comme a day, withe drupal 8 version or more, but till this holy time, we need to work to achieve this transfert

The features module is one of the best module that try to answer partially to this problem. The principle is simple, the usage needs to experiment and is a bit frightgening especially with very complicated sites.

Principles of the features Module

With the feature module you can export your configuration in a module, that describe as an very long array the various part of your site. Each different exportables have a separate .inc file and there is also a .info file which is very important because it point to all sub elements that should be included in the feature.

Some element are described in the specific .inc files, one peculiar element is what feature call dependencies which in nothing else that drupal  modules. A Feature can thus be dependent of modules, normal modules and features modules. That is the mean to do sub feature.

But to start don’t venture to do complicated stuff, just try to make a big unique feature that take most of the site, all that is exportable

Once the feature is made in the site form which you want to reproduce the configuraiton, you make the feature upload it to the site where you want to import the configuration and activate the feature.

It’s possible you can’t activate it if you have some dependencies (modules) that are note available in the target site. Download it, and once everything is OK, you’ll be able to activate your feature. Activate mean alter the dabase to create all the things that is described in the feature file.

————————–

What a feature can export

THE EXPORTABLES WITH THE CORE FEATURES MODULE

Content

  • Content type : When you create the feature in a site and export it and a new site. When you enable the feature, the content type won’t be more deletable. The module responsible of its creation would be features, its permissions will be in the feature part and no more in the the node part of permission table (don’t be afraid it’s like this)
  • CCK : You don’t need to select each cck field, because once you select the content type, it’ll detect the field as a dependency. It mean feature will create the cck field description in a special file. When you import the feature, there is no mean to see that this fields have been chosen or only packed with as the dependency of its conten t type

Formatter

  • Custom Formatter : yes
  • Image cache : yes

Display

  • CCK : No problem for view,it’s fully exportable, feature offer then a mean to export all your view in one shot great
  • PANELS (Page manager) : Panel is also fully exportable, all the pages will be there
  • DISPLAY SUITE : All the Node Display you have styled are there.

Menu

  • Menu : Menu are exportable
  • Menu links : Don’t try to know is menu links are auto detected as cck field are when selecting a content type

Role

  • Role : Define a role in your feature that you’ll assign to you existing user when imported in the new site could be a good way to separate the new functionality from the rest of the site.
  • Permission : note all permission need s to be taken here, only the one related to the new functionnality

Rules

  • Rules : Exportable with no problems. Don’t forget to assign catégories to your rules, feature use the catégory as a selector to the rules to be exported and it is not rules by rules

Modules (Dependencies)

  • Modules : At the end of this list, but not the least important, the features only include the description of the module to be installed, not the module it self. When you install in a site that don’t have a module. Just copy the list of “unmet dependencies” in a terminal a write drush dl modules1, modules2…. and drush en modules1, modules2 to download and install all that stuff

————————–

THE EXPORTABLES WITH THE ADDITIONAL FEATURES MODULES : Strongarm,  Features Extra, UUID Features Integration

Elements  added by features Extra

  • Custom Block (Boxes): The custom block other way called in Drupal Boxes
  • Block définition : Infortunately the definition of the block made in the block administration page is to be chosen separatedly from the block content
  • Vocabulary : Infortunately note the terms, you can use taxonomy import to import the terms.

Elements  added by Strong Arm

  • Variables : That is the variables stored in variables table of the database. TO know which one to chose, use the devel variable editor that allow you to preview more or less where you have settings and where you don’t have. If you planned to import the features in an existing site. Check that you don’t have conflict with the variable settings in the destination site.

    Suppress the file field Remove button

The upload button is necessary, I would rather have it trigger automatically once the file have been chosen, but it’s not so bad. But on the contrary the remove button is less useful, and sometimes you want to hide it, to lighten the UI, and also to prevent you users to remove accidentally the image they’ve just uploaded

The solution I suggest here is based on CSS. I’ve analysed the html code the file field widget produce.
Basically, when there is no file there is only one container .widget-edit that contain the input of type file. But when an image have been uploaded a new container is added through ahah  which is called .widget-preview.

Thus I can target the .widget-edit container to disapear when it is just after another container .widget-preview. I use here the adjancent CSS selector that say, a container A + B means target the div B just after a div A (but at the same level they are siblings)

So my CSS code to hide the drupal cck file field remove button is

.filefield-element .widget-preview + .widget-edit {
display: none;
}

The Drupal mail system

The mailing system of Drupal is not one of the best developped features of our all purposes CMS.
It’s complicated, and things go wrong too easily when trying to  send html mail

First off let’s present the actor

  • The base drupal mail system only allow plain text and is working rather good
  • There’s a module called MIME MAil that allow the possibility to send html mail
  • Of course If you send HTML mail it means that the input format you hace set for your content have not stripped all your htmls tags, so you also need to define the good input format. HTML filtered allow only link and some few html tags like <strong>. Full Html normaly accept everything except what is not HTML for example PHP
  • Third party modules like
    • Rule that allow to send html mail and system mail when a condition occur
    • Webform that allow to send result of a poll to its administrator or anyone else
    • Send Module that allow user to send a node to their friend by mail
    • Invite that allow user of the site to invite friends to register and become user too…

There is potentially lot’s of modules that can implement mail and html Mail.
But lets try to understand when it fail why ?

Some drupal mail bugs that I came across and the solutions I’ve found

  • Conflict between an option of mimemail and the system default mail
    An option in Mime mail say that mime mail is always
    used but thus If you have a rule that use non htmail mail it’ll produce header of messages like folowing
  • Use mime mail for all messages
    Use the mime mail module to deliver all site messages. With this option, system emails will have styles and formatting

    In the header of the mail I’ve received that. I interpret it ouput the mime mail version in the header and not in the body of the mail
    =?UTF-8?B?Q2VjaSBlc3QgdW4gZGV1eGnDqG1lIG1haWwgZW52b3nDqSBwYXIgbGUgc3lzdA==?= =?UTF-8?B?w6htZSBkZSBtYWlsIGV0IG5vbiBwYXIgbWltZSAgbWFpbA==?=

  • HTML Mail is a module that provide a template to theme the mail send.
    To be sure a module or whole drupal installation use html mail choose it at the administration page mail site configuration/mail system

With the help of this module and using rules to send mail when an event occur (the creation of a page for example), I’ve still a problem, my images tags are stripped like this

src="cid:700206415edc46dee44ea0f03c5dcfca@localhost:8888" alt=""
width="589" height="30" />

It mean, it has stripped < at the begining src= instead of <src=

Why ? My input format is full HTML, so image tag should be allowed. Secondly the images tags src refer to a cid number, which surely identify the images attached to the mail. It has attached my files to the mail instead of inserting it inside !
But why did it took this decision , let’s investigate….

Finally after a lot of efforts, I have made this mail in html ouah without any incomprehensible thing.
An you know what, I’ve send an html mail in html, and to do that I’ve chosen Rules action “Sent a mail to a arbitrary mail” It means not “Send a HTML mail to ….” given by Mime Mail Module.
I’ve installed Html Mail and set in the configuration/mail system html mail as my global mail system.
And It works.

I’ve lost a lot of time, but I’ve done it!! Hoping that the future will simplify this thing.

How Drupal CCK Shared fields works

In Drupal and thanks to the CCK module, you can reuse the same field between multiple content type or you can create a new field which is specfic to only a content type.

Above is the part of the manage field page of cck that allow create a new field or reuse an existing field

The advantage of reusing existing field is :

  • that you can unify the settings of the fields, one setting for one is make automatically for the other instance of the field
  • You can ouput more easily the fields in view acrosse content type. (As simply as node->title which is present in all type of node)

The drawbacks are:

  • You can’t change the part of the settings in one content type, both need to be the same.

So think in advance if it is valid to share a field or to create different one. One possible use case could be to share the email field : field_company_email
across several content_type dedicated to one peculiar type of compagny photographer architect for example.
Despite of the differentt way that I treat this content type they all have an email and the settings could be different.

But now let’s introduce a subtility, all the settings of the shared cck field are not equal in all field instances !

I wander which one where equal and which one could be different per content type. The solution is given when one look at the way cck store the data in its table
There is two important table first one is content_node_field_instance which row represent the isntances of the field in all the content types. All the column of this table consist of data that can be different between content type. And the second one is content_node_fields which is a table where is stored the global settings of the CCK fields

The properties of shared CCK field  that could be different between content type

  • Weight : the position of this field with other fields of the content type
  • widget type : which widget is used to enter the data
  • widget settings : its settings (default value…)
  • Description : How you describe the field for end user
  • Display : the way the field is displayed

The properties of shared CCK field  that could not be different between content type

  • Cardinality : If the field is unique or multiple (if multiple a new table in the database will be created)
  • All the other settings

Field Level Permission to consider

There is also a permission issue to consider : If you use shared field it means that you won’t be allowed to set content type specific field permission thank to field_permissions module
For example you won’t be able to say I want user type 1 to edit field 1 in content type 1 and disallow him to edit field 1 in content type 2.
If you want a role + field + conent type permission granularity, per aps make separate fields

To sum up Shared CCK field is a good way to simplify the structure of the database and impose unity, but if in the future  the instances of the field will differ form expect from the above listed properties, It’s not a good idea to use it

5 drupal view best pratices

Here are some learnings I’ve made with my experience with views :

1- Use the menu functionality included in view

You have two ways to define menu entry for a view.
First you define a path for your view in page settings and second you go to the menu interface and your define by hand the same path.

Recommanded
Second you define inside the view interface the menu entry.The advantage of such thechnique is that the menu entry will follow the change of the view path you can make. And this is usual in a project to change the paths.
You define the name of the entry menu in the view interface, and when you have defined some of your views, you can reorder the menu in the menu interface.

2- Define a link to add a new item in the header section of the view

You have a view of let’s say contacts of people, and you want to provide a link at the top of the view to add a new contact.
You can then define a header to this view, with the link. But if you don’t check on option in the header seetings that say “Display even if view has no result”
The header won’t appear if the view has no result.
You have other solution to define what the view show in this case of O result which is “empty text” settings, but this is mean to be what is shown in the main content area of the view and not in the header section.

Recommanded
Don’t forget to click on the “Display even if view has no result” option of the header section of your view.
Use the drupal l() function to make the link.
Use a destination that is the same path than your view if not after you’ve created your new content you will be redirected to the node full view page.
To do so you can read my post on the use of l() function
Put the input format of the header to php code and write something like this

  $options = array(
            'attributes' = array(),
                'query' => array(
                'destination' => 'contacts',
            ),
          );
  print l(t('Add a contact') , 'node/add/contact' , $options);

The page in the example is www.mysite.com/contact and the content type is of type contact.

3- Choose simple names for your view paths

The shorter the name of the path the better.
Also remember a path is used by the user a aditionnal clue to understand the sites’ structure.
In a lot of sites, we’ve got the pattern
Home page > Search > List of result > Content (full node)
A good way to name your path could be
mysite.com/contacts for the list of result
mysite.com/contact/the_name_of_the_contact

Note the s of contacts in the list of result, and the contact without s in the full node page.
It’s both logical, clear to understand and short.

4- Avoid to use view diplay

The view display functionality allow you to define a base view or default display, and to override it to make different display of type page, block, node content, view attachment….
This seems good but there is several drawback to use it that drove me to avoid it because of the following arguments :
- When a view is loaded it load also the other displays, and thus make the request longer that it should
- The override system in drupal 6 is not very clear, it’s not obvious in the interface what is overriden, and what is not
- When you override a setting in one of the displays you can’t say, let’s make this override the default, and apply to all other no overriden displays. You should note the setting and duplicate it in the default settings, and then click and default to un override your current display. This is not useful at all.
- You can’t clone a display but you can clone a view, when you want to make a display similar to another one, and you have overriden it a lot, you can’t say just make me another display with the same settings. This functionnality is only for a whole view.
- When you’ve got a lot of display, it’s very easy to mak mistake setting a wrong display
- When using feature, it’s easier to define a view as part of a functionnality of the site, and only the useful view with no garbage display
Recommanded
So don’t use display if possible but different views with appropriate tag and naming to search in the view list.

5- Find your view name quickly

View provide a direct link to access to its settings with a on hover link.
This is useful but when you finish editing the view, the destination settings send you back to the view page.
For a single tweek, it’s fine, but if you want to work on the view longer it’s better to stay on the page.
To do so remove manually from the url the destination part of if and type enter to reload the page.
You’re then in the view editing page without any destination, quicker way to find a view than to scroll in the very long view list.

Using drupal l() function

Drupal link function l() is useful to output correct link.
Sure you can do it also manually

But by using the l() function, you can create a link that is truly portable when your installation of drupal change….
It’s the drupal way to make link, and you always have advantages in Drupal to use the drupal way.

As we can see in the function reference http://api.drupal.org/api/drupal/includes–common.inc/function/l/7

The signature of the l() function in drupal 6 is l($text, $path, $options = array())

The third argument $options is an array and is optional.
So at the very least you need to specify the two first arguments $text and $path
The $text is what is wrapped between the two <a></a> tags and showed to the end user.
The $path is the link you can go to when clicking the $text content.

Make a simple text link with l() function


print l('About me') , '/aboutme');

will make a good link, but if you want ‘About me’ text to be translatable you need also to wrap the text in the t() function that make

print l( t('About me') , '/aboutme');

Use an image as a link

Now how to put other thing as link that pure text, for example images?
The $text variable can be text but also html. If you want it to be html, you need to precise it to Drupal.
If you don’t do it it will transform all html tags in html entities and the code won’t work.
To tell Drupal that you want html, you need to define part of the $options array

$options = array(
           'attributes' => array(),
           'html' => TRUE,
);

print l('<img src="abouteme.jpg" alt="" />' , '/aboutme' , $options);

Use argument in the link query

What if you want to put argument in your link query. For example if you want to use destination argument that allow you to redirect the destination page to another page.
The link you want to make is of the form

http://www.mysite.com?destination=mypage

You’ll tell me no problem we put the argument in the $link variable.
But the problem is that drupal transform each html caracter into html entites like %3F for ? or %3D for =
So how to pass this link.

The solution is to pass it with the query argument, which is an argument that is added to l() function by its sub function url().
As described in url() function reference it expect a

query’: A URL-encoded query string to append to the link, or an array of query key/value-pairs without any URL-encoding.

So you should write the following code to encode the url http://www.sebastienlucas.com/photo/node/add/simple-link?destination=last%2Flinks

$options = array(
           'attributes' => array(),
           'query' => array(
                'destination' => 'last/links',
            ),
          );

  print l(t('Ajouter un un lien ') , 'node/add/simple-link');

New Since the time, I’ve written this article I had problem with the l() function when used in a node or in the header of a view (not in the row of the view strangely).
The function l() was outputing the query part of the url whith with some html entites instead of the character /
It drove me mad until I’ve solved the problem using another version of the l function which don’t express the query as an array of key/value but as a string of the query part of the url. For me it worked.

$options = array(
           'attributes' => array(),
           'query' =>'destination=last/links',
          );

  print l(t('Ajouter un un lien ') , 'node/add/simple-link');

For complete reference about l() function
l() function API reference
and the sub function url() that detail the $options array format expected
url() function API reference

More drupal debugging tricks

I’am currently debugging a drupal site where the blocks don’t show where they should be.
Here are some more tricks I’ve discovered by the way.

How to know which variables are available in a template file

Juste use the simple get_defined_vars which come with php.
It return an array of variables name as key and value as value.
You can the add the following line to your templates files pages.tpl.php for example

$seb_def_var = get_defined_vars();
dsm ($seb_def_var, 'Print all defined variables');

I use thus the printing facility of dsm, as this array is a big array!

How to see sometings with dsm() even if it has no value

dsm is great tool to show array in a convenient way, but what if the array has no value. In
this case it’ll show a simple bullet list dot with no value, no means to know what is happening.

The dsm function accept a second argument, which is a string that detail the dsm being made.
So put a label there that will show up even if the variable being printed has no value. It’s a good way
to recall you where is supposed to be you dsm() print and allow you to further investigate.


dsm ($var, 'Put here a text that will print whatever the $var variable may contain');

How to connect to a site where the login form don’t show up

First don’t panic. I did !

Just try this mysite.com?q=user

Normally It’ll work, once’s connected, solve all that mess!

Why draggable view ?
The draggable view module is great.
It allow to reorder elements in a specific way which is not logical but is determined by the choice of a real human.
With view, you can you sort photos by a logical order, for example by the date it was published, or by title or by location.
But what’s if i want to sort the photos in a specific order and change it freely and often.

Two ways to deal with images
For images one of the solution is to use a cck file field of the image type, and put the cardinality of the field to unlimited.
You can thus reorder it with a drag and drop interface.

But another way to think about images is to use an image as a node.
It allows to put unlimited fields that describe the image, and is a good choice if you want to make a collection of images in it self.
If you don’t think of the image as a mere illustration of another content.

Two ways to links images as a node
You can relate the images as nodes with other images using taxonomy or node-reference.
Taxonomy is flexible, but the term is a mere term no more.
Node reference is more complicated, but allows to link nodes to nodes of different types, for example link node type “image” to node type “body of work”.

They are several ways to make this link that I will explain in a following post.

Draggable view module in pratice
But for now I go back to my draggable view module which is a good way to reorder nodes in an arbitrary way.

The pre-requisite is to :

- install the module draggable view
-have a content type with an order field, it means a field of the type integer that can store the order value manipulated by draggable view

Then to make the view   :

- you make a new view of type node
- display the field you want to be useful for your user to make this manual sorting
- display one of the order field
- sort the view by the order field ascending
- set the display type  to draggable view table

And that’s it, set a path to this view, go to it. You will see some handlers on the first column of your table.

You can drag and drop, and save, and magically, the order is saved.

Reuse this order in other views

This view is an administrative interface  to change the order. Rarely it’s the view your final users will see.
To reuse this order in other view you only have to sort them by this famous order field that draggable view have changed.

For example, the home page is a good candidate to have images sorted by arbitrary order. Let’s say to show the trend of the moment which are changing day to day.
This way you’ll need two views, one in the back-end to allow you administrators to change the order, one in the front end to show the images in the same order let’s say in a slideshow.
To reflect this order you only have to sort the view by the order field.

Nothing prevent you neither to allow your administrative user to tweak this order manually by typing in the integer order field, but it is less convenient and intuitive than the draggable view drag and drop interface.


Some bugs and problems I’ve fixed
By using this module, I encounter some problems I’ve found a solution :
1/ If your order field is in first place in the table eg if it constitute the first column, the module will show a error message. It’s beacuse, by default the sort order field don’t show, and as the module want to put handler on the elements of the first column, It exist a conflict.
The solution is just to move the order field in the view to another place than the first place.
2/ I can reorder but If I save, it say me that the structure was broken, and repaired, but my order have not been saved.
This node speak about this problem http://drupal.org/node/393530
but for me the solution was to change the settings around “order field” to “CCK” instead of the default “native handler”
I don’t know why but now it work for me.

To go further
This module can store also hierarchical order, I let you explore this feature and see more documentation at the modules page
http://drupal.org/project/draggableviews

I have a site where I have a content type which serve also as the base for a ubecart product class.
I have problems lately with it for a particular bug, and I wanted to desactivated most modules and Ubercart also.
Because I have noticed that the problem was only on this content type and not for other.
When I descativate Ubercart modules, I’ve noticed, that my content type disapear also.
I was a bit disapointed, to realize that there was a dependancy of this content type converted to a ubecart class on ubercart.
An I activated again the ubercart modules because i needed this content type.
But once activated, I realized, it lost some settings, all the settings, exept the fields, it means automatic node title settings, form-filter settings and so on, group field…
I was a bit nervous, but luckily, I could set it up again rapidily, importing field from a database backup.
And the I see someting, In the product class, It’s possible to delete the class, actions that don’t delete the content type but give it again its status of core drupal content type and no more of Ubercart classes.
I’ve decided after this experiment to synchronize products with a content type, with the help of rules.
Because, I don’t want to rely on ubercart.
I will certainly learn more about this in the future.

I know there is some complicated way that use hook_node_alter, but I was looking since a long time for somethings easier.

And that’s is, i have it. And if you ask your self the same question, you probably already have seen a comportement of the view module that permit to edit a view, and when the view is validated, go back in the previous page. That’s exactly what I was searching, and the view module pass the destination page in the url. To replace the slash / Character it convert it to its html character equivalent %2F so the syntax is the folowing :
- Base URL of my drupal site : http://www.example.com

- Page I want to go after the form is being validated : links/list

- Page of the form : node/235/edit

So instead of linking to the form like this http://www.example.com/node/235/edit which will leave you after the validation by default to the http://www.example.com/node/235/view page

You link to this url http://www.example.com/node/235/edit?destination=links%2Flist

Watch the syntax of the view in place edit links functionnality, it works this way. What an awesome and easy way the change the form redirection page, it’s great!

Little Linux tricks

  1. How to quit the sudo su mode
    I don’t know what you think about it, but I’m lazy to type always sudo and my password when I need to have root permission.

    So I type “sudo su” , in order to become root as long as I want. But being root have also some drawbacks, for example all files create by me as a root by default will belong to me and my group as root so user:root group:root, and thus being difficult to change by other user.

    So It’s useful to become root some time, but also to go back to one’s normal user identity. And the point is, I don’t know yet how to make this.

    To become root you need to type sudo su to become your user type su username

  • the date popup picker don’t show the months
  • It occured to me recently, I’ve found a bypass. Go to the site configuration>Date popup configuration
    And change temporaly from Date popup default to jquery default. This date picker is nice but fully transparent, so less visible. And then change back to jquery default. You’ll see your date popup with the month.
    I don’t know how it works, but it works!

  • The CCK fieldgroup tab no more working
  • Indeed i’ve updated my jquery plugin to 1.7 and it’s no more compatible to the cck fieldgroup tab module as described in the following issue http://drupal.org/node/703676

    In this post they suggest to apply the patch in post n° 9
    http://drupal.org/node/577902

    But where is the tab.js file that should be patched? After some search it is part of tabs module which is a general modules used by other that allow to have tabs.

    How to patch a file (I’ve learned). My method using the command line is :

    - Go to the folder where there is the file to be patched.

    - Download the patch in my example it would be this command

    wget http://drupal.org/files/issues/tabs_ui17_js.patch

    - Aply the patch using the patch command with the -b option (to backup the file so as to reverse a patch in case of a problem)

    patch -b < the patch file.

    No need to specify the file to be patched because it’s included in the patch.

    in our case
    patch -b < tabs_ui17_js.patch

    And you can follow your reading on patching in the drupal.org tuto about that http://drupal.org/node/60818

    And for our issue of tab problem, I work fine, i’ve just tested it!

The following is based on what the authors of the books “Using Drupal” in the O Reilly collection say at page 317.

There are three date type provided by the CCK module and date module :

1-Date

2- Datestamp

3- Datetime

From an novice aproach I’ll surely choose the date. I want a date i pick a “date” date type. And when you read the book, you read “this field type should be avoided [...] as it’s extremely expensive to sort and perform conversions on this style of date”

So let’s look the usage for these mysterious types.

1-Date is stored in the database as a varchar(20) in the form ‘2008-08-26T17:02:00′.

Usage : for partial date and ISO8601 formated date

Drawbacks : stored as a varchar data type in the data base, and as mentionned very expensive to retrieve and sort, so don’t use it

2-Datestamp seconds since 1970 sorted in a int(11) format such as ‘121977020′

Not very natural date format I recognize, for example in a linux family the angry woman  speak to her husband like this “What where you doing at 121977021, I know that you lie!”

Advantages: Quick to calculate date and time offset. Legacy format across all databases system

Drawbacks : can code only date from 1901 to 2038, so what we’ll do in 2039? Will my site still exist? And me? What is life for? ohh stop it! let’s continue discussing about date.

3-Datetime is the format for storing date dependent of the database, it is a datetime field and the data looks like thiq 2008-08-23 17:12:00. Pretty similar to the first date type you’ll say.

Yes but it is not stored in a varchar format that mean, whatever for a database, but in a very specific format that the database know and treat as a date.

Advantages : Possible use of specific date function such as extracting a part of a date (only the hour for exemple)

Drawbacks : Inconstancy among databases systems.

Conclusion : So What will I use?

I’ll sugest, first to avoid the first type ‘Date’ .

After ask your self if your data would use date before 1910 and after 2038. Or if you fear to have bad days updating your site in 2038, if so choose definitely datetime.

For very common date, like the updated date of the nodes, I think timestamp is the simplest, and drupal core have choosen this data type.

But I would like to have more arguments to choose between these two date types (datestamp and datetime). If you have ideas, let’s comment this post.

From Dev sever to Prod sever, and along the project life, the path of the files directory where are supposed to be the files of your drupal site, have a lot of good reason to change.

So how the hell do we change the path, when it has changed?

I am using a manual sql query to do so, updating the files table, the only field that I want to update is the ‘filepath’ field, so my query would be womething like this :

UPDATE `files` SET `filepath` = REPLACE (`filepath` , 'Old/Path' , 'New/path')

Where :

‘files’ is the table where Drupal put all files related information

‘filepath’ is the field that we want to update

‘OldPath’ and ‘NewPath’ are the part of the path that we want to change.

Mind the small little symbol ` and ‘ that are different. I am not a specialist in sql query, but I suppose that the first are for tables and fields, and the second for values.

And for those who don’t know at all sql and phpmyadmin, this query should be run, when you are viewing your database in phpmyadmin, and in the sql tab, there is a text area to paste your query.

That’s it, let’s update your paths.

With the node import module, it is possible to import nodes of an existing content type. The principle of this module is to make a mapping between the content type fields and a the column of a tab file in csv format, that have data of new contents. It provides lots of options to accomodate to thepossible cases.

In the begginning I’ve encountered some difficulties to start to upload a cvs file, because my settings of the directory where the files were uploaded was not well set. There is general setting of the file system for all drupal, and specific setting of this module. Be careful to have a writeable directory, that mean a directory in which the user that the web server Apache use, could read and write. (Linux right)

After it’s done, you have to make the mapping between the header of your tab columns and your fields’s content name. Note that for the moment there are type of field that could not be imported this way. I’m not sure of all, but I’ve noticed the content taxonomy fields and mail fields with unlimited value settings where not imported, further details of limitations when I try it more deeply.

A interesting thing is that you can also import information on node properties like “promote to front page” or “sticky on top of the list”… You have then to make a special column for it in your tab, and figure out what format teh node import module expect. For example promoted to front page is a boolean type of data, eg it has only 2 possible value 0 or 1, 1 means yes, 0 no. I suppose that putting 1 or 0 is understood by the module (not tried yet).

Tips to prepare a cvs file for drupal node import module :

- If you name the column of your tab exactly the same “human readable” way that you’ve done for drupal’s field content, it’s auto recognize. Useful to prevents errors, check that you’ve got all your data.

- If you’ve found that you need to change your cvs file, because for example the format of the data is not good and you want to format it in your spread sheet software, you can re-upload the updated files, clicking back till you’re back to the step where it occur (step 2). All your settings you’ve done in the further steps are saved! It’s a great thing because importation is rarely done in only one attempt.

- Use ; seperator in the cvs file, or other separator using non common caracter, and check that the content of the cells doesn’t use this caracter. If not the separation of cells wont be good, and the data will all be messed.

- if the module encounter an error, eg a format that is not valid for exemple, it simply doesn’t import the row, if you want to correct it later, it produce a custom csv file with all the rejected row, and a new column describing the error. You can then work on this new files to correct it and then reimport the rows again.

- To bypass the content taxonomy limitation, you can add a new field, that is similar to the content taconomy, by in text format. You’ll show after both column, the content-taxonomy column which will be void because the node importe module can’t import in content taxonomy and the text column, which will be filled with your data. You will then sort by the text column, and then fill the content taxonomy column with the node field modify option of the bulk operation view type. You will it fill your data manually but in bulk, so it can be somewhat fast.

I will not make a tutorial to how to install drush.
I’ve just fisnished to install it on mac with mamp following an article in french

http://biboo.net/drupal-module-drush-installation-mamp

I’ll found later one in english

I want to have a broad view of what to do with drush, which are the useful command
…………………………………………………………………
drush status

give me the information about the site in which I am (depending of the place in the files structure from which you are launching the drush command)
For me it give me the following info

drush status
Drupal version : 6.19
Site URI : http://default
Database driver : mysqli
Database hostname : localhost
Database username : root
Database name : acquiadrupal_emilie
Database : Connected
Drupal bootstrap : Successful
Drupal user : Anonymous
Default theme : agencerew
Administration theme : garland
PHP configuration : /Applications/MAMP/conf/php5/php.ini
Drush version : 3.3
Drush configuration :
Drupal root : /SEB/4-www/www_new/acquia_drupal
Site path : sites/default
File directory path : sites/default/files

I was in the main drupal directory, and I have a multi site instalation, so it give me info about my default site.

…………………………………………………………………
drush sm

give the list of the module and information about their installation
For every module in the site it give the following info

drush sm
Package Access
Name Content Access
Type Module
Status installed
Version 6.x-1.2

…………………………………………………………………
drush pm-update
list the modules that need to be updated, and do the update if you accept
To update a module only write pm-update nameOfTheModule

…………………………………………………………………
drush updatedb
make all needed database update after the module update
it’s the equivalent to runninh update.php script

Back to drupal after a time doing differents things and holydays.
For those who have commented my posts, sorry I needed to delete all comment,s because i’ve been spammed.
I don’t know yet very well how to fight this in Wordpress and seperate the huge list of spammed comments with the real ones.
If anyone have ideas, i’ll be pleased.

First off I’ll publish some photos of the Drupal Con Copenhagen 2010.
It was as usual dense and interesting. There was nearly 2000 people attending to the conferences and lots of subject to learn about.

I notice drupal 7 is more and more a reality, and conferences where dedicated to describe the changes from Drupal 6 in a more precise way than I’ve listen to one year ago in Paris.
I think Drupal 7 release is to be expected for the end of the year.

I’ve listen especially to a conference on Display suite and another one on Feature, both modules that I need to learn. Display Suite to simplify theming and prevent the overwhelming number of tpl.php files, and features to split all functionnalities of a Drupal site into micro functionnalities which could be then reused, backuped, and toogled on or off. Furthermore the use of feature force us to have a good view on a drupal site architecture and create a comprehensive architecture.


Google doc query function

In google doc there is a magic function that serve as a sql query langage. Its serve to retrieve a subset of the datas of a spreadsheet, based on specific criteria.
First, there is different way to use this function in a url and in a new page of a document. I’ve tried only the second way.
The syntax of the function is

range syntax in when using data from the same page
=QUERY (range ; query ; header)
range define the cells to whom it’ll be applied
query is a sort of sql query to filter the data
header define which lines are header and should no be interpreted by the query

when importing from the page
A6:AS1000

when importing from other spreadsheet
'nameOfThePage'!A6:AS1000

The select clause

Select all columns where the content of the V column equal to ‘France’
Watch the seperator ” for the full select ‘ for string
"select * where V='France' "

Select column A B and C where Column V=’France’
"select A,B,C where V='France' "

The full query to be written in a cell of the spreadsheet will be the following and mean
It want cells from a spreadsheet that is called ‘2-Site’ from the A1 to AS1000, I execute the sql query ’select D,E,U,V,W where T=’Paris+Banlieue’ and specify that the first 3 lines are header (they will be concatenated in one line only.

=QUERY ('2-Site'!A1:AS1000; "select D,E,U,V,W where T='Paris+Banlieue' ";3)

To be careful with the syntax
use semicolon ; between each of the argument of the query function
use colon , between column for exemple
wrap with a ” the select statement (2nd argument)
wrap with ” the string inside of the sql statement

Google doc query function official help
- query function
http://docs.google.com/support/bin/answer.py?hl=en&answer=159999
- query language reference
http://code.google.com/intl/fr/apis/visualization/documentation/querylanguage.html

I’m trying to define a strategy for the naming and setup of my servers, so as to streamline the process of putting and updating a drupal site online.

- The naming of site’s folder

The site’s “site” folder should have a precise name so as drupal multi-site mechanism relying on Apache Virtual Host could recognize the site. But when you ar working in a local environnement, you need to define some local virtual host that have a “local name resolution”, it means that you can define a local virtual host at home that override www.google.com, and leave you to a place on your hard drive.

But of course it is not very useful, as you should stop MAMP for example at each time you want to connect to the true www.google.com. For my sites so, I’ve tried to define a naming strategy that allow access on the site in the production server and in the local server, at the same time without stopping MAMP and without renaming sites/site Folder because this renaming cause problems of updating path and so on.

So I’ve define if my domain is www.mydomain.com to name the sites folder of Drupal multi-site installation “www.mydomain” and to setup MAMP with a virtual host of local resolution of www.mydomain and to setup in my DNS server (actually my registrar) “www.mydomain.com”. Thus I can access my production server by typing www.mydomain.com and my  local server by typing wwww.mydomain.

It’s just a trick, I am going to test it more, and I would like to know about other people strategies. But the big point is no renaming the sites folder and accessing at both sites easily.

When changing the name of the site’s site folder in Drupal, the image files path are not automatically updated. So to specify the new path, you’ll have to go in site configuration/ file system to change the location of the new files and then update manually the database where are recorded the files. In my cas I had to change only the files table with the following SQL query :
UPDATE `files` SET `filepath` = REPLACE(`filepath`, 'oldPath', 'NewPath')
Mind the distinction of ` and ‘ in this query, so as it work fine.

White Screen of Death is a screen fully blank, desperately white, and with no clue to slove the problem. Thanksfully there are clues, but they are not immediatly visible, because of the settings of the server. The most important setting is to activate the error logging in the php.ini files. You can also set that the browser show the errors directly on screen.

So once you can see the error, i’ll try to list some of the cause of the error i’ve encountered :

- Problem or memory_limit

In this case the error is described in the php_error file. It’s due to the memory_limit settings in the php.ini files that define the memory that should be used by the processing of php, and thus when it’s too low, It prevent the page from being rendered, so the screen is blank.

- Empty the cache

In this case there is no error at all neither in the apache log file nor in the php error file. Due to changes in configuration between local server and production server, it’s necessary to empy cache tables, so as to force Drupal to take account of this new situation. As it is not possible to access to the admin menu empty cache utility, you should use phpmyadmin and select all the tables that start with the name ‘cache_….’ and empty them.

A big list of causes is available at this adress on drupal.org : http://drupal.org/node/158043

Make a div clickable

I wanted to do a div that was containing some little images, text, title…. This div with a background has also a a:hover beahavior, its color was changing when the mouse was hovering on it.

But I had a problem, because I didn’t manage to make it entirely clicable. The image and the text was clickable, but not the whole DIV. The fact that is has a a:hover aspect was indicating to the visitor I should be clickable, but it wasn’t.

After some search, and headaches, i’ve found my solution thanks to a small test files that has only the markup needed to test my situation (it’s a good method bythepoint to isolate a problem.

The things is that when you put <a> before a div even if it doesn’t contain any text, i become clicable, except when it contain <a> markup whithin it. In other words <a> isn’t embeddable.

Here is a example of when the div is clicable

<a href="http://www.google.com">
<div>
This a clickable div
</div>
</a>

And this desactivate the div clickability because of the a inside it


<a href="http://www.google.com">
<div>
<div>
<a href="http://www.yahoo.com">
This text is clickable but not the div outside it !
</a>
</div>
</div>
</a>

So when you want to have erveryting clickable to the same page, remove all <a> inside the one that surround the DIV.

When you want to have several destination, I don’t know yet the solution.

Debug Drupal

How to debug Drupal?

Debugging is very important when doing programmation. Indeed you need to know where do the problem come from when the things don’t show as you’d like.
Some times, I’ve met my Drupal site in the form of a white screen, “white screen of death” say some people.
How to solve the problem with no clue at all, when i discovered that Mamp integrated a link to Mac Console that show php error, I was so happy! I had been used to use easy php which settings was to show the message directly on screen, so I didn’t figure out where was my errors messages.
And this lead us to an important distinction between two ways of  debugging :

- on screen debugging (fast but not clean)

- external window or in console debugging  (a bit more difficult to set up but much more cleaner)
When you debug on screen, it’s fine, because it’s easy to set up, but at the end of several weeks and month of working on the site, you forget where you’ve put you echo of print_r and cleaning all that stuff is a big work.
On the contrary, when you manage to set up teh debigging in a console, all the messages get hidden from people, and you can at every moment show the clean result of your work.
Now here is a list of debugging tools that I use for Drupal
- firebug -> function firep()

. Advantages : clean presentation in a firebug separate windows

.drawbacks : don’t work for tpl.php files, it works every where else include in a template.php and module file…

- firephp -> function fb()

. Advantages : Work in every php files whatever

.drawbacks : don’t know yet, haven’t use it so far

- devel -> function dsm()

. Advantages : Clean, drupal specific presentation of arrays in a collapsible maner

.drawbacks : show in the status-message area, and thus have the drawbacks that I’ve described up in this post about debugging in screen

- php_error.log

to see this important log go to the MAMP PRO window, click on view log, and this will open the MAC console, which will show you the last log entries. This is useful, for big errors, that prevent page rendering from showing up. It is essential to know where  do the error come from.

Reference  :

How to install firephp :

http://www.developertutorials.com/blog/php/debugging-php-with-firebug-and-firephp-365/

http://drupal.org/node/352836

Let’s try to analysis galleria module in order to be able to customize it.

First galleria module have a tpl.php file names galleria.tpl.php. So the first thing we gonna do is to copy it in our theme folder, clear the cache, and try to tweak the things a bit.

galleria.tpl.php

First we notice that the thumbnails are not outputed in a div, but only throught a variable $tumbnails that should contain all the html stuff.

Other thing is that the main image is not outputed via a php variable but rather by javascript <div id=”main-image”></div>

The sub-domain is the first part of an url www is the commonest sub-domain, but it is not the only one. In fact every subdomain  is possible, it is entirely up to the domain admi.

This part of the url is freely customizable by contrast with the domain (google) and the extension(.com), which need to be paid to a registrar, and cannot be modified.

It is then a cheap and easy way to create multi independant site from one domain. It is in fact the solution that choose most of web services that give to their customer a free of paid web space of the form FreeName.NameOfTheSite.com like sebastienlucas.free.fr.

The other advantage of a sub-domain by comparison with a simple folder,  is a SEO argument. It is that it is considered by google as a independant site.That way there is no problem for google to analyse each content of the sub-site independantly without mixing everythings. For google blog.mydomain.com and news.mydomain.com if something entirely different, rated each one separetely.

So after this introduction, on the advantages and principles of a sub-domain, how it is configurable?

No too complicated : There is at least too step

1- Configure the DNS server

The DNS server is generally based on bind, which is turning either on the same server as the site, either in another server, like the one of teh registrar of the site. It is my case, and my registrar is gandi http://www.gandi.net and i recommand it to you.

On the interface of the registrar, you can set some custom zone files. This is normally done for your domain to work on your dedicated server.

The configuration of the sub-domain imply the addition of one line that is a CNAME recording which is an alias

For me the zone file line I should add looks like that

blog 10800 IN CNAME archizone.fr.

Don’t forget the dot at the end of the domain name.

2- Configure vhost

After you need to configure a virtual host on your apache server, so as you point which directory to use for this subdomain.

You can also add some special settings in this file that apply only for this sub-domain.

My vhost looks like this.

That is the minimum that should be configured

<VirtualHost *:80>
ServerName blog.archizone.fr
DocumentRoot "/var/www/archizone/seb/drupal"
</VirtualHost>

Galleria module is great http://drupal.org/project/galleria

It allow to create a javascript gallery of images with thumbnail that allows you to navigate from one image to another. This module is working great for nodes.

The problems seems how to customize it, and to place for example the thumbnails, where we want in the node.

Another wish could be to output it as a block, so  it can be placed in every part of the screen with the block system.

In drupal I am always a bit frustated of this artificial separation of the main content which in the content area, and the side content which in the sidebar.

Indeed block have there limitation, nodes too, view pages too, and it’s only intertweening all the possibilities that it is possible to by pass theses limitations.

So I want to put my galleria thumbnails in other place that the default bottom of the big image position.  Here are some hypotesis :

1- Figure out how to output the galleria thumbnails as a block

2- Desactivate the sidebar, and say in my .info file that every thing is content, thus i can output whatever I like, when I like throught my template (in this case it is necessary to declare “content” area a an aerea so as to output block too in it.

3- Try to fin the pre process function that output galleria, and try to output it in the sidbar region.

Here are some things that i’ve learned how to do on a ubuntu dedicated server :

Using mysqldump function

The manual of this command is described fully here

http://dev.mysql.com/doc/refman/5.0/fr/mysqldump.html

How to backup a database in command line (using dump)

Backup a database in command line wheter with phpmyadmin or dupal backup database function is useful :

  • It is quicker that with http tools like php my admin
  • It could be automizated in a bash script

the syntax is
mysqldump -pPASSWORD --opt DataBAseName > Path/To/Files.sql

-p is a short version option and PASSWORD should follow it without space in between

if you don’t specify a user, the command will use your current connected user, for example if it is root, i will use root

How to backup all databases in command line (using dump)

mysqldump -pPASSWORD --A > Path/To/Files.sql

I will add all sql statement in one file, that could be huge.

How to backup some files (using tar and gzip command)

I am using for the first time the tar command. I is useful to package some files into one unique files with generally a .tar extension.

After it is better to save some disk space to gzip this .tar file which make a .tar.gz file

To tar a directory it’s simple the syntax is

tar -cf     path/to/tar/file.tar    path/to/the/DirectoryToTransformInTarFile

There lots of options but the basic ones -cf indicate

-c create a tar file (x would be the contrary extract)

-f that the following path is the one of the tar file to create

Other options could be

-v verbose to have some detail of the operations done

-z to make a tar and gzip it in one operation

How to automatize backup operation with tar, gzip cron and a bash file

to follow

Mean while check this page http://www.howtogeek.com/wiki/Tweaking_a_Dedicated_Virtual_Web_Server#Disable_Root_Login_Over_SSH

I am trying to export some elements from one site i’ve nearly finished to another I am just beginning. In order not to loose time starting ever from scratch, I was trying to figure out which possibilities do we have through drupal, php my admin and contributed modules to do so.

First I think there is not yet a magic mean to import /export everything, so it is necessary to split difficulty and identify all individual pieces that deserve import / export.

Reference Web Pages on Import/Export

Comparison of Content and User Import and Export Modules

http://groups.drupal.org/node/21338

Importable / Exportable Drupal Elements

- export drupal views

Views has a import export feature which is part of a optional module I think. I allows to export a view in an array which is pastable in the other site via the import window.
The problem which i found when trying to import was that a field (called handler in views terminology) wasn’t existing in my destination site. It mean a content type cck field was no existing yet or has other machine readable name. And this prevent to import the view at all. It’s a bit a bad point for this method as it can occure quite oftenly.

- export drupal taxonomy

Taxonomy has two means to import / export things that i’ve identified.
First with the module cvs import. This module is quite good to import terms to a vocabulary. It can import terms produced by taxonomy manager (which is other useful module) and form cvs files of course….
Very useful, but what if you want to import all the vocabularies and the terms it contain in one step?
I’ve not found something satisfactory and decided to try whith the database (phpmyadmin).
I’ve been identifying in which table there was the information. Caution you may have more information in other tables, but me I don’t use relation ans synonyms yet for example.
So there is a minimum of three tables that is important to copy.
term_data define the terms
vocabulary define the vocabularies

and term_hierarchy define the hierarchy of the terms (even if you don’t have hierarchy, in fact the parent_id is set to 0 in that case)

- export drupal content-type

Content-types ar fairly re-usable from site to site.

Their fields contain a lot of small configurations, that would be great to reuse if the need is the same, or least use as a basis that could be slightly modified in further sites.

So how to import/export content-type in drupal?

Very simple, you need just to enable the “content copy” module, that create an import and export entry in the content type menu.

Click on export in the site from which you want to import the content type from. Choose which content type, this create a big array that you can copy.

Go on the site you want to copy the content type in and go to content type>import and paste the big array. You have the option to create a new content, or to import the fields definition in existing content type.

- export or import drupal node

I’ve written a dedicated post on this about the great node import module

And that’s it for now

to follow….
- module activation state
-feature

Drupal is not such as a robust software, that you can’t nowadays say that never you can see odd things that put you in despair, because you don’ know how even you’re going to do to solve them.

Today I’ve made a debug session! What’s a fun. I needed to change from on MAMP local server to another in another computer.

So I’ve been doing, and I met some bugs around, I list them with the solution i’ve found :

Blank screen

, nothing in source code, no error in php error log -> I needed to ser memory_limit php.ini directive to someting higher, drupal need lot’s of memory!

Multisite wrong database importation

: In a multisite installation, when I type one site in the adress bar of my browser, I see another site of the multisite installation -> simple but you need to think about it. It’s an human error. I had mistaken when I exported and imported my database, and import on a wrong name another site database, to check it see the number of table it contain, for me rarely all the sites uses the same number of modules, and the don’t have the same number of table.

Unfinished Custom Theme that don’t have a connexion block,

to connect to our administrative account. How the hell, I could modify the theme and take possession back of my site?

1st solution : move the custom theme to another location, so as drupal choose the default theme in place

2s solution : go the this page, which is a login page, I didn’t even know that http://www.mysite.com/?q=user

More info on this page http://drupal.org/node/200774

the first argument should be an array warning

-> Due to export from another server see link below

http://www.freshblurbs.com/drupal-first-argument-should-be-array-warning

blank screen due to modules files

that have been moved (function that drupal don’t find any more)

I’ve been moving the modules from one subsite modules folder to one other subsite module folder, or in a sub-folder of one site or all sites folder.

I know it’s possible, but sometimes it cause problem with the cache that leave in memory the former place of the module’s file. I could lead to a dammed white screen!

How to solve the problem now > My solution : Open phpMyadmin, go to the cache table of the drupal site you are working on, and empty this table.

For me it Worked

Url problem after a drupal security release version change

After a change of version that i have posponed a long time for fear to meet annoying problem and beacuse my version was acquia drupal and not drupal it self.

At the end it’s not so difficult, just backup everyting, do the things quietly, run the update.php script on every site of the multi site structure.

But once done, when i go to whatever page, i’ve got a page not found error, after some time i thnik about the clean url feature, has is be reinitialized during the database update?

And that’s it putting mysite?q=admin/ works well

In fact i figure out that it was due to the fact that acquia drupal doesn’t contain any .htaccess file at its roots, and thus I’ve copied the .htaccess that was working in the precedent version in the new version, and it worked!

This node explain well the clean url, and how to confugure it on a dedicated server

http://drupal.org/node/15365

Powered by WordPress | Theme: Motion by 85ideas.