Re: Custom URLs

2007-05-07 Thread themanfrombucharest


Hey,

Try this on for size:

Router::connect('/:language/:controller/:action/*'); (cake 1.2.x.x)
$router-connect('/:language/:controller/:action/*'); (cake 1.1.x.x)

In your controllers and views the language will be available in $this-
params['language'].

The problem gets a bit tricky when you want to translate your
controller and action names.

On the other hand, if you don't need the language part in your URL's
you can try using the new i18n an l10n features in 1.2 (using the
locale).

Tell us a bit more about your requirements so that others can share
their solutions.

On May 6, 2:21 am, pierre.k [EMAIL PROTECTED] wrote:
 Hi,

 I am looking for a solution to the following problem: basically, I
 want urls in form /controller/action/params as well as /en/
 controller/action/params. The idea behind this is to allow for
 multiple languages (/en/... might as well be replaced with /cs/...
 and alike) and in ideal case, I would like the language identifier to
 be available as a global variable. This would allow me to use the
 variable in model (and also controller  view) classes, in the
 following fashion, for example:

 class Hotel extends AppModel {
   var $hasOne = array(HotelTxt = array(conditions =
 lang={lang}));

 }

 In other words, whenever an url like /cs/* or /en/* is
 encountered, I need to store the cs/en part into a global var and
 effectively go to url * instead. Can this be achieved via cakephp
 routing? Or should I approach to the problem in a completely different
 manner?

 Thanks for your ideas,
 Petr K.


--~--~-~--~~~---~--~~
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: Performance Time (debug variable)

2007-05-02 Thread themanfrombucharest

Actually it works with any library that sets the 'X-Requested-With'
HTTP header.

I'm using it successfully with jQuery in a current project.

Cheers!

On May 3, 2:13 am, Grant Cox [EMAIL PROTECTED] wrote:
 To the OP: just modify your index.php, removing the html comment.

 Robechar: the RequestHandler-isAjax only detects Prototype/
 Scriptaculous requests, not for any other libraries, and to change the
 debug you should probably use
 Configure::write('debug', 0);


--~--~-~--~~~---~--~~
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 and html helper

2007-05-02 Thread themanfrombucharest

If you're using 1.2 then maybe the new array based URL are what you
need:

$html-link('link', array('sitename' = 'a_site_name', 'controller' =
'posts', 'action' = 'index'));

On May 3, 1:54 am, gerbenzomp [EMAIL PROTECTED] wrote:
 I've changed the routes in my app, so that my paths are like this:

 $Route-connect(/:sitename/, array(controller = posts, action
 = index));

 and urls are like this:

 site.com/sitename/controller/action/

 But the html helper automatically creates links like this:

 site.com/controller/action/

 Is there a way I can adjust the html helper so that the current
 sitename is added to each link in the app?


--~--~-~--~~~---~--~~
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: Accessor like command in CakePHP

2007-03-22 Thread themanfrombucharest

Hey Justin,

In reply to your first question, no, there isn't anything like that in
cake yet.

So if you want accessors/mutators you have to write the functions
yourself. The main reason for this is because the ORM layer in cake
isn't fully object oriented yet (I understand it's planned for 2.0).

For your second question: you can check for the value of your checkbox
field in the controller action that receives the form submission and
after you're done with it just unset() it.

Hope this help!

On Mar 22, 2:32 am, Justin Hernandez [EMAIL PROTECTED] wrote:
   Thanks for the reply Grant. My problem is that I have a 'check here
 to accept' checkbox on my form. I want to associate it with my current
 model even though there is no corresponding column in the table.
 Because there is no column I get an incorrect index error in php. In
 rails if you use attr_accessor it creates a variable in the model
 which can be written and read to and from. Is there a equivalent in
 cakephp?
   Or should I just be lazy and create a column in the table. That way
 I can benefit from all the data validation, etc. Thanks.

 On Mar 21, 1:40 pm, Grant Cox [EMAIL PROTECTED] wrote:

  I don't know what the att_accessor is in RoR.  Perhaps what you want
  is the afterFind callback, where you can modify the data loaded from
  the db (including adding extra attributes).

  Justin Hernandez wrote:
   How can I add variables to a model without having a corresponding
   field in the table?  I'm looking for something like the attr_accessor
   in RoR. 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
-~--~~~~--~~--~--~---



url() with fragment identifier

2007-01-19 Thread themanfrombucharest


Hello,

I was wondering if there is a way to include a fragment identifier in a
URL generated with Router::url() using the new way of passing the url
in an array (cake 1.2dev)?

Thanks in advance!

P.S. if there isn't a way to do this I'll open an enhancement ticket on
trac
P.P.S I've read the code and there doesn't seem to be such an option,
so I just hacked it before line 490 before the return:

491 if (isset($url['fragment'])) {
492 $fragmentIdentifier = '#' . $url['fragment'];
493 } else {
494 $fragmentIdentifier = '';
495 }
496 return $output . $extension . $fragmentIdentifier .
$_this-queryString($q);


--~--~-~--~~~---~--~~
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: url() with fragment identifier

2007-01-19 Thread themanfrombucharest


btw,

on the following line you must also add 'fragment' to the skip array:

430 $skip = array('action', 'controller', 'plugin', 'ext', 
'?',
'fragment');


--~--~-~--~~~---~--~~
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: local configuration file

2006-12-08 Thread themanfrombucharest

Hi Felix,

Take a look at app/config/bootstrap.php. This is the application
specific bootstrap that gets called after cake's own bootstrap (it's
all in the comments) so you can use it to include everything you need.

You'll probably do something like:
if (file_exists(ROOT . 'myconfig.php')) {
  include_once ROOT . 'myconfig.php';
}

Btw, if you want to use other config files that you can place in
app/config you can use the config() function from cake/basics.php

Cheers!

On Dec 7, 7:46 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
 Hi there,

 The filter or config table idea sounds good, but I need it very simple!

 My folder structure looks like this:

 app
 cake
 vendorsindex.php
 myconfig.php

 In the myconfig.php I want to put all variables, including the
 Database connection in the /app/config/database.php. The customer needs
 a file, which he can find very fast. And all the important variables
 are in there.

 Could I maybe include the myconfig.php in the bootstrap.php?
 
 Can someone give me a hint?
 
 Thanks Felix


--~--~-~--~~~---~--~~
 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: Setting a variable for beforeFilter to catch?

2006-11-09 Thread themanfrombucharest

If I understood your explanation right then this is what happens:
the beforeFilter() method gets called before your action method so
$this-locked isn't set yet!
you could try to have a special class var for your controller that
stores the locked actions:

class EntriesController extends AppController {
var $locked = array('write', 'etc');
}

and then:

class AppController extends Controller {
function beforeFilter() {
if (isset($this-locked[$this-action])) {
//do your thing
}
}
}

On Nov 9, 1:39 pm, Bert Van den Brande [EMAIL PROTECTED] wrote:
 I think defining locked as a class instance var inside AppController
 should solve the warning ?

 On 11/9/06, Ismael S. Kafeltz [EMAIL PROTECTED] wrote:



  Cypher, i think you are right. This should work.

  I guess the problem is that you are *extends* the wrong class.
  Did you alter the /libs/controllers/app_control.php file? Or you
  created a new one in another place?


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---