Small URL Pattern Changes?

4 views
Skip to first unread message

ethernick

unread,
Jan 28, 2011, 11:23:21 AM1/28/11
to Storytlr Discuss
I'm looking for some updates to the URL system. I've done a bit of
work on the Core so I'm comfortable with some modification but the
URL's are a little more challenging to me. When I take a look there
are 3 things I'm looking to do

1 - The Menu: It would be awesome to control the URL rather that "/
home?tab=0", "/home?tab=4". I'm looking to rename one tab to "/about"
or another for "/sounds". This way it's more relevant & search engine
friendly ( the variable sometimes get dumped

2 - Overriding "blog" and "picture" and "video" - I've made these tabs
goto different locations other than the inherent coded one - I really
like the thumbnail views. And I'd like to override the where the URL's
go - in the same way that I set up an "/about" in my previous point

3. It's really more for my manual entries - but i'd like to force the
url to be something different. Sometimes I use this for memory, and
other times irony.

If anyone is doing work around this stuff? Have some insight
documentation on how I could go about making these changes? I'd be
curious to take a look and try it out.

Thanks
Nick

John Hobbs

unread,
Jan 28, 2011, 1:30:15 PM1/28/11
to storytlr...@googlegroups.com
Hey,

This isn't the "right way", but you can do it like this:

File: protected/application/Bootstrap.php
Line: 269

Add your own route, like this one:

$router->addRoute(
    'infographics',
    new Zend_Controller_Router_Route(
        '/infographics/',
        array(
            'module' => 'public', 
            'controller' => 'home', 
            'action' => 'index', 
            'tab' => 5
        )
    )
);

That will get it to work, but it won't re-write the links.


You could add a method to the protected/application/public/controllers/HomeController.php and then a more generic route, something like "/home/[page name]" and determine what to render in the controller with some properties checking.  That might help with the reverse route code too.

Looks like that main menu is generated on about like 170 of protected/application/public/views/layouts/default.phtml

Hopefully this is a helpful start, this would be a nice new feature.

ethernick

unread,
Feb 12, 2011, 7:10:21 PM2/12/11
to Storytlr Discuss
Thanks John.

I mixed that with a little template change and it's working nicely.

Much appreciated.
> j...@velvetcache.org
Reply all
Reply to author
Forward
0 new messages