$_GET in the URL

viaBowl

Member
Is there a built-in way to send $_GET data in the friendly URL's? I've tried a few combinations and anything extra redirects back to the homepage.

Suggetsions?

Thanks
 
I've tried a few different combinations:

/index.php?pages/pagename/?a=b&c=d.....

This is in a PAGE node btw.
 
How are you trying to access them? Pages are straight HTML, you'll most likely need to be using a PHP Callback.
 
my call back is ready, i just can't get past putting GET data in the URL's

You should use XenForo built in functions to build links. Any way, the link you posted above will not work. Try to change it to:

/index.php?pages/pagename/&a=b&c=d

And see if the data gets populated to the $_GET array.
 
{xen:link route/action}

There's more that you can pass to it (parameters, etc.) and it runs through the route class and will generate an appropriate link. You can find examples all over the templates of this. :)
 
JulianD, what are the proper functions to build links?

If you have your url route on a string variable, building a link is as simple as this:

PHP:
XenForo_Link::buildPublicLink("account/privaty");

Or if you'd like to use the route's built in function to build a link, the syntax is usually as follows:

PHP:
XenForo_Link::buildPublicLink('members', $user);
XenForo_Link::buildPublicLink('posts', $post);
XenForo_Link::buildPublicLink('threads', $thread);

The first parameter is the route prefix that should be used, the second parameter is an array containing the required variables to build a link related to the route you're using. If you take a look at the thread route prefix (library/XenForo/Route/Prefix/Threads.php, there's a function called buildLink(). By calling XenForo_Link::buildPublicLink('threads', $thread), you are effectively calling the buildLink function within the Threads route.

XenForo uses some standardized url structure that you may be already familiar with. The format is somewhat like this:

site.com/[prefix]/[action]

But in cases where a parameter is required, such in this thread url, where the thread_id is needed, XenForo supports another commonly used url structure:

site.com/[prefix]/[param]/[action]

If we take this thread url as an example, the above variables would be:

prefix: threads
param: _get-in-the-url.58145
action: empty (default action, which usually means "index")

Anyway, you can even create your own routes with very complex url structures if you ever need to, completely outside of what XenForo already uses. You just need to code the proper route functions to support your url structures :)
 
Top Bottom