Drupal 7 Talk

Drupal Views taxonomy term sorting criteria

Drupal Views term sorting criteria

Views is great. Views is also confusing.
When sorting by Taxonomy Terms, programming can be challenging but it is not that difficult once we understand the concept.
Taxonomy Terms are sorted by term ID. This means that if you add a new term at a later date it will be displayed at the bottom of the column list instead of being alphabetically displayed. this can give you a huge headache until you figure out what is going on (it is being sorted by term_id).

To sort alphabetically by Term Name, we need to create a Relationship that links the Term_id to the Term_name itself.

  1. Add a relationship selecting "Taxonomy: Terms on node". After you click add, it will show you all the taxonomy classes available. Select the one that applies (the Term Name you want to use). This will link the term_id to the Name Assigned To The Term ( linking two different content types)
  2. In the sort criteria, select "Taxonomy term: Name" . Do not duplicate: if you had previously sorted by Taxonomy Term and it wasn't working make sure you delete the old criteria.

There are more issues to consider. For example, if you sort by Taxonomy Term and also by the Content Title as a second sorting value, you may (also) need to do the following:

  1. On the FORMAT Settings choose to sort by Taxonomy Term but select the Content Title as your default sorting. Save.
  2. Go back to the sorting "Taxonomy term: Name" and make it EXPOSED to user otherwise Views will get confused and it will by title only (the one set as default sort).

Click on "read more" for a pictorial diagram...

Testing Map Hilighting

This is a sample image map with jquery based javascript hilighting:

 










Installation report:

  1. Install Libraries API Module (if not yet installed) http://drupal.org/project/libraries
  2. Install jQuery Map Hilight Module http://drupal.org/project/jq_maphilight
  3. Create (if not yet created) a "library" folder on site/all/ (not related to the Library API Module installed on step 1)
  4. Create a new folder named "jquery.maphilight" inside of the sites/all/library/
  5. Download* the jquery.maphilight.min.js plugin file from https://github.com/kemayo/maphilight/tree
  6. Unzip file (if needed) and upload it to the newly created directory "jquery.maphilight"
  7. Enable both the Libraries API and the jQuery Map Hilight Modules on your site.
  8. You are done. Mow read the Help file on the jQuery Map Hilight Module for usage and further information

* You can create your own jquery.maphilight.min.js file name and just copy/paste the code into it or (like I did for this sample) download the full zipped plugin, unzip it and just upload to your site the file needed: jquery.maphilight.min.js.

I hope this comes handy and saves you hours of research.

Image paths in Drupal 7

How to code a path to an image from a Drupal block or node?

To soft wire a path from a block or node to an image where the image is on the Sites folder inside the Files folder, inside an Image folder, use the following path:

sites/default/files/images/name_of_picture.jpg

Why use the Sites folder? for upgradeability purposes.

Anything outside the Sites folder may be deleted automatically during a core upgrade.

Your domain name is the root directory. Sites is one level bellow. Inside Sites there are two other folders, All and Default. Your modules and themes should go inside the All folder and your images generally go on the Default folder. Either way, your path starts from Sites ( no trailing slash).

This information is for those modifying the platform by themselves or for other web coders looking for quick answers. If I built the framework of your site you don't have to worry about this because I already did.

Stuck in Maintenance Mode ?

Have you ever been stuck outside Drupal when in maintenance mode because there is no login button anywhere to be found?
That could happen if you move your login link from the front page or if your theme doesn't include a logging option on the maintenance message.

Here a link that will take you to your login form in no time:

http:// example.com/?q=user

Substitute example by your real site's name.

tony araujo


Versão em português? Sim

TinyMCE Wysiwyg Module Background Problems

When giving permission for users to write in Full HTML the background on the input box changes color to other than white.
The problem happens because TinyMCE inserts a protective layer if anyone other than the administrator is using Full HTML.
The color is inherited from the Theme currently being used.

The best solution is to change the configuration of TinyMCE in the admin config panel to use TinyMCE's css rather than the theme's css.

Problem solved.

Cheers
Tony Araujo


Versão em português? Sim

How to remove author from search results in d7

Sometimes we do-not want the "author" of an article or page to be shown on search results.
Such is the case in most projects I build since they are about products and not about articles.

There are many ways to remove the author and the published date from search results. One would be to go on core folder "Modules", and hack the "search-result.php" file by hiding the paragraph included on the php if ($info) bit.

The above practice is generally not recommended for several reasons.
One reason is the fact that it will be overwritten every time we upgrade core Drupal.

The best option I know of, is to add the following to our customized css theme file:

.search-info {
display: none;
}

If you don't have a customized css theme file yet, add it to your regular theme css file but remember: if you upgrade your theme to a newer version, you will lose your changes. Make sure you have a backup to implement again later.

Hope this helps!
tony araujo


Versão em português? Sim