RE: YARQ - Yet Another Routing Question

2012-11-30 Thread Advantage+
Thanks.

Will try it out.

Dave

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of lowpass
Sent: Friday, November 30, 2012 3:06 PM
To: cake-php@googlegroups.com
Subject: Re: YARQ - Yet Another Routing Question

Router::connect(
'/link/:one/:two/:three/:four/:five',
array(
'controller' => '...',
'action' => '...'
),
array(
'one' => '[0-9]?',
'two' => '[0-9]?',
'three' => '[0-9]?',
'four' => '[0-9]?',
'five' => '[0-9]?',
'pass' => array('one', 'two', 'three', 'four', 'five')
)
);


public function foo($one = null, $two = null, $three = null, $four = null,
$five = null) {
die(debug(array($one, $two, $three, $four, $five))); }


On Fri, Nov 30, 2012 at 9:17 AM, Advantage+  wrote:
>
>
> When defining a route in routes.php what is the correct way to code a 
> link to a function where different variables can be passed?
>
>
>
> For example the link can pass up to 5 args 
> www.example.com/link/2/5/0/2/6 or as little as 1 
> www.example.com/link/2
>
> Looking at the book it shows basic pass => for the know vars being 
> passed but what if the vars passed can vary from 1 var to 5 vars.
>
>
>
> I'm sure you do not to make 5 routes depending on each scenario?
>
>
>
> Any insight would be great.
>
>
>
> Thanks all
>
>
>
> Dave
>
>
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP Find us on 
> Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google 
> Groups "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

--
Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter
http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: YARQ - Yet Another Routing Question

2012-11-30 Thread lowpass
Router::connect(
'/link/:one/:two/:three/:four/:five',
array(
'controller' => '...',
'action' => '...'
),
array(
'one' => '[0-9]?',
'two' => '[0-9]?',
'three' => '[0-9]?',
'four' => '[0-9]?',
'five' => '[0-9]?',
'pass' => array('one', 'two', 'three', 'four', 'five')
)
);


public function foo($one = null, $two = null, $three = null, $four =
null, $five = null)
{
die(debug(array($one, $two, $three, $four, $five)));
}


On Fri, Nov 30, 2012 at 9:17 AM, Advantage+  wrote:
>
>
> When defining a route in routes.php what is the correct way to code a link
> to a function where different variables can be passed?
>
>
>
> For example the link can pass up to 5 args www.example.com/link/2/5/0/2/6 or
> as little as 1 www.example.com/link/2
>
> Looking at the book it shows basic pass => for the know vars being passed
> but what if the vars passed can vary from 1 var to 5 vars.
>
>
>
> I'm sure you do not to make 5 routes depending on each scenario?
>
>
>
> Any insight would be great.
>
>
>
> Thanks all
>
>
>
> Dave
>
>
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Routing question, need a department name before all URL's

2010-10-20 Thread ohcibi
the rout itself is in fact pretty straight forward:
/:department/:controller/:action is your route... you then have $this-
>params['department'] in all your controllers and action available.

but you still need unique(!) slugs to identify the right department
(unless, you include the id within the route like /:department-:id),
and thats the thing which is (somehow) complicated and can be achieved
in many many ways. there is also a sluggable behaviour available in
the bakery.

in my applications i have a beforeSave() in my app_model which checks
for a field called 'slug' in _schema and, if available, stores the
unique-slugged $displayField in 'slug' (dont forget to put an index on
'slug' into your dbms). but this is also just one (quick)
solution...

On 20 Okt., 10:46, ianmcn  wrote:
> Thanks both, some smart suggestions there. Seems like what I'm wanting
> to do isn't as straight forwards as I had assumed, but with the help
> of your suggestions I reckon I can figure something out.
>
> On Oct 19, 10:49 pm, Sam  wrote:
>
>
>
> > What you could do is have your router dynamically get the names of all
> > controllers and cache them for a certain period of time- then use that
> > cached lists in your routes... anything that wasn't a controller you
> > would route as a department. Something like this(not tested...
> > slightly modified from an implementation I used):
>
> > $controllerList = Cache::read('controllers_flatlist', 'default');
>
> > if ($controllerList === false) {
> >     $controllers = Configure::listObjects('controller');
> >     foreach($controllers as &$value) {
> >         $value = Inflector::underscore($value);
> >     }
>
> >     $controlerList = $controllers;
> >     array_push($controlerList, 'sitemap', 'robots', 'sitemap.xml',
> > 'robots.txt');
> >     $controllerList = implode('|', $controlerList);
> >     Cache::write('controllers_flatlist', $controllerList);
> >     Cache::write('controllers_list', $controllers);
>
> > }
>
> > if(empty($controllers)){
> >     $controllers = Cache::read('controllers_list', 'default');
>
> > }
>
> > if (empty($controllers)) {
> >     $controllers = Configure::listObjects('controller');
> >     Cache::write('controllers_list', $controllers);
>
> > }
>
> > foreach($controllers as &$value) {
> >     Router::connect('/:department/'. $value . '/*', array(
> >             'controller' => $value
> >         ) , array(
> >             'department' => '(?!' . $controllerList . ')[a-zA-Z0-9\-]+'
> >         ));
>
> > }
>
> > On Oct 19, 10:55 am, ianmcn  wrote:
>
> > > I develop an internal booking/asset management system for my work, it
> > > has data separated by department, but I need a way to have the
> > > department specified in the URL as the first segment. For example:
>
> > > /:departmentname/bookings/add
>
> > > After that, the default cakephp conventions would work fine. At the
> > > moment I achieve this by having the application in many different
> > > folders, one for each department - but I know that is a seriously bad
> > > way to do it - it was just a quick way to achieve something to a
> > > deadline, but the number of departments is getting out of hand, so I
> > > want to put this right. Can anyone give me some hints as to what
> > > routing rules I'd need to do this?
>
> > > Thanks
>
> > > Ian McNaught

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Routing question, need a department name before all URL's

2010-10-20 Thread ianmcn
Thanks both, some smart suggestions there. Seems like what I'm wanting
to do isn't as straight forwards as I had assumed, but with the help
of your suggestions I reckon I can figure something out.

On Oct 19, 10:49 pm, Sam  wrote:
> What you could do is have your router dynamically get the names of all
> controllers and cache them for a certain period of time- then use that
> cached lists in your routes... anything that wasn't a controller you
> would route as a department. Something like this(not tested...
> slightly modified from an implementation I used):
>
> $controllerList = Cache::read('controllers_flatlist', 'default');
>
> if ($controllerList === false) {
>     $controllers = Configure::listObjects('controller');
>     foreach($controllers as &$value) {
>         $value = Inflector::underscore($value);
>     }
>
>     $controlerList = $controllers;
>     array_push($controlerList, 'sitemap', 'robots', 'sitemap.xml',
> 'robots.txt');
>     $controllerList = implode('|', $controlerList);
>     Cache::write('controllers_flatlist', $controllerList);
>     Cache::write('controllers_list', $controllers);
>
> }
>
> if(empty($controllers)){
>     $controllers = Cache::read('controllers_list', 'default');
>
> }
>
> if (empty($controllers)) {
>     $controllers = Configure::listObjects('controller');
>     Cache::write('controllers_list', $controllers);
>
> }
>
> foreach($controllers as &$value) {
>     Router::connect('/:department/'. $value . '/*', array(
>             'controller' => $value
>         ) , array(
>             'department' => '(?!' . $controllerList . ')[a-zA-Z0-9\-]+'
>         ));
>
> }
>
> On Oct 19, 10:55 am, ianmcn  wrote:
>
> > I develop an internal booking/asset management system for my work, it
> > has data separated by department, but I need a way to have the
> > department specified in the URL as the first segment. For example:
>
> > /:departmentname/bookings/add
>
> > After that, the default cakephp conventions would work fine. At the
> > moment I achieve this by having the application in many different
> > folders, one for each department - but I know that is a seriously bad
> > way to do it - it was just a quick way to achieve something to a
> > deadline, but the number of departments is getting out of hand, so I
> > want to put this right. Can anyone give me some hints as to what
> > routing rules I'd need to do this?
>
> > Thanks
>
> > Ian McNaught

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Routing question, need a department name before all URL's

