totw-banner.jpg

Sometimes you might be inclined to look at your address bar and wonder what PBwiki is up to. What’s all this “?edit=1″ and “?raw=1″ nonsense you see hanging off the end of your wiki names? More importantly, can YOU do anything interesting with them?

Well, of course the answer is yes, they can be useful to you; otherwise, I wouldn’t be writing this entry. Each of those examples represents parameters that are passed to PBwiki so that the computers on their end can know what page to fetch and send back to you. For a non-PBwiki example, when you do a search in Google, the search term is included in the address of the next page you request, and that information is used by Google’s servers to search their database for your information.

Similarly, when “?edit=1″ is set on PBwiki, it says “send me the edit-mode version of this page.” You can use parameters like this one to help make navigating your site easier…

The best way to explain this is with examples, so let’s just jump right in:

The edit parameter

In an earlier blog entry, I talked about what to do if you couldn’t get to a wiki page’s edit page. For example, let’s say I inserted a Javascript script into a page called Test on my wiki: http://MYWIKI.pbwiki.com/Test

Now let’s say this Javascript crashed my computer, and thus I couldn’t get to the edit button. My solution was to type the following into your address bar, taking you directly to the edit page: http://MYWIKI.pbwiki.com/Test?edit=1

In a URL, everything after a “?” character defines parameters, variables to send back to the server. In the case above, we’re setting a variable called edit to a value of 1. When that is set, PBwiki knows to go to the edit page.

The raw parameter

Folks who use iframe Wikilets know that appending “?raw=bare” to the end of their address strips headers from the wiki page:

<iframe src=”FrontPage?raw=bare”></iframe>

When using “raw=bare”, you can also add another parameter, so that all Wikilinks inside the iframe link to other pages in their raw=bare form:

<iframe src=”FrontPage?raw=bare&embed=1″></iframe>

By setting the “embed” parameter, PBwiki knows to transform all links so they point to other “raw=bare” pages.

Furthermore, there are other options for setting the “raw” parameter:

  • bare – creates a version of the page without headers or footers
  • js – outputs the contents of the page as a javascript script. That can be embedded in a page like so:
    • <script src=”FrontPage?raw=js”></script>
  • 1 – shows the wiki/html source of the page; all headers and footers still present
  • 2 – wiki/html source in completely raw format without any headers or footers

Outside of the wikilet use, I find that raw=1 is particularly useful in sharing my code with others. For example, you can click the following link to see the source of my wiki’s FrontPage: http://dochuyen.pbwiki.com/FrontPage?raw=1

For example, you could make a couple templates of your own and then link to their wiki sources so people could copy them.

Tags and parameters

Tags are controlled by a page called “tags.php.” If you go to http://non-educational.pbwiki.com/tags.php, you will see a list of all tags and their associated pages. However, what if you’re looking for something more specific?

For example, I may want to direct people to ONLY the pages I’ve personally marked. On the wiki above, I always tag pages I’ve created with vietmusic. People who visit the following link will see all pages with that tag on that wiki: http://non-educational.pbwiki.com/tags.php?ptag=vietmusic

The ptag parameter can be set to whatever tag you wish to isolate. Therefore, if you have a couple specific categories on your wiki, you can use this functionality to direct people to pages in each category. It’s a great built-in organizational tool.

Search and parameters

What if instead of needing to link to a list of all pages tagged with “vietmusic”, I wanted to link to a list of all pages containing the term “vietmusic”? Well, we can use the parameters of the FindPage page to do that:

http://non-educational.pbwiki.com/FindPage?SearchFor=vietmusic

You can also add the parameter for case sensitive search:

http://non-educational.pbwiki.com/FindPage?SearchFor=vietmusic&CaseSensitive=on

As you can see, the parameters of interest are SearchFor, which defines the search term, and CaseSensitive, which sets case sensitivity.

Conclusion

So maybe this is a bit more esoteric than some of my other tips, but as I explained yesterday, I’ll be trying to cover the whole spectrum of basic to advanced this week.

Tomorrow’s tip (which I haven’t decided on yet), will have me completely caught up, so yippee!   As always, comments and questions below or e-mail me at dochuyen84@gmail.com.  See you soon!

See the rest of my tips here.

-Jason Nguyen