User login

How to

Information on how to do something... anything.

Saving a read-only file after making a lot of changes before finding out

If you accidentally do a lot of edits in vi to a read-only file, or rather a file to which you do not have write permission and forgot to sudo in, you can do the following to save it elsewhere temporarily and then overwrite the original.

Let's say its name is recalcitrant file:

From inside vi:

:sav ~/temporary.file
:q
<code>
Then:
<code>
sudo mv ~/temporary.file recalcitrant.file

Pitfalls: you should check the owner of the file you were trying to edit and set your temporary file back to that

How to copy files using the command line

Copying files or directories with the GNU-Linux command line.

Resolution

When you're copying something with cp you list the file (or directory) you are copying first and the file (or directory) you are creating second.

cp -r existing_directory new_copy_of_existing_directory

Rebuild menu cache to force recognition of menus added while developing a module

Rebuild menus so that menu items and callbacks defined through the menu system take effect while you are developing a module.

Resolution

The quick fix:
menu_rebuild

I know I posted about this before, and it took me five minutes to find.

Anyhow, this is useful during development to clear and rebuild the menu cache, so that your menus added to a module (hook_menu) actually will show up for you, without reinstalling the module or something stupid.

Then immediately remove your call to menu_rebuild!

Setting number of nodes to display in a category view

Warning: How not to write documentation

The below - which has been accurately documented elsewhere I think - demonstrates the danger of documenting as one goes, instead of figuring something out and then documenting.

More category-specific information: To change the number of items (nodes) shown on a category page, go to Administer » Settings » Posts ( admin/settings/node ) and change the number of posts on main page.

Nope, apparently I'm wrong.

Ah yes, naturally:

Administer » Settings » Category
admin/settings/category

The easiest way to do CCK teasers!

So, if you're reading this then you've most likely followed this (http://agaricdesign.com/theming-cck-the-agaric-way) excellent guide written by my esteemed colleague Ben, and now you've got yourself some kick ass custom themed cck nodes.

Find a term ID (working around the category module) to have a node behave differently

find out what category vocabulary id drupal

probably easiest just to look in the database-- the vocabulary table lists names with vids, you can then go to the term_data table and sort by vocabulary if necessary, and look up your category by name.

Other option is to print_r everything about the category node.

For more, see:
http://drupal.org/node/113651

Resolution

We did it our way. Here's the messy, just-got-it-working

Stopping pathauto from attempting to use special characters that end up encoding uglily

When a pattern includes certain characters (such as those with accents) should Pathauto attempt to transliterate them into the ASCII-96 alphabet? Transliteration is determined by the i18n-ascii.txt file in the Pathauto directory. This option is disabled on your site because you do not have an i18n-ascii.txt file in the Pathauto directory.

Resolution

cp i18n-ascii.example.txt i18n-ascii.txt

Just to give the option. we don't have to use it.

This has to be repeated every time we update the pathauto module.

Change the order of the node/add menu links under create content

How do I change the order of the create content links?

Resolution

Agaric thought of creating a module for this. And then we remembered that we just have to reorder their menu items. Administer » Build » Menu (admin/build/menu)

This won't help on the create content page itself, but we never visit this page. Do you? It can also be replaced with a physical page of links if you absolutely must theme this, or a module to replace the default page, but you know you don't need it.

Clean up an XHTML OpenOffice document for web publishing using RegEx

Preparing a document saved as XHTML from Open Office (StarOffice/OpenOffice format) for Drupal or other web site or wiki content management system.

Resolution

Using SubEthaEdit in this case, but TextWrangler and any regular expression text editor aught to work (open source free software text editors recommended for Mac would be great to know, if you care to tell us).

Removing all the junk with extremely rudimentary regex skills:

Replacing Blog pages with a View

weird issue: our blog view after upgrading the site from Drupal 4.7 to Drupal 5 is not in chronological order of posting.

Resolution

Replacing blog.module with views
http://drupal.org/node/47419

Wow, that worked really, really well. We just created the view through the views user interface (modifying tracker, which already had user arguments built in) but the Agaric blog looks great, for me too.

Syndicate content