2010-10-19 Thread Sam
What you could do is have your router dynamically get the names of all
controllers and cache them for a certain period of time- then use that
cached lists in your routes... anything that wasn't a controller you
would route as a department. Something like this(not tested...
slightly modified from an implementation I used):

$controllerList = Cache::read('controllers_flatlist', 'default');

if ($controllerList === false) {
$controllers = Configure::listObjects('controller');
foreach($controllers as &$value) {
$value = Inflector::underscore($value);
}

$controlerList = $controllers;
array_push($controlerList, 'sitemap', 'robots', 'sitemap.xml',
'robots.txt');
$controllerList = implode('|', $controlerList);
Cache::write('controllers_flatlist', $controllerList);
Cache::write('controllers_list', $controllers);
}

if(empty($controllers)){
$controllers = Cache::read('controllers_list', 'default');
}

if (empty($controllers)) {
$controllers = Configure::listObjects('controller');
Cache::write('controllers_list', $controllers);
}

foreach($controllers as &$value) {
Router::connect('/:department/'. $value . '/*', array(
'controller' => $value
) , array(
'department' => '(?!' . $controllerList . ')[a-zA-Z0-9\-]+'
));
}



On Oct 19, 10:55 am, ianmcn  wrote:
> I develop an internal booking/asset management system for my work, it
> has data separated by department, but I need a way to have the
> department specified in the URL as the first segment. For example:
>
> /:departmentname/bookings/add
>
> After that, the default cakephp conventions would work fine. At the
> moment I achieve this by having the application in many different
> folders, one for each department - but I know that is a seriously bad
> way to do it - it was just a quick way to achieve something to a
> deadline, but the number of departments is getting out of hand, so I
> want to put this right. Can anyone give me some hints as to what
> routing rules I'd need to do this?
>
> Thanks
>
> Ian McNaught

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Routing question, need a department name before all URL's

2010-10-19 Thread cricket
On Tue, Oct 19, 2010 at 11:55 AM, ianmcn  wrote:
> I develop an internal booking/asset management system for my work, it
> has data separated by department, but I need a way to have the
> department specified in the URL as the first segment. For example:
>
> /:departmentname/bookings/add
>
> After that, the default cakephp conventions would work fine. At the
> moment I achieve this by having the application in many different
> folders, one for each department - but I know that is a seriously bad
> way to do it - it was just a quick way to achieve something to a
> deadline, but the number of departments is getting out of hand, so I
> want to put this right. Can anyone give me some hints as to what
> routing rules I'd need to do this?

You're also asking for more problems by having a slug as the first
part of the URL. To do that, you'd have to create routes for every
single action (including admin_*) and include them before this one.
Either that, or your regexp to match on department would have to
include the literal names of all departments, eg:

