Code Monkey home page Code Monkey logo

url_router's People

Contributors

bauhouse avatar brendo avatar designermonkey avatar makenosound avatar nils-werner avatar robphilp avatar simoneeconomo avatar tonyarnold avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

url_router's Issues

Simplified notation

When creating new routes, the help text for simplified notations displays like this:

Simplified: page-name/$user/projects/$project

After saving it looks like this:

Simplified: page-name/:user/projects/:project

Only one can be right. Which?

Simplified routing syntax

I would like to table a debate about the syntax of the simplified url routing that @alpacaaa kindly added. I am leaning towards this now for general use, and it should be definitely pushed as the primary routing technique over the more 'advanced' regex.

I feel personally that as primarily XSL developers, who are used to parameter syntax like $param, it can be confusing to use syntax from Rails like :param.

Any thoughts? @nils-werner @alpacaaa ?

MySQL error: Column count doesn't match value count

Hello Symphonists,
I get an error when I try to save my route definitions.

Example to reproduce the problem

First route: "Force re-route if page exists" is checked
Second route: "Force re-route if page exists" is not checked

The generated query:

INSERT INTO
    `sym_url_router` (`type`, `from`, `to`, `http301`)
VALUES
    ('route', '/\/foo\/(.+\/)/', '/foo/$1', 'yes'),
    ('route', '/\/foo\/(.+\/)/', '/foo/$1')

Error message:

Error : Column count doesn't match value count at row 2

(MySQL version is 5.1.32)

Extension gets activated but no Nav-Pages or Settings appear

Copied from Symphony CMS Forum:

It might be messed up permissions on my particular Symphony 2.3 installation here, but I can’t for the life of me get this extension (2.0.1, though readme says 1.3) working. I tried on two different 2.3 installations, the activation works fine, but I get no options in my preferences and no other options in any navgroups either. Am I missing something very obvious again? :)

Implement rails like routing

Very good extension, just having some problems with regexp.

Would be very cool if you could define routes as rails does. Something like this:

user/:name/comments => user/comments/:name
user/:name/comments/:comment-id => user/comments/:name/:comment-id

Of course regexp are a lot more flexible, but I think this is a very good solution for those who don't need that level of control.
Don't know how difficult is implementing this idea, but would be very cool ;)

URL Router 3.0 not working with Sym 2.4+

I have consistently used this route to shortcut URLs such as:

example.com/page/about/

to

example.com/about/

alt text

The page "page" accepts the parameter "$page". This works with Sym 2.3.x and URL Router 2.0.2.

On Sym versions 2.4 and 2.5.1 and URL Router 3.0 this no longer seems to work. Is there anything which has changed on either release which would cause this to fail? Thanks

I don't see any errors, I am simple sent to the index page rather than the page page. Its as if Debug data looks like this:

    <root-page>home</root-page>
    <current-page>home</current-page>
    <current-page-id>1</current-page-id>
    <current-path>/who-we-are</current-path>

The index page isn't setup to accept URL parameters. If I disable the extension I then get a 404.

Nothing is included in the logs.

I'm happy to provide sum login details if anyone would be happy to have a look.

Routes are overriding existing pages. Need help!

I created a Page called page and set up the following routes...

From /:pt1

To /page/:pt1

and

From /:pt1/:pt2

To /page/:pt1/:pt2

I also, setup a page called menu and the page is ignored since I have the above route setup...

So then I add in the following route...

From /menu/

To /menu/

And nothing happens, it still uses the Page called page instead of menu

How I am able to use another page?

Routing params to homepage breaks 404

When doing it's wonderful thang of routing anything that doesn't match a 'page' to the root page's params, 404 pages are broken.

Is there any way we can check the root pages params and redirect to 404 if they don't exist? Should this be something that is done in the main datasource for the root page, using it's 404 method? Should we therefore be telling people to make sure they do this?

Thoughts from @Alpacaa @tonyarnold and @nils-werner appreciated.

