I've gotten a few emails about my (old) Next/Previous Post in Same Category plugin and about the fact that's its broken – however, this functionality is now built into wordpress. (and I have it working on the site right now as a matter of fact). I'm a bit behind on what has been included with each new version of WordPress, so I'm not sure when this made it's way in there, but.. YAY! Now I don't have to update the plugin! LOL! So, in any case, if you want to include links to the next/previous post in the same category as the one being viewed, you just need to do this (on the "single.php" template page INSIDE the "Loop")
<?php previous_post_link('« %link', 'Previous post in category: %title', TRUE); ?>
<?php next_post_link('%link »', 'Next post in category: %title', TRUE); ?>
Where the first argument (where I have "« %link") is the format of what is displayed… ie. if you want text before or a tag around the actual link (represented by "%link") this is where you say how you want it to show.
And the second argument (where I have "Previous post in category: %title" is the text of the actual link. You don't have to have the "%title" in there – but I think it's useful)
02 Dec, 2007
Posted by: Jennifer In: Flash
This is only just a small snippet of code and probably won't be totally helpful unless you have a fairly good idea what you're doing. I would make a full tutorial, except *I* don't have a complete understanding of what I'm doing. LOL! I know just enough in Flash to be "dangerous".
In any case, from what I can tell, in the latest version of Flash, there is a new way to make a button link to a URL. Instead of creating an action on the same layer as the button, you need to assign an instance name to your button. Then in another layer you have all the code for your buttons – similar to the following:
function gotoYahoo(event:MouseEvent):void
{
var mylink:URLRequest = new URLRequest("http://www.yahoo.com");
navigateToURL(mylink, "_self");
}
buttonInstanceName.addEventListener(MouseEvent.CLICK, gotoYahoo);
(If YOU know more about Flash, and have any corrections – they would be very welcome in the comments. I know how to do simple animations (like slideshows) and simple buttons – but beyond that I'm still in the very early learning stages)
Example:
<div id="mydiv" class="current">Content</div>
To change class assignment:
document.getElementById('mydiv').className = 'notcurrent';
To remove the class assignment:
document.getElementById('mydiv').className = '';
Trying to do some clean up here – there are files on this site still from my movable type days. So going to do a fresh start and removing a lot. The design will probably end up being the boring default for awhile once I'm done… hopefully will get the chance to get a real design up, but at the moment, as work has gotten busier and busier for me, this site is increasingly becoming the example of the saying: "the cobbler's children have no shoes".
Updated 11/8/07: Adding a few plugins, etc. here and there. I really am having trouble deciding on where I want the design to go on this site. No matter what I come up with, I'm not happy. LOL! In any case, in the meantime, I've added the ability for users to register on the site, so if you tend to leave a lot of comments (*cough*Ajnabiz*cough*) now you don't have to complain to me about entering your user info each time. 😉
That feature has been removed. If you comment here a lot let me know and I'll create an account for you. Otherwise, until WordPress has an ability to approve users before allowing them to register on the site, I'm not adding this back in. I know that users who register can't do anything but edit their own profile, but for some reason, the register/login form is becoming of interest to spammers.
So I've seen a few blogs talking about how Google is now punishing sites that sell link advertising, by downranking their sites. I've now seen this firsthand on scriptygoddess. It used to have a page-rank of 6 – and now it is a pagerank 43. I've seen other sites (good sites with good content) get downranked.
I know I'm probably stating the obvious – but I think its outrageous that Google wants to hurt sites that have good, valueable content, just because they'd like to make some cash for their work. What exactly is "wrong"/"bad" by my making some money for my effort? For a long time I had scriptygoddess remain up, and posted information I had learned – out of the goodness of my heart. But when I started working for myself to help make ends meet – it made sense to put up advertising on the site to help that end as well. I tried to be clear about which links are sponsored links. While it would have been lucrative to use those “inline” advertising links (where they link text right in your own post to advertisements) I didn't go that route because I felt it gave a bad user experience. Some links were intentional – and others were advertising and how could you tell the difference without mousing over or clicking on it? Annoying.
The biggest joke of all this, is of course, Google isn't punishing sites that ONLY contain GOOGLE advertising (which, by the way, pay the least/worst of any advertising I've contracted with)
On the whole, and up until now, I thought Google's been a pretty cool company but this move is just plain bad. Back before the dot-com bust – many sites were designed to draw revenue strictly from advertising. The business models didn't work out quite right – but I think I've been seeing a revitalization to that idea – the right advertising can support a website. And what is Google trying to do? Completely smush it and stop progression.
And I think it will eventually come back to bite them. I've found recently that when doing searches strictly through Google, I've found myself going back through their pages a lot more than I used to – and in some cases never finding what I had needed to. So by downranking sites with valuable information, they've pushed them further back in the list of pages, and maybe in some cases, pushing some sites so far back that you'd never find them *making their own search engine not as useful as before*.
I hope they re-think this idea.
Edited to add: The more I think about this, and the more I read, the more I have to laugh. Google is playing "link-police" from what I understand because their complaint is that selling links puts less-relevant sites up on top when you do searches – and that you're not allowed to "buy" that position. Right. That's why when I do searches on Google, top of the page, and all along the side are links for sites that BOUGHT that position. So really what they're saying is it's only ok when you're paying GOOGLE. *no one else should be making money* except for them. I think it's definitely time to change my default search engine!
03 Sep, 2007
Posted by: Jennifer In: Bookmarks
This isn't a big deal, but it was something I was fighting with for a bit. If you're trying to set the properties of a DIV via javascript, and you're getting the "document.getElementById("mydiv") has no properties" javascript warning, there's probably two big things that will cause it.
1) you didn't set the id.
Go back and make sure your div has id="mydiv" (or whatever you named it) in there.
2) the javascript is running BEFORE the div has been defined in the code.
This is what got me. I had the javascript code just above where the div was… and at load time, that div doesn't exist yet… the browser hasn't gotten that far down the page yet, so as far as it's concerned, that div with that id, doesn't exist. Once I moved the javascript BELOW the div… all was well.
And actually here – they suggest calling it on onload.
18 Aug, 2007
Posted by: Jennifer In: Bookmarks
Whenever someone asks me for tutorials on one thing or another, I think the first link I send them is w3schools. Recently, one of my clients was asking if I could do XSLT to format their XML document. I've heard about XSLT, I even get the basics of XML, and or course I understand HTML and CSS… but I didn't know how they all fit together. I did a quick little tutorial on their site, and now everything clicks into place. Sure, I'm no expert yet, but I think I have a solid enough understanding to do what they want. I know there's other good tutorials out there for web technologies (feel free to post some of your favorites in the comments) – but for having only a few minutes this morning, they gave a really good explanation that put everything into place for me.
13 Jul, 2007
Posted by: Jennifer In: PHP
I probably already have this posted somewhere, I know I use it a ton but always have to look it up for the exact syntax. Here's how you can get the name of the current file (ie. if your file is "aboutus.php" this will echo "aboutus.php")
<?php
$currentFile = $_SERVER["PHP_SELF"];
$parts = Explode('/', $currentFile);
echo $parts[count($parts) - 1];
?>
I've seen variations on it, as I said, I always have to look it up for the exact syntax – but today I found that from here. Also here – which seems to list a bunch of other useful snippets.
The main reason I've seen that error come up in javascripts is because a form name or field name has been misspelled somewhere. Tonight, while I combed over every name until my vision was crossed – I discovered a new reason why you might get this error:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
I was working with CubeCart – and that's their default. I usually use:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Hope that saves someone else some pain…
Comments Off on Warning: reference to undefined property
06 Jul, 2007
Posted by: Jennifer In: cubecart
As I wrote in the comments on this post, I have a new project that needed a shopping cart again. I tried Zen Cart again, and again I quickly remembered why I hated it so much. If I ever even so much as think of trying that package, just hand me the spork to remind me how I wanted to spork my eyes out everytime I use it.* Last time I really liked working with Cube Cart but ran into a problem with shipping and then went on a long hunt for something that did what I needed with shipping, was easy to modify templates, etc. etc. Since this time I didn't have the same kind of shipping restriction, I figured I'd give Cube Cart another go. So far so good. Customizing has been a breeze. Very intuitive. I'll be updating this post over the next few days with things I find useful as I work on the project (due next week! Wish me luck! heh)
Read the rest of this entry »