Tip of the Week #17: URL Parameters and You

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.pbworks.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.pbworks.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:

http://FrontPage?raw=bare

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.pbworks.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.pbworks.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.pbworks.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.pbworks.com/FindPage?SearchFor=vietmusic

You can also add the parameter for case sensitive search:

http://non-educational.pbworks.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

10 thoughts on “Tip of the Week #17: URL Parameters and You

  1. I was wondering if there is a utility or feature available for PBWiki that would allow you to copy all of the data in a page and make a new page (sort of a Save Page As feature). I’d like to do a weekly tips and then save it was an archived piece without needing to recreate the Weekly Tips page each time.

  2. Well, right now, you can view the source of a page and copy that. In the page information division at the bottom of your wiki, you’ll see a little link that will take you to the page’s source. Click that and you’ll see the underlying code for a page. Highlight and copy the code. Then create your new page. Click the SOURCE button, then paste the code in. Click the SOURCE button again to return to normal editing.

  3. You really make it appear really easy together with your
    presentation however I to find this topic to be actually one thing which I feel I
    might by no means understand. It kind of feels too complex and extremely extensive for me.
    I am taking a look ahead to your subsequent submit, I’ll try to get the hold of it!

  4. I blog frequently and I seriously appreciate your content.
    This article has really peaked my interest. I am going to bookmark
    your website and keep checking for new information about once
    per week. I opted in for your RSS feed too.

  5. Oh my goodness! Incredible article dude! Many thanks,
    However I am encountering issues with your RSS.
    I don’t know why I am unable to subscribe to it.
    Is there anyone else getting the same RSS problems?
    Anyone who knows the solution will you kindly respond?
    Thanks!!

  6. A of a new a good number advantageous accessories of a person’s business presentation as for me
    already been after a new Sexy lindsay lohan sex tape adventure already been acquiring
    been shown accompanied by 100 % pure a little time belief updates on a
    computer.

Leave a reply to Low motorcycle insurance Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.