Broken on 2.6.0?

Symphony Warning: preg_match(): Unknown modifier 'h'

An error occurred in D:\wamp\www\pb\extensions\url_router\extension.driver.php around line 102

97
98             $return = array();
99
100             foreach($routes as $route)
101             {
102                 if(preg_match($route['from'], $path, $matches) == 1)
103                 {
104                     $route['routed'] = preg_replace($route['from'], $route['to'], $path);
105
106                     $route['original'] = $path; 

Only the first route works

When setting multiple routes, only the first route works as expected. All other routes are ignored.

I tracked down the problem to the break function. The break should end the loop only if a match is found. So, just move the break inside the if statement group.

foreach($routes as $route)
{
    if(preg_match($route['from'], $path, $matches) == 1)
    {
        $route['routed'] = preg_replace($route['from'], $route['to'], $path);

        $route['original'] = $path;

        $return = $route;

        break;
    }
}

Server root vs. Symphony root

I'd like to redirect from a page team to a page anmeldung as soon as team doesn't have any additional URL parameters set. I got the router to match the needed from path using /team?\/$/ but I'm running into a problem with the redirection: it doesn't redirect based on Symphony's document root but based on the server root (I tried either anmeldung or /anmeldung/ without success). So when my from URL is http://localhost/example.com/team/ I get redirected to http://localhost/anmeldung/ – but I'd like to end at http://localhost/example.com/anmeldung/.

I'd expect this extension to always redirect based on Symphony's document root and not the server root.

Target-URL with querystring results in Too Many Redirects error

(Symphony 2.2.5 and Url Router 1.2)

As described on the Forum

The URL Router adds a trailing slash ("/") to a route when there's no trailing slash in the To-URL.
Example: I redirect /\/abonneer/ to http://foo.bar.list-manage.com/subscribe?u=123abc (note the querystring and lack of trailing slash)

My destination url becomes http://foo.bar.list-manage.com/subscribe?u=123abc/ and fails on the trailing slash ("Too many redirects" error).

The slash seems always added in extension.driver.php:123 which (in my case) is unwanted since there's a querystring.

Redirect omits subdirectory

Local installation, Symphony 2.2.5, URL Router 1.3

Server document root: http://localhost:8080/
Website document root: http://localhost:8080/website

Goal: Redirect from site's index page to the same page with an added required default parameter (data source attached to page filtering entries on required parameter).

Redirect rule: from: ^$^ to: /default-parameter/

Accessing http://localhost:8080/website/ redirects to http://localhost:8080/default-parameter/, instead of http://localhost:8080/website/default-parameter/.

Accessing http://localhost:8080/website/parameter-that-should-throw-404/ redirects to http://localhost:8080/parameter-that-should-throw-404//default-parameter/, instead of throwing an 404 error since no entries are returned by the data source.

Having trouble routing urls with the force re-route checkbox removed

The page I am trying to route exists and without the check box 'force re-route even if page exists' it doesn't seem to work for me. Am I doing something wrong?

I have two pages;

projects (shows a list of projects)
projects/projects-single (shows project detail and accepts the $project-title url parameter)

Currently the route for the individual project is

from
//projects/(.+)//

to
/projects/projects-single/$1/

this works with older versions of the router but not 3.1 - if any one can point me in the right direction I would be grateful.

Many thanks

Routes should also work with "real files"

Since we are trying to move from .htaccess to php routing, it would be very convenient if this extension was also usable for routes to static assets like JS and CSS files.

For instance, it is bad practice to request your styles with a querystring: style.css?v=204, incorporating it into the name is better: style-204.css. This is because some caching proxies will not cache the file when there is a query parameter present.

However, to do so a route is needed (a redirect will not work, as then the destination will still be cached), but at this moment routes only work for Symphony pages - not for files in the filesystem. Leaving me with no other option than to add the route to the server config - which is something I really, really want to stop doing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.