snippet

13 Jul

When you need to get a 404... but instead you get a View.. what do you do?

in drupal, snippet, views

The site shows a View profile of bloggers and lives at the url "/blogs". Unfortunately, this save View became visible at "/blogs/{anyrandomword}". This was not the desired result. To further this specific instance, I realized that my path for the teaser view of each bloggers' post's was at the dynamic url of "/blogs/{username}".

My goal was to preserve my View of each bloggers' profile at "/blogs", allow the user teasers at "/blogs/{username}, and ensure that any random text or characters after "/blogs" would go to a 404 page.

21 Oct

Maybe I Don't Want that in my Form

in drupal, module, snippet, theme
Sometimes... most of the times... I don't want the "split summary at cursor" option on the sites I develop. There are any number of reasons I don't want it. Most of the times, it just isn't relevant and others... I just don't want the users asking a milion quesitons.


And inevetibally, there is more stuff I don't want in my forms, want differently, or want moved.


My solution has been that on all the sites I develop I have a custom module. In this modules is one of my most used hooks... form alter. I have it all set up and commended out some of the lines but leave them in for quick reference...


I'll show it to you, then explain a little more....My module name is theme_thingee, and here's how I have it set up.

Get Rid of Split at Cursor

in code, drupal, snippet

unset($form['body_field']['teaser_include']);

I place this in a module.
use hook_form_alter to apply.

Cron in cPanel

in code, drupal, snippet

php /home/INSERT+DIR+NAME+HERE/public_html/cron.php

09 Sep

Preprocess for some Shortcuts

in development, drupal, php, snippet, theme
I came across this little extra nugget while looking for some stuff for preprocessing. How many times have I typed out base_path and path_to_theme... With this little gem I am just a few keys faster, and lovin it.



function themename_preprocess(&$vars, $hook) {
$vars['theme_path'] = base_path() . path_to_theme() .'/';
}


21 Jul

Page + Path * Template = Pleasure

in drupal, node, page, snippet
This little snippet saved my bacon today. I decided it was worth a blog post. Sometimes finding the right code is a matter of googling the right words. So I will describe this is making a page template based on the node type you want to present, but you don't you know how to do it on a node, and now you want it on a page. :) Hopefully that will help some SEO.
17 Feb

Did you forget your Drupal User 1 password?

in drupal, mysql, snippet
article image

After a long day of work and more work I decided to do a little more work... I was just getting started in a project for a new client with a Drupal site that was in development (almost done). I was given all of the access information, however; I was not able to access the site as user1.

Well, if I can't access the site as user1, then I'm pretty stuck.

The problem was not the username that I was provided, I know this because I could see the name in the database table. It was the password, it wasn't the right one.

11 Dec

Unique Class for Cool Drupal Menu Items

in drupal, php, snippet, theme

I spend the majority of my time around Drupal in the areas of website building and in the theme layer. Anytime I can find things to make my theming life easier in either... I take it.

One of the 'limitations' (using that friendly) is the options for theming. IMPORTANT to note... Drupal 6 ROCKS!! THEMING!!. One of the important 'additions' I try to create when working in the theme layer is to improve my ability to use CSS. Some sites require fancy, creative, and/or custom stuff revolving around menus.
newlinks.png