ryanprice's blog

Import Hundreds of Taxonomy Terms using AWK

5
Average: 5 (1 vote)

Today's challenge: your editors just handed you almost 200 taxonomy terms to add to the site, and you don't have the time or inclination to hit the taxonomy/n/add/term page for the next 2 hours or so... AWK to the rescue!

Doing a simple CSV export of the term_data and term_hierarchy tables, you've got a pretty simple structure:

term_data
tid,vid,name,description,weight

term_hierarchy
tid,parent

What you'll ultimately generate here is a file that stores everything you need to know about importing these terms via a CSV - the term names, the weights, good IDs, and the TID of the parents.

2048,#the current value of the sequences for term_data
term,34,Blogs,#a helper line
x,1,Drupal,All about Drupal,-5
x,1,Modules,Ways to extend Drupal,-4
x,1,Themes,Making your install pretty,-3
term,35,News,#a second helper line
x,1,International,,0
x,1,Local,,0
x,1,Hyperlocal,,0

In this file, we've got 3 types of data:

  1. The starting value for sequences
  2. The id of the parent term for the next several rows, starting with the word "term" followed by the TID and the plain English name just to help us get organized
  3. The new terms, with an "x" where the new TIDs will be placed, and the VID, Description and Weight all filled out.

Drupal Theming: $path vs. base_path and path_to_theme

0

When developing Drupal themes, there is one bit of code you type over and over again:

sites/all/themes/blueprint/images/whatever.jpg

Where images/whatever.jpg could be a css file, or other file, but is normally an image.

However, since clean URLs in Drupal appear to make fake directories, the web browser thinks your image is located in:

node/345/sites/all/themes/blueprint/images/whatever.jpg

When it’s not. Luckily Drupal has tools to help you in this case.

Blogs About Drupal

3
Average: 3 (2 votes)

This is rather self-serving, but I actually got quite a bit of traffic on this site in the last few days, and that made me wonder if some older posts I've written on my personal blog were worth anything. There was really just one useful one:

Using Views 2 and Drupal 6 to Create a Related Pages Block

4.5
Average: 4.5 (10 votes)

Today's question comes from Dale at NFi Studios in Orlando, FL - my home town:

Essentially:, what i'm trying to do is
1. Determine the current nodes taxonomy terms
2. Determine all other pages that share taxonomy terms
3. Display the title (and link) to those pages in a block

Using Drupal 6.2 and Views - Looked at a few modules, but nothing quite
exact - Reviewing some module snippets right now to see if I can
potentially use an argument to do it.

Using AWK to Download and Unpack Drupal Modules

3.5
Average: 3.5 (2 votes)

Security Update RequiredWhen installing a new Drupal site (or when your list of available updates gets nice and long), you'll often have to download tons of modules, unpack them, and copy all of the resulting directories to your sites/all/modules directory. Personally, I'm not a fan of all the clicking, downloading, unzipping and most of all waiting!

Today I finally settled on a workflow that gets the job done, and it's called the UNIX command line. If your server doesn't use some flavor of UNIX or Linux, or if your web host doesn't allow you shell access, you may want to stop reading after the next paragraph.

Editing HTML around Displayed View Fields: Views Theme Wizard

0

Question #2 also comes to us via our Facebook forum

Modifying existing views.

Michael Blake (Orlando, FL) wrote on Jan 24, 2008 at 12:08 PM.

I'm working on an existing Drupal application that has a custom Content Type. This includes some custom fields. When I change a custom field, such as add markup before and after it, This does not appear in my views. I think it's because my Views have been exported.

However if I change the .php files in the themes directory directly on the server, I get what I want. My question is , if I go about it this way, can someone else come along export a view and erase my changes? Or do I need to re-export every time I make a change?

Thanks.

XML Sitemap not associated with pathauto url aliases

3.333335
Average: 3.3 (6 votes)

This question comes to us from our Facebook forum. It feels good to answer, because this is the first of many questions we'll be answering here on the site.

Some Help I need (XML Sitemap)

wrote on Jan 8, 2008 at 5:52 PM.

So right now, I've been trying to fix an issue I have on my website. I imported everything I had from WordPress (posts, comments, categories/tags, etc), and then I installed the pathauto and the XML Sitemap modules. The problem I'm having is that XML Sitemap is producing a sitemap with every link in terms of nodes rather than the aliases my pages now have, and I would strongly prefer it to use the aliases. My NEW content is being included in the sitemap using aliases, but all the previously imported content is in the node format.

You can look at my sitemap if you're not sure what I mean, is http://omareduardo.com/sitemap.xml

Thanks for any help!
-Omar

Syndicate content