array('department' => '[foo|bar|this|that|another|and_another]'

That way, the regexp wouldn't match on your other controllers. But you
can probably see that this would be yet another maintenance nightmare.

Better to do this through a single controller. Create a Booking model
and a Department model. That way, it shouldn't matter how many new
departments are added.

BookingsController:

Router::connect(
'/bookings/:dept',
array('controller' => 'bookings', 'action' => 'view'),
array('dept' => '[a-z]+', 'pass' => array('dept')
);

Router::connect(
'/bookings/:dep/addt',
array('controller' => 'bookings', 'action' => 'add'),
array('dept' => '[a-z]+', 'pass' => array('dept')
);

public function view($dept = null) {

public function add($dept = null) {


Note that you wouldn't strictly need to add Department to
BookingsController's $uses array. As long as you properly associate it
with Booking model, you can do $this->Booking->Department->find(...)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Routing question, need a department name before all URL's

2010-10-19 Thread ianmcn
I develop an internal booking/asset management system for my work, it
has data separated by department, but I need a way to have the
department specified in the URL as the first segment. For example:

/:departmentname/bookings/add

After that, the default cakephp conventions would work fine. At the
moment I achieve this by having the application in many different
folders, one for each department - but I know that is a seriously bad
way to do it - it was just a quick way to achieve something to a
deadline, but the number of departments is getting out of hand, so I
want to put this right. Can anyone give me some hints as to what
routing rules I'd need to do this?

Thanks

Ian McNaught

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Nickname routing question

2010-07-16 Thread Hugo Massaroli
Wow! I loved your solution. I'll try it, thanks alot!

2010/7/16 cricket 

> On Thu, Jul 15, 2010 at 3:42 PM, Hugo Massaroli 
> wrote:
> > Hi CakePHP community! I have a doubt about routing and accesing models
> while
> > routing. The thing is I have two models:
> >
> > user, and group.
> >
> > Both have show pages.
> >
> > I want to have nicknames so I have a nicknames table and I want to access
> > the show method in this way:
> >
> > www.mydomain.com/thisismygroup1
> > www.mydomain.com/user34
> >
> > Nicknames table:
> > id
> > group_id
> > user_id
> > detail (nickname)
>
>
> Nicknames table:
> id
> model
> foreign_key
> name
>
> Fetch the row based on the requested name and redirect to the correct
> controller, passing the foreign_key value as ID. Or, better, associate
> this model with both User and Group so that your NicknamesController
> can get it straight from whichever model, eg.
> $this->Nicknames->Group->find(...). Then you'd jusy need to do:
>
> $this->viewPath = 'groups';
> $this->render('view') ;
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Nickname routing question

2010-07-16 Thread cricket
On Thu, Jul 15, 2010 at 3:42 PM, Hugo Massaroli  wrote:
> Hi CakePHP community! I have a doubt about routing and accesing models while
> routing. The thing is I have two models:
>
> user, and group.
>
> Both have show pages.
>
> I want to have nicknames so I have a nicknames table and I want to access
> the show method in this way:
>
> www.mydomain.com/thisismygroup1
> www.mydomain.com/user34
>
> Nicknames table:
> id
> group_id
> user_id
> detail (nickname)


Nicknames table:
id
model
foreign_key
name

Fetch the row based on the requested name and redirect to the correct
controller, passing the foreign_key value as ID. Or, better, associate
this model with both User and Group so that your NicknamesController
can get it straight from whichever model, eg.
$this->Nicknames->Group->find(...). Then you'd jusy need to do:

$this->viewPath = 'groups';
$this->render('view') ;

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Nickname routing question

2010-07-16 Thread Hugo Massaroli
Nodoby? :(

2010/7/15 Hugo Massaroli 

> Hi CakePHP community! I have a doubt about routing and accesing models
> while routing. The thing is I have two models:
>
> user, and group.
>
> Both have show pages.
>
> I want to have nicknames so I have a nicknames table and I want to access
> the show method in this way:
>
> www.mydomain.com/thisismygroup1
> www.mydomain.com/user34
>
> Nicknames table:
> id
> group_id
> user_id
> detail (nickname)
>
> I can't use normal routing because I don't know to wich controller the
> nickname belongs to. I need to access Nickname model inside routes.php? Then
> if nickname has user_id I redirect to /users/show and if nickname has
> group_id I redirect to /groups/show. Is that ok? It's possibly and right to
> access a Model inside routes?
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Nickname routing question

2010-07-15 Thread Hugo Massaroli
Hi CakePHP community! I have a doubt about routing and accesing models while
routing. The thing is I have two models:

user, and group.

Both have show pages.

I want to have nicknames so I have a nicknames table and I want to access
the show method in this way:

www.mydomain.com/thisismygroup1
www.mydomain.com/user34

Nicknames table:
id
group_id
user_id
detail (nickname)

I can't use normal routing because I don't know to wich controller the
nickname belongs to. I need to access Nickname model inside routes.php? Then
if nickname has user_id I redirect to /users/show and if nickname has
group_id I redirect to /groups/show. Is that ok? It's possibly and right to
access a Model inside routes?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


RE: Routing Question

2009-11-01 Thread Dave

Right on...

Will give that a go.

So easily over looked when I see it there now.

Thanks

D

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Robert P
Sent: November-01-09 12:17 PM
To: CakePHP
Subject: Re: Routing Question


Well, if you already have something set up like

function edit($id = null) {
...
}

You can simply wrap the method. This is PHP after all.

function manage_edit($id = null) {
$this->edit($id);
}

And if you also want to render the "edit" view:

function manage_edit($id = null) {
$this->edit($id);
$this->render('edit');
}

On Nov 1, 7:30 am, "Dave"  wrote:
> I have 2 routes defined for different groups. manage_ and editor_
>
> Now I have a few functions that either group can access so i could 
> easily just change the action name to edit rather than manage_edit and 
> editor_edit
>
> but how can i set it up so manage_edit and editor_edit both end up at 
> edit but the user will see manage/edit or editor/edit
>
> Thanks
>
> Dave


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing Question

2009-11-01 Thread Robert P

Well, if you already have something set up like

function edit($id = null) {
...
}

You can simply wrap the method. This is PHP after all.

function manage_edit($id = null) {
$this->edit($id);
}

And if you also want to render the "edit" view:

function manage_edit($id = null) {
$this->edit($id);
$this->render('edit');
}

On Nov 1, 7:30 am, "Dave"  wrote:
> I have 2 routes defined for different groups. manage_ and editor_
>
> Now I have a few functions that either group can access so i could easily
> just change the action name to edit rather than manage_edit and editor_edit
>
> but how can i set it up so manage_edit and editor_edit both end up at edit
> but the user will see manage/edit or editor/edit
>
> Thanks
>
> Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Routing Question

2009-10-31 Thread Dave
I have 2 routes defined for different groups. manage_ and editor_
 
Now I have a few functions that either group can access so i could easily
just change the action name to edit rather than manage_edit and editor_edit
 
but how can i set it up so manage_edit and editor_edit both end up at edit
but the user will see manage/edit or editor/edit
 
Thanks
 
Dave

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Routing Question

2009-09-07 Thread Dave Maharaj :: WidePixels.com

Can you use routing for image directories?
 
I have a link to an image that goes to
site.com/img/entries/gal/c990042505a.jpg but I would like the URL to be
site/gallery/c990042505a.jpg and route that to
site.com/img/entries/gal/c990042505a.jpg

I have Router::connect('/gallery/:filename/',array('url' =>
'/img/entries/gal/'),array('filename' => '[-_A-Za-z0-9]+','pass' =>
array('filename')));

But cant seem to get the link to work

link($html->image('entries/thumb/' . $entry['image'],
array('class' => 'slide_thumb')), '/gallery/'. $entry['image'] ,
array('class' => 'group', 'rel' => 'group_' . $showcase['title']), null,
array('escape' => false));
?>

Is this even possible?
 
Dave 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Territory routing question

2009-06-16 Thread Jim Wiberley

I like the idea of prefix routing, although wouldnt it require a lot
of additional functions to work?

ie,

uk_view() {
}

fr_view(){
}

rather than just a single  view() function?


I've found this seems to have done the trick, seems fairly simple
Router::connect('/:region/:controller/:action/*');



On Jun 16, 7:19 pm, Miles J  wrote:
> Use 
> prefixes:http://book.cakephp.org/view/46/Routes-Configuration#Prefix-Routing-544
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Territory routing question

2009-06-16 Thread Miles J

Use prefixes: 
http://book.cakephp.org/view/46/Routes-Configuration#Prefix-Routing-544
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Territory routing question

2009-06-16 Thread brian

Assuming the territory will always be a 2-letter, lowercase code ...

Router::connect(
'/:territory/news',
array(
'controller' => 'news',
'action' => 'index'
),
array(
'territory' => '[a-z]{2}',
'pass' => array('territory')
)
);

You could do the same for each of the actions that require territory
to be passed:

Router::connect(
'/:territory/news/:id',
array(
'controller' => 'news',
'action' => 'view'
),
array(
'territory' => '[a-z]{2}',
'id' => '[0-9]+',
'pass' => array('territory', 'id')
)
);

Router::connect(
'/:territory/news/:title',
array(
'controller' => 'news',
'action' => 'view'
),
array(
'territory' => '[a-z]{2}',
'title' => '[-_a-z]+',   // title slug
'pass' => array('territory', 'title')
)
);

Or you may be able to use '/:territory/news/*'. I'm not sure.

On Mon, Jun 15, 2009 at 9:49 PM, Jim Wiberley wrote:
>
> Hi All,
>
> I'm looking for a way to set my site up so that the first part of the
> url is always the territory,
>
> eg. http://www.site.com/uk/news, http://www.site.com/fr/news
>
> How would I set up the routing for this so that the territory variable
> is passed on to the controller?
>
> Thanks
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Routing question...

2009-06-16 Thread Fivetwentysix

Hey I'm building my site with cakephp and I love it, cakephp has made
it fun again.

However I do use phpbb3 and would like to continue using it as it has
never let me down yet.

My directory is like this

./index.php <-- cake
./cake
./app

So I would like to know what I would have to do to get phpbb3 working
correctly since everything on my site gets routed with cakephp's
routing functions.

Thanks.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Routing question...

2009-06-16 Thread Fivetwentysix

Hey I'm building my site with cakephp and I love it, cakephp has made
it fun again.

However I do use phpbb3 and would like to continue using it as it has
never let me down yet.

My directory is like this

./index.php <-- cake
./cake
./app

So I would like to know what I would have to do to get phpbb3 working
correctly since everything on my site gets routed with cakephp's
routing functions.

Thanks.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Territory routing question

2009-06-15 Thread Jim Wiberley

Hi All,

I'm looking for a way to set my site up so that the first part of the
url is always the territory,

eg. http://www.site.com/uk/news, http://www.site.com/fr/news

How would I set up the routing for this so that the territory variable
is passed on to the controller?

Thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing question

2009-05-06 Thread brian

You say you want a *list* of articles but then use an example with a
title, suggesting you want a route for a specific article. If it's the
latter, you can do:

Router::connect(
'/view/:article_slug',
array('controller' => 'articles', 'action' => 'view'),
array(
'article_slug' => '[\+\-_A-Za-z]+',
'pass' => array('article_slug')
)
);

That assumes each article has a slug. You'll want to use that, rather
than the actual title. Look at SluggableBehavior.

You can replace "view" with anything else. You could do, for instance:

Router::connect(
'/articles/:article_slug',
array('controller' => 'articles', 'action' => 'view'),
array(
'article_slug' => '[\+\-_A-Za-z]+',
'pass' => array('article_slug')
)
);

Though, if you do that, be sure to create routes--before this one--for
any other actions in ArticlesController.

On Wed, May 6, 2009 at 9:22 PM, Dcahrakos  wrote:
>
> Hi,
>
> I am working on a website where i need to get a list of articles from
> a database, and the original url is something like
> http://localhost/articles/article/Article Title here
>
> what im trying to do is reroute it so I can access it with something
> like
> http://localhost/view/Title here
>
> but I cant seem to get the routing to work properly...what is the
> correct way to get this to work?
>
> Thanks.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Routing question

2009-05-06 Thread Dcahrakos

Hi,

I am working on a website where i need to get a list of articles from
a database, and the original url is something like
http://localhost/articles/article/Article Title here

what im trying to do is reroute it so I can access it with something
like
http://localhost/view/Title here

but I cant seem to get the routing to work properly...what is the
correct way to get this to work?

Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Reverse routing question

2009-04-17 Thread toby1kenobi

Hi there,

  Looking through various bits of information on reverse routing,
particularly the manual and this great article:

http://debuggable.com/posts/new-router-goodies:480f4dd6-4d40-4405-908d-4cd7cbdd56cb

I think I'm more or less on top of things, but have one oddity. I have
a route like this:

Router::connect(
'/admin/:site_id/:site_name/users/edit/:id',
array('controller' => 'users', 'action' => 'edit', 'admin' =>
true),
array('pass' => array('id', 'site_id', 'site_name')));

that routes links like this to the edit action of my user controller:

/admin/1/My_New_Site/users/edit/1

  When I try to create links like this, however:

echo $html->link('CakePHP Rocks', array(
'site_id' => 1,
'site_name' => Inflector::slug('My New Site'),
'controller' => 'users',
'action' => 'edit',
));

I get a  link like this:

/admin/user/edit/site_id:1/site_name:My_New_Site

which doesn't work. What am I doing wrong? I have worked around this
using Router:url in a static function, like in Feliix's article
(above).

  Thanks,

Toby
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing question

2008-04-18 Thread Joshua McFarren

I think this is possible through a combination of altering your
bootstrap and routes. Heres some ideas to get you started:
http://bakery.cakephp.org/tags/view/subdomain

Let us know if you have any success!

Cheers,
Joshua

On Apr 16, 10:44 am, MonkeyGirl <[EMAIL PROTECTED]> wrote:
> > I need to acces a controller action
> > through a subdomain. I mean, if the user browse to jose.domain.com, it needs
> > to be the same  aswww.domail.com/profiles/view/jose(where
> > controller=profiles, action=view, param1=jose)
>
> I could be wrong, but I think that's not really possible. For a start,
> you would need to register the hostname/subdomain for each and every
> param1 in your database. I'm guessing this is a list of your users, in
> which case, each time someone signs up for an account on your site,
> you'd need to update your DNS server with their username added in as
> another hostname in your domain.
>
> Zoe.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing question

2008-04-16 Thread MonkeyGirl

> I need to acces a controller action
> through a subdomain. I mean, if the user browse to jose.domain.com, it needs
> to be the same  as www.domail.com/profiles/view/jose(where
> controller=profiles, action=view, param1=jose)

I could be wrong, but I think that's not really possible. For a start,
you would need to register the hostname/subdomain for each and every
param1 in your database. I'm guessing this is a list of your users, in
which case, each time someone signs up for an account on your site,
you'd need to update your DNS server with their username added in as
another hostname in your domain.

Zoe.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Routing question

2008-04-16 Thread Jose Selesan
Hi people, I have another question. I need to acces a controller action
through a subdomain. I mean, if the user browse to jose.domain.com, it needs
to be the same  as www.domail.com/profiles/view/jose (where
controller=profiles, action=view, param1=jose)

Somebody can helpme with route rules?
Thanks in advance

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing Question

2008-03-07 Thread Walker Hamilton

Router::connect('/browse/:state/:city/*', array('controller' =>
'browse',
'action' => 'index'));

Then $this->params['state'] & $this->params['city'] should be
available.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Routing Question

2008-03-07 Thread Kyle Decot

I am building a directory website and I would like to have my URL's in
the following way:

http://www.theskateparkdirectory/browse/(*State*)/(*City*)/

I have set up my routing in the following way:

Router::connect('/browse/(.*)/(.*)/*', array('controller' => 'browse',
'action' => 'index'));

My quest is I wasnt to get the first variable as $state and the second
as $city. How do I do this?

Thanks for the help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing Question how to use Router::connect('/') with session_id?

2008-01-30 Thread sanemat

Capturing sessionID with a route is my wrong knowledge as you say.
I understand sessionID is not url but GET query.
And (in my controller) $this->Session->read() is automatically read
session value from GET query sessionID.
Thank you.

> the issue you're seeing has been fixed there.
'the issue' is what's issue?
update to 1.2.x.x rev6418, but I get same error.
when I access '/?CAKEPHP=e233bd9c1facda8084d8ba2f2226eb60'
I get this error:
Error: CAKEPHPe233bd9c1facda8084d8ba2f2226eb60Controller could not be
found.

'the issue' is not this?
Sorry to keep asking questions.

On Jan 29, 9:45 am, nate <[EMAIL PROTECTED]> wrote:
> You can't capture the session ID with a route, because it's a GET
> variable, it's not part of the URL.  Try $_GET['CAKEPHP'] or (in your
> controller) $this->params['url']['CAKEPHP'].
>
> Also, update to the latest branch code, because the issue you're
> seeing has been fixed there.
>
> On Jan 28, 11:52 pm, sanemat <[EMAIL PROTECTED]> wrote:
>
> > Thank you for your reply.
>
> > I use cookie to use session for visitor who accept cookie.
> > The way use sessionIDs in the URL is bad as you say, but most of
> > mobilephone users in my country can not accept cookie.
> > And 'set use_trans_sid=1' adds sessionID in all url link for my site.
>
> > On Jan 29, 1:53 am, MrTufty <[EMAIL PROTECTED]> wrote:
>
> > > I might not be understanding this properly - but WHY would you want to
> > > stick session IDs in the URL? It's just about the worst thing you
> > > could ever do for SEO.
>
> > > Steve
>
> > > On Jan 28, 12:38 pm, sanemat <[EMAIL PROTECTED]> wrote:
>
> > > > I am wordering how to get url to work:
> > > > /?CAKEPHP=session_id
>
> > > > Here is my route in app/config/routes.php:
> > > > Router::connect('/', array('controller' => 'pages', 'action' =>
> > > > 'display'));
>
> > > > When I access '/', it call '/pages/display', As I expected.
> > > > But when I set disable cookie and set use_trans_sid=1, I get problem.
> > > > In my expectation, '/?CAKEPHP=session_id' call '/pages/display/?
> > > > CAKEPHP=session_id'.
>
> > > > Contrary my expectation, when I access '/?
> > > > CAKEPHP=e233bd9c1facda8084d8ba2f2226eb60'
> > > > I get this error:
> > > > Error: CAKEPHPe233bd9c1facda8084d8ba2f2226eb60Controller could not be
> > > > found.
>
> > > > Please tell me how to get url to work '/?CAKEPHP=session_id'.
> > > > I use CakePHP 1.2.x.x
>
> > > > thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing Question how to use Router::connect('/') with session_id?

2008-01-29 Thread nate

You can't capture the session ID with a route, because it's a GET
variable, it's not part of the URL.  Try $_GET['CAKEPHP'] or (in your
controller) $this->params['url']['CAKEPHP'].

Also, update to the latest branch code, because the issue you're
seeing has been fixed there.

On Jan 28, 11:52 pm, sanemat <[EMAIL PROTECTED]> wrote:
> Thank you for your reply.
>
> I use cookie to use session for visitor who accept cookie.
> The way use sessionIDs in the URL is bad as you say, but most of
> mobilephone users in my country can not accept cookie.
> And 'set use_trans_sid=1' adds sessionID in all url link for my site.
>
> On Jan 29, 1:53 am, MrTufty <[EMAIL PROTECTED]> wrote:
>
> > I might not be understanding this properly - but WHY would you want to
> > stick session IDs in the URL? It's just about the worst thing you
> > could ever do for SEO.
>
> > Steve
>
> > On Jan 28, 12:38 pm, sanemat <[EMAIL PROTECTED]> wrote:
>
> > > I am wordering how to get url to work:
> > > /?CAKEPHP=session_id
>
> > > Here is my route in app/config/routes.php:
> > > Router::connect('/', array('controller' => 'pages', 'action' =>
> > > 'display'));
>
> > > When I access '/', it call '/pages/display', As I expected.
> > > But when I set disable cookie and set use_trans_sid=1, I get problem.
> > > In my expectation, '/?CAKEPHP=session_id' call '/pages/display/?
> > > CAKEPHP=session_id'.
>
> > > Contrary my expectation, when I access '/?
> > > CAKEPHP=e233bd9c1facda8084d8ba2f2226eb60'
> > > I get this error:
> > > Error: CAKEPHPe233bd9c1facda8084d8ba2f2226eb60Controller could not be
> > > found.
>
> > > Please tell me how to get url to work '/?CAKEPHP=session_id'.
> > > I use CakePHP 1.2.x.x
>
> > > thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing Question how to use Router::connect('/') with session_id?

2008-01-28 Thread sanemat

Thank you for your reply.

I use cookie to use session for visitor who accept cookie.
The way use sessionIDs in the URL is bad as you say, but most of
mobilephone users in my country can not accept cookie.
And 'set use_trans_sid=1' adds sessionID in all url link for my site.

On Jan 29, 1:53 am, MrTufty <[EMAIL PROTECTED]> wrote:
> I might not be understanding this properly - but WHY would you want to
> stick session IDs in the URL? It's just about the worst thing you
> could ever do for SEO.
>
> Steve
>
> On Jan 28, 12:38 pm, sanemat <[EMAIL PROTECTED]> wrote:
>
> > I am wordering how to get url to work:
> > /?CAKEPHP=session_id
>
> > Here is my route in app/config/routes.php:
> > Router::connect('/', array('controller' => 'pages', 'action' =>
> > 'display'));
>
> > When I access '/', it call '/pages/display', As I expected.
> > But when I set disable cookie and set use_trans_sid=1, I get problem.
> > In my expectation, '/?CAKEPHP=session_id' call '/pages/display/?
> > CAKEPHP=session_id'.
>
> > Contrary my expectation, when I access '/?
> > CAKEPHP=e233bd9c1facda8084d8ba2f2226eb60'
> > I get this error:
> > Error: CAKEPHPe233bd9c1facda8084d8ba2f2226eb60Controller could not be
> > found.
>
> > Please tell me how to get url to work '/?CAKEPHP=session_id'.
> > I use CakePHP 1.2.x.x
>
> > thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing Question how to use Router::connect('/') with session_id?

2008-01-28 Thread sanemat

Thank you for your reply.
But '/*' matches all url like '/posts/add' '/comments/edit/2', all
request calls '/pages/display'.

And I tried this.
Router::connect('/:sesseionID', array('controller' => 'pages',
'action' => 'display', '?' => 'sessionID'), array('sessionID' => '(?:\?
(.*))'));

I try capturing sessionID.
But I get another error:
Warning (2): strpos() [function.strpos]: Empty delimiter. [CORE\cake
\dispatcher.php, line 607]

On Jan 28, 11:52 pm, Marcin Jaworski <[EMAIL PROTECTED]> wrote:
> Have you tried this?
> ---cut here---
> Router::connect('/', array('controller' => 'pages', 'action' =>
> 'display'));
> Router::connect('/*', array('controller' => 'pages', 'action' =>
> 'display'));
> ---cut here---
>
> On 28 Sty, 13:38, sanemat <[EMAIL PROTECTED]> wrote:
>
> > I am wordering how to get url to work:
> > /?CAKEPHP=session_id
>
> > Here is my route in app/config/routes.php:
> > Router::connect('/', array('controller' => 'pages', 'action' =>
> > 'display'));
>
> > When I access '/', it call '/pages/display', As I expected.
> > But when I set disable cookie and set use_trans_sid=1, I get problem.
> > In my expectation, '/?CAKEPHP=session_id' call '/pages/display/?
> > CAKEPHP=session_id'.
>
> > Contrary my expectation, when I access '/?
> > CAKEPHP=e233bd9c1facda8084d8ba2f2226eb60'
> > I get this error:
> > Error: CAKEPHPe233bd9c1facda8084d8ba2f2226eb60Controller could not be
> > found.
>
> > Please tell me how to get url to work '/?CAKEPHP=session_id'.
> > I use CakePHP 1.2.x.x
>
> > thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing Question how to use Router::connect('/') with session_id?

2008-01-28 Thread MrTufty

I might not be understanding this properly - but WHY would you want to
stick session IDs in the URL? It's just about the worst thing you
could ever do for SEO.

Steve

On Jan 28, 12:38 pm, sanemat <[EMAIL PROTECTED]> wrote:
> I am wordering how to get url to work:
> /?CAKEPHP=session_id
>
> Here is my route in app/config/routes.php:
> Router::connect('/', array('controller' => 'pages', 'action' =>
> 'display'));
>
> When I access '/', it call '/pages/display', As I expected.
> But when I set disable cookie and set use_trans_sid=1, I get problem.
> In my expectation, '/?CAKEPHP=session_id' call '/pages/display/?
> CAKEPHP=session_id'.
>
> Contrary my expectation, when I access '/?
> CAKEPHP=e233bd9c1facda8084d8ba2f2226eb60'
> I get this error:
> Error: CAKEPHPe233bd9c1facda8084d8ba2f2226eb60Controller could not be
> found.
>
> Please tell me how to get url to work '/?CAKEPHP=session_id'.
> I use CakePHP 1.2.x.x
>
> thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing Question how to use Router::connect('/') with session_id?

2008-01-28 Thread Marcin Jaworski

Have you tried this?
---cut here---
Router::connect('/', array('controller' => 'pages', 'action' =>
'display'));
Router::connect('/*', array('controller' => 'pages', 'action' =>
'display'));
---cut here---

On 28 Sty, 13:38, sanemat <[EMAIL PROTECTED]> wrote:
> I am wordering how to get url to work:
> /?CAKEPHP=session_id
>
> Here is my route in app/config/routes.php:
> Router::connect('/', array('controller' => 'pages', 'action' =>
> 'display'));
>
> When I access '/', it call '/pages/display', As I expected.
> But when I set disable cookie and set use_trans_sid=1, I get problem.
> In my expectation, '/?CAKEPHP=session_id' call '/pages/display/?
> CAKEPHP=session_id'.
>
> Contrary my expectation, when I access '/?
> CAKEPHP=e233bd9c1facda8084d8ba2f2226eb60'
> I get this error:
> Error: CAKEPHPe233bd9c1facda8084d8ba2f2226eb60Controller could not be
> found.
>
> Please tell me how to get url to work '/?CAKEPHP=session_id'.
> I use CakePHP 1.2.x.x
>
> thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Routing Question how to use Router::connect('/') with session_id?

2008-01-28 Thread sanemat

I am wordering how to get url to work:
/?CAKEPHP=session_id

Here is my route in app/config/routes.php:
Router::connect('/', array('controller' => 'pages', 'action' =>
'display'));

When I access '/', it call '/pages/display', As I expected.
But when I set disable cookie and set use_trans_sid=1, I get problem.
In my expectation, '/?CAKEPHP=session_id' call '/pages/display/?
CAKEPHP=session_id'.

Contrary my expectation, when I access '/?
CAKEPHP=e233bd9c1facda8084d8ba2f2226eb60'
I get this error:
Error: CAKEPHPe233bd9c1facda8084d8ba2f2226eb60Controller could not be
found.

Please tell me how to get url to work '/?CAKEPHP=session_id'.
I use CakePHP 1.2.x.x

thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: 1.2 Routing question..

2007-11-30 Thread chad

Thanks..getting warmer. however why does it put it as a named param in
url?

if I do:

Router::connectNamed(array('project_name'));
Router::connect('/projects/:project_name/:action/*',
array('controller' => 'projects'), array('project_name' => '[-_a-zA-Z]
+'));

in view:
echo $html->url(array('project_name'=>$projects['Project']
['cat_name'], 'controller'=>'projects','action'=>'view')).'/'.
$projects['ProjectOverview']['slug'];

returns:
/projects/resales/view/project_name:resales/resales.html

what i'm looking for:
/projects/resales/view/resales.html

or even better -

/projects/resales/resales.html // view action
/projects/resales/overview.html // overview action
/projects/resales/maps.html // map action

Thanks again

On Nov 30, 5:49 pm, Aaron  Shafovaloff <[EMAIL PROTECTED]> wrote:
> Router::connectNamed(array('project_name'));
>
> Router::connect('/project/:project_name/*');
>
> That's a start
>
> On Nov 30, 1:27 pm, chad <[EMAIL PROTECTED]> wrote:
>
> > How could I achieve routing like so: /project/{project_name}/{action}/
> > * without any hacks in the controller? I have it working with some
> > hacks in the controller but would rather make it more dynamic in the
> > future and figured Router might help with that.
>
> > Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: 1.2 Routing question..

2007-11-30 Thread Aaron Shafovaloff

Router::connectNamed(array('project_name'));

Router::connect('/project/:project_name/*');

That's a start

On Nov 30, 1:27 pm, chad <[EMAIL PROTECTED]> wrote:
> How could I achieve routing like so: /project/{project_name}/{action}/
> * without any hacks in the controller? I have it working with some
> hacks in the controller but would rather make it more dynamic in the
> future and figured Router might help with that.
>
> Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



1.2 Routing question..

2007-11-30 Thread chad

How could I achieve routing like so: /project/{project_name}/{action}/
* without any hacks in the controller? I have it working with some
hacks in the controller but would rather make it more dynamic in the
future and figured Router might help with that.

Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing Question

2007-11-21 Thread Walker Hamilton

But how do you keep the prefix from cascading down to following routes?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing Question

2007-11-20 Thread releod

Great, thanks Grant.

I actually started using 1.2.x.x instead, and managed to figure it out
as well.


On Nov 19, 11:44 pm, Grant Cox <[EMAIL PROTECTED]> wrote:
> Router::connect('/admin/logout', array('controller' => 'home',
> 'action' => 'logout', 'prefix'=>'admin'));
>
> On Nov 20, 8:11 am, releod <[EMAIL PROTECTED]> wrote:
>
> > Hey, just installed my first CakePHP application today.
>
> > I am wondering how to get url to work in the browser:
> > /admin/logout
>
> > Here is my route:
> > $Route->connect('/admin/logout', array('controller' => 'home',
> > 'action' => 'admin_logout'));
>
> > I get this error:
> > Private Method in HomeController
> > You are seeing this error because the private class method
> > admin_logout should not be accessed directly
>
> > My question is how do I get the url to look like /admin/logout, the
> > logout method is simply going to end the session and redirect
> > somewhere, so it does not require a view file.
>
> > Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing Question

2007-11-19 Thread Grant Cox

Router::connect('/admin/logout', array('controller' => 'home',
'action' => 'logout', 'prefix'=>'admin'));

On Nov 20, 8:11 am, releod <[EMAIL PROTECTED]> wrote:
> Hey, just installed my first CakePHP application today.
>
> I am wondering how to get url to work in the browser:
> /admin/logout
>
> Here is my route:
> $Route->connect('/admin/logout', array('controller' => 'home',
> 'action' => 'admin_logout'));
>
> I get this error:
> Private Method in HomeController
> You are seeing this error because the private class method
> admin_logout should not be accessed directly
>
> My question is how do I get the url to look like /admin/logout, the
> logout method is simply going to end the session and redirect
> somewhere, so it does not require a view file.
>
> Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Routing Question

2007-11-19 Thread releod

Hey, just installed my first CakePHP application today.

I am wondering how to get url to work in the browser:
/admin/logout

Here is my route:
$Route->connect('/admin/logout', array('controller' => 'home',
'action' => 'admin_logout'));

I get this error:
Private Method in HomeController
You are seeing this error because the private class method
admin_logout should not be accessed directly



My question is how do I get the url to look like /admin/logout, the
logout method is simply going to end the session and redirect
somewhere, so it does not require a view file.

Thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: admin routing question

2007-10-19 Thread rtconner

gratzi

On Oct 19, 5:41 pm, AD7six <[EMAIL PROTECTED]> wrote:
> On Oct 20, 1:03 am, rtconner <[EMAIL PROTECTED]> wrote:
>
> > Does anyone know, is there a way to code the following behavior
>
> > typinghttp://site.com/adminrouteintothe browser will render a 404
>
> > then i set up apache to directhttp://admin.site.comtopoint to the
> > admintroute folder and this is where the admin stie would reside.
>
> > thanks,
> > rob
>
> http://bakery.cakephp.org/articles/view/hosting-admin-urls-on-a-subdo...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: admin routing question

2007-10-19 Thread AD7six



On Oct 20, 1:03 am, rtconner <[EMAIL PROTECTED]> wrote:
> Does anyone know, is there a way to code the following behavior
>
> typinghttp://site.com/adminrouteinto the browser will render a 404
>
> then i set up apache to directhttp://admin.site.comto point to the
> admintroute folder and this is where the admin stie would reside.
>
> thanks,
> rob

http://bakery.cakephp.org/articles/view/hosting-admin-urls-on-a-subdomain


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



admin routing question

2007-10-19 Thread rtconner

Does anyone know, is there a way to code the following behavior

typing http://site.com/adminroute into the browser will render a 404

then i set up apache to direct http://admin.site.com to point to the
admintroute folder and this is where the admin stie would reside.

thanks,
rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cake PHP routing question

2007-08-02 Thread Geoff Ford

You shouldn't need to do anything just navigate to http://domain.com/sub_folder
and it should be ready to go. Cake is happy to run in a subfolder.

Unless I am missing something that you are trying to do?

Geoff
--
http://lemoncake.wordpress.com

On Aug 3, 12:32 am, Vince <[EMAIL PROTECTED]> wrote:
> Hi all
>
> I have a question for the community : cakephp is not installed in the
> document root folder of my apache server. eg the document root folder
> is www and cake was installed in www/sub_folder. I found an article
> (http://www.chriscassell.net/log/2006/07/27/how_to_install_.html)
> which explains step by step what I should do to configure cake
> properly but the problem is it uses aliases and I cannot edit the
> httpd.conf file of the apache server.
>
> Anyone has a clue what I should do to configure cake properly ?
>
> Thank you,
>
> Vincent


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Cake PHP routing question

2007-08-02 Thread Vince

Hi all

I have a question for the community : cakephp is not installed in the
document root folder of my apache server. eg the document root folder
is www and cake was installed in www/sub_folder. I found an article
(http://www.chriscassell.net/log/2006/07/27/how_to_install_.html)
which explains step by step what I should do to configure cake
properly but the problem is it uses aliases and I cannot edit the
httpd.conf file of the apache server.

Anyone has a clue what I should do to configure cake properly ?

Thank you,

Vincent


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: routing question: how to pass by a specific directory

2007-05-08 Thread [EMAIL PROTECTED]

Did you put the "other app" in the cake root, or in the webroot
folder? If you put it in webroot, then you should be able to access it
normally, without any config changes.

so if you have this structure:
cake/app/webroot/my_other_app
then your app is accessible via:
www.example.com/my_other_app/



On May 8, 11:01 am, jyrgen <[EMAIL PROTECTED]> wrote:
> hi,
> i have my cake app installed in the webroot dir of a server.
> how can configure cake's routing (or the mod_rewrite rules
> in the .htaccess files) so that a certain directory, also lying
> in root, and therefore in cake's scope, can be accessed ?
> i'm asking this because i want to install another app, besides
> the cake app, but as soon as i try to access that second app,
> i get missing controller errors, auth problems and such.
> thanks, jyrgen


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



routing question: how to pass by a specific directory

2007-05-08 Thread jyrgen

hi,
i have my cake app installed in the webroot dir of a server.
how can configure cake's routing (or the mod_rewrite rules
in the .htaccess files) so that a certain directory, also lying
in root, and therefore in cake's scope, can be accessed ?
i'm asking this because i want to install another app, besides
the cake app, but as soon as i try to access that second app,
i get missing controller errors, auth problems and such.
thanks, jyrgen


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing Question

2006-10-25 Thread francky06l

I forgot, you also have the $viewpath variable that you can change to
use the same "views" names but in another directory.

On Oct 25, 11:08 pm, "francky06l" <[EMAIL PROTECTED]> wrote:
> I had the same problem but I choose another way to solve this .. I have
> considered your approach and I did give name to my views in the form
> "en_viewname" or whatever "langage_viewname". For this you can automate
> this into the beforeRender and stick the "langage" letters before
> rendering the views (I was using the Session to save the current
> lengage).
> The main problem in this is to maintain multiple views.
>
> On Oct 25, 10:03 pm, "[EMAIL PROTECTED]"
>
> <[EMAIL PROTECTED]> wrote:
> > Hi All,
>
> > I am trying to build a multilingual site and want the urls to be
>
> > example.com/lang/controller/action
>
> > example.com/en/controller/action
>
> > where the lang could be anythinghow to achieve this?
> 
> > thanx
> > sandosh


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Routing Question

2006-10-25 Thread francky06l

I had the same problem but I choose another way to solve this .. I have
considered your approach and I did give name to my views in the form
"en_viewname" or whatever "langage_viewname". For this you can automate
this into the beforeRender and stick the "langage" letters before
rendering the views (I was using the Session to save the current
lengage).
The main problem in this is to maintain multiple views.



On Oct 25, 10:03 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I am trying to build a multilingual site and want the urls to be
>
> example.com/lang/controller/action
>
> example.com/en/controller/action
>
> where the lang could be anythinghow to achieve this?
> 
> thanx
> sandosh


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Routing Question

2006-10-25 Thread [EMAIL PROTECTED]

Hi All,

I am trying to build a multilingual site and want the urls to be

example.com/lang/controller/action

example.com/en/controller/action

where the lang could be anythinghow to achieve this?

thanx
sandosh


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Routing question

2006-08-16 Thread Jon Bennett

> The other thing you could do is accept the parameters explicitly, as
> in:
>
> function index($category = null, $page = null) {
>// ...
> }
>
> Makes handling the var switching a little easier IMO.

I would still need to split the url from the params though, as I need
the route for certain pages, but not for others, because I have say a
news_controller, reports_controller as well, which both have their own
routes

jb

-- 


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Routing question

2006-08-16 Thread nate

The other thing you could do is accept the parameters explicitly, as
in:

function index($category = null, $page = null) {
   // ...
}

Makes handling the var switching a little easier IMO.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Routing question

2006-08-16 Thread Jon Bennett

> ahh, got ya, haev found a workaround, which seems to work fine, what
> do you think?
>
> function index ()
> {
>  (!empty($args[0])) ? $category = $args[0]: $category = null;
>  (!empty($args[1])) ? $handle = $args[1]: $handle = null;
>  (!empty($args[2])) ? $subHandle = $args[2]: $subHandle = null;
> }
>

woops, forgot how to show how was I getting $args

$args = explode ('/', $this->params['url']['url']);

hehe

jon

-- 


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Routing question

2006-08-16 Thread Jon Bennett

> This route, on the other hand:
> $Route->connect ('/who_we_are/*', array('controller' => 'pages',
> 'action' => 'index', 'who_we_are'));
> still matches /who_we_are/, but it also matches anything after it.  The
> problem is, the two routes are effectively the same.  All you're doing
> by passing 'who_we_are' as the default value is telling the router to
> pass that as the default value if no other value is specified.
> Unfortunately, you can't do both-and.

ahh, got ya, haev found a workaround, which seems to work fine, what
do you think?

function index ()
{
 (!empty($args[0])) ? $category = $args[0]: $category = null;
 (!empty($args[1])) ? $handle = $args[1]: $handle = null;
 (!empty($args[2])) ? $subHandle = $args[2]: $subHandle = null;
}

I can then use the route below which works fine:

$Route->connect ('/who_we_are/*', array('controller' => 'pages',
'action' => 'index','who_we_are'));

hopefully should be easy to rework when 1.2 is out.

thanks,

jon

-- 


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Routing question

2006-08-16 Thread nate

The who_we_are part vanishes from the URL because you specified it as a
static element within your route.

This route:
$Route->connect ('/who_we_are/', array('controller' => 'pages',
'action' => 'index','who_we_are'));
matches your first URL (/who_we_are/) because you have who_we_are and
nothing after it.  The only reason 'who_we_are' shows up in the
parameters is because you're passing it manually in the route.

This route, on the other hand:
$Route->connect ('/who_we_are/*', array('controller' => 'pages',
'action' => 'index', 'who_we_are'));
still matches /who_we_are/, but it also matches anything after it.  The
problem is, the two routes are effectively the same.  All you're doing
by passing 'who_we_are' as the default value is telling the router to
pass that as the default value if no other value is specified.
Unfortunately, you can't do both-and.

Hope that makes sense.

The light at the end of the tunnel is that I'm working on the Router
for Cake 1.2 this week, and the new enhancements will let you specify
more sophisticated matching rules.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Routing question

2006-08-16 Thread nate

The who_we_are part vanishes from the URL because you specified it as a
static element within your route.

This route:
$Route->connect ('/who_we_are/', array('controller' => 'pages',
'action' => 'index','who_we_are'));
matches your first URL (/who_we_are/) because you have who_we_are and
nothing after it.  The only reason 'who_we_are' shows up in the
parameters is because you're passing it manually in the route.

This route, on the other hand:
$Route->connect ('/who_we_are/*', array('controller' => 'pages',
'action' => 'index', 'who_we_are'));
still matches /who_we_are/, but it also matches anything after it.  The
problem is, the two routes are effectively the same.  All you're doing
by passing 'who_we_are' as the default value is telling the router to
pass that as the default value if no other value is specified.
Unfortunately, you can't do both-and.

Hope that makes sense.

The light at the end of the tunnel is that I'm working on the Router
for Cake 1.2 this week, and the new enhancements will let you specify
more sophisticated matching rules.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Routing question

2006-08-16 Thread Jon Bennett

Hi,

I have a few controllers, Pages (custom),News,Reports etc and on the
front end I'd like to loose the method names from my URLs, eg:

www.mydomain.com/news/category/category_name
becomes
www.mydomain.com/news/category_name

and

www.mydomain.com/news/article/article_name
becomes
www.mydomain.com/news/category_name/article_name

I have this working fine for some controllers using the following route:

$Route->connect ('/news/*', array('controller' => 'news', 'action' => 'index'));

Where I'm coming unstuck is with my Pages controller. Each page
belongs to a category, and I'm using a url friendly version of the
categories name, followed by the same for the artlicles name within my
index function. This works fine if I use a route like so:

$Route->connect ('/pages/*', array('controller' => 'news', 'action' =>
'index'));

with that I can do:

www.mydomain.com/pages/category_name/page_name

what I'm trying to do is loose the 'pages' part of the url, because
the category title signifies the seciton of the site (much in the same
way that 'news' or 'reports' does), and I like to keep things
uniformed.

I've since tried doing:

$Route->connect ('/who_we_are/', array('controller' => 'pages',
'action' => 'index','who_we_are'));
$Route->connect ('/who_we_are/*', array('controller' => 'pages',
'action' => 'index','who_we_are'));

but this only gives me one of the arguments from the URL, not both, eg
if I debug(func_get_args($this)) at the top of my index() method:

www.mydomain.com/who_we_are
gives me:
[0] => who_we_are

and

www.mydomain.com/who_we_are/company_history
gives me:
[0] => company_history

as you can see, 'who_we_are' has vanished from the url!

I'm not sure if what I'm attempting is possible or not, but I sure hope it is!

many thanks,

Jon

-- 


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Advanced Routing question/ 疑问

2006-07-30 Thread AD7six

Having mod_rewrite loaded isn't the only thing necessary to permit you
to use pretty urls.

You probably need to set AllowOverride All in your http.conf file.

HTH,

AD7six


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Advanced Routing question/ 疑问

2006-07-29 Thread JitZhang


- /app/webroot/phpinfo.php
http://192.168.0.1/phpinfo.php
is OK

-httpd.conf
LoadModule rewrite_module modules/mod_rewrite.so
is work

still cann't move of "index.php"in URL
how let "http://192.168.0.1/edit/accounts " is OK?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Advanced Routing question/ 疑问

2006-07-29 Thread John Zimmerman [gmail]
I believe this would mean that either one or more of your .htaccess files are missing or mod_rewrite is not working.There are 3 .htaccess files/.htacess/app/.htaccess/app/webroot/.htaccess
Check to make sure they are all present and are readable by the webserver.If all are present and readable check to make sure mod_rewrite is enabled and configured properly.You can get your settings for PHP with the phpinfo() function.
On 7/29/06, JitZhang <[EMAIL PROTECTED]> wrote:
我配了/setingCAKE_ADMIN = 'edit'http://192.168.0.1/index.php/edit/accounts这个行/this is  OKhttp://192.168.0.1/edit/accounts
这个行不行/no ok不知怎么能去掉"index.php"?/how to move of "index.php"in URL望给我回信帮助!/help?thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---



Advanced Routing question/ 疑问

2006-07-29 Thread JitZhang

我配了/seting

CAKE_ADMIN = 'edit'

http://192.168.0.1/index.php/edit/accounts
这个行/this is  OK
http://192.168.0.1/edit/accounts
这个行不行/no ok

不知怎么能去掉"index.php"?/how to move of "index.php"in URL
望给我回信帮助!/help?
thanks!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Routing question

2006-07-26 Thread Grant Cox

Well, if you just want to use routes, how about:

$Route->connect('/site1/:controller/:action/*', array('site_config' =>
'site1'));
$Route->connect('/site2/:controller/:action/*', array('site_config' =>
'site2'));

And then in your app/app_controller.php you could have a beforeFilter
to set the appropriate configuration based on which site is being
requested.

function beforeFilter()
{
if ( isset($this->params['site_config']) ){
switch($this->params['site_config']){
case "site1":
case "site2":
}
}
}


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Routing question

2006-07-26 Thread Matt2012

Hi Id like to install cake and app directories in the default places
but have another folder -> sites at the same level as those two which
contains site1,site2,.. if I point my site at mysite.com/site1 OR
mysite.com/site2 etc I want to see exactly what I would see for
mysite.com.

so, mysite.com/help/view/7 would show the same as
mysite.com/site1/help/view/7

I suppose I could achieve this with curl but a router solution would
appear neater.

The second stage would be to have a seperate config file for site1,
site2,.. so that actually each site shows something different but based
on the same CAKE insatllation AND the same APP installation.

This way I have only one code base and many sites. The third step is to
use curl or domain mapping to point http://www.site1.com to
http://www.mysite.com/site1.

Has anyone any ideas on how I might achieve,
1) The internal mapping  mysite.com/site1 = mysite.com
2) The external mapping site1.com = mysite.com/site1

I realise you could miss out step 1 potentially but Id rather be able
to develop site1 without needing site1.com

Any comments gratefully received.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---