The fastest easiest way to get it right.

Linking To Pages

Simple URLs

Now that we have a page, we will probably want to link to it. Links to Andromeda pages are always made by setting the GET parameter "x6page" to the name of the page. This example shows two simple links:

A Couple of Links

Link to Hello World

Another Link

The first link is the bare minimum that you need to get to a page. You do not need the complete URL such as "http://...." You also do not need to name the file index.php because Andromeda will go to that file automatically if nothing is specified.

Pretty URLs

On some public sites it may be judged unsuitable to have long links like "?x6page=xxxxx&parm=5&anotherparm=value...." If you prefer, you can write links in this form:

A Friendly URL

This is a Pretty URL
This link goes to exactly the same place

As the example above shows, there are two completely different ways to make either link. The first form, using "pages/...", follows these rules:

  • The first item in the path after "pages" will be assigned to x6page.
  • After the first item, each pair of items in the path will be converted to assignments. In the example above parm1 gets the value "value1" and parm2 gets the value "value2"
  • If there is an odd element left over, it is assigned to the parameter "gp0".

Linking to File Downloads

You can use the pretty URL system to create links to file downloads without having to provide direct access to your filesystem. The following URL looks like a simple page access:

My Cool Song, Pretty URL

Same Link, Different Format

By following the rules listed above, we know that the first link and the second link will go to exactly the same place. This is because:

  • The first argument after "pages" will become the value of x6page, as if you had passed in "?x6page=downloads"
  • There are no complete pairs after "downloads"
  • There is a leftover parameter at the end, so it is assigned to gp0, as if you had put "&gp0=coolmusic.mp3".

You can then code up an Andromeda page "downloads" that would be in file application/x6downloads.php and contain class x6downloads. In the program's x6main() function you can do whatever processing the program may require to determine if the user can actually obtain they file they are requesting.

comments powered by Disqus
Home |  Documentation |  Download |  Credits |  Contact |  Login
Andromeda © Copyright 2004-2013, Licensed under the GPL Version 2