Archive for the 'php' Category

Kicking Drupal ass today

Saturday, March 20th, 2010

It’s Drupal day again, and import data problem continues to piss me off (migrate refuses to pass properly export my tables to View, and eventually just stopped importing my table rows at all; and node-import keeps failing at step 7, line 668). So instead of beating that dead horse some more, I moved on to problems I could actually solve, and solve them I did!

First, the breadcrumbs. I needed to a) include breadcrumbs, and b) style them to match the design. I used the Menu Breadcrumb module to solve the first problem, so that the breadcrumb would draw from Primary Links instead of Navigation. For the second, I first turned to Pro Drupal Development by John K. VanDyk–page 181 had the advice I needed, i.e. to add the following function to my theme’s template.php to change the breadcrumb separator from ‘>’ to ‘: :’ :

function phptemplate_breadcrumb($breadcrumb) {
if (!empty($breadcrumb)) {
return ''. implode(' : : ', $breadcrumb) .'';
}
}

But that wasn’t enough. I needed to remove “Home” as the first item of the breadcrumb, so I changed the above code to this:

function phptemplate_breadcrumb($breadcrumb) {
if (!empty($breadcrumb)) {
unset($breadcrumb[0]);
return ''. implode(' : : ', $breadcrumb) .'';
}
}

And that fixed that problem! The rest was just updating the css in the breadcrumb call in my page.tpl.php file:
 

 

For some reason, my css wasn’t working on the “: :”, so I fonted them, but otherwise this worked perfectly! Breadcrumb success!

Except, then the client wanted the breadcrumb changed for one content type. No problem!

(shoot, can’t put the code here without serious edits, due to its extreme php-ness. Damn! But there’s good info on hiding blocks for specific node types here.)

Seriously, I was on fire today!

Next problem, the drop down menus were appearing under the flash slideshows on six pages. I thought it had something to do with Nice Menus, but after much googling, I found the fix to this was actually in the Flash embed code, so I added this code to the swfobject code for each:

so.addParam("wmode", "transparent");

And those are the things I fixed today. Woot!

For better? Or for worse?

Wednesday, September 23rd, 2009

In helping my sister set up her new website/blog, I’m learning some new stuff to help my own site. Or is it hindering? As you can see, my latest “improvement” is changing the homepage so it shows excerpts of new posts instead of the full content of each. I thought it would make the page more manageable and less like a 12 story building, but I’m not sure the execution works like I pictured it. I don’t know if the images are to small, or the excerpts are too short, but there seems to be too much space everywhere. Unfortunately my PHP skills are still in the baby-steps stage, so I’m not sure I can change it to the way I want. Phoo.

This place definitely needs an overhaul, regardless. The design, the content, the architectural structure (or lack thereof)…. Sadly there are at least three other websites in line for my spare time before this one, and two of them are paying gigs.

Less knitting, more variety

Friday, May 29th, 2009

I’m thinking of changing the name/focus of this blog. Sadly I’m not longer as obsessed with needlework as I was when I first started Polgara Knits. I still knit and crochet, but not nearly as often, and yarn purchasing is no longer an irresistable force for me.

Right now my focus is more on two other things–JuNoWriMo and learning PHP/MySQL.

The JuNoWriMo is my mid-life crisis, I think. I’m turning 40 in three months, and want to have something tangible to show that I’ve accomplished something. I don’t have a family (and have never really wanted one), I don’t own anything (except debt) and while I have wonderful friends and a wonderful job and two wonderful cats, I feel I’ve lived a life of stasis. A 50,000 word novel, crappy though I promise it’ll be, is at least something I can hold forth and say, I made this. It’ll probably take me longer than the month of June, unfortunately (see next paragraph), but I should be able to do it in three months.

The PHP (and the sudden division of my focus from must JuNoWriMo) is due to two opportunities that look to be headed my way (one more likely than the other) for freelance web development this summer. Both projects will pay well, and both will require back-end database management, so I’m studying up on the PHP so I’ll be ready to hit the ground running when things are more definite.

So yes, knitting and crocheting is no longer all I think about or all I do with my spare time. I’m a little sad about it, but new things are good (and are the opposite of static!), so I’m choosing to think positively. And I haven’t turned my back on the needles and hooks, they’re just no longer the center of my life. It’s all good.

Now if only I had time for a site redesign…