Well, I decided to do it a different way, but I did figure out how to stop
Cake from using the $_GET['url'] value.  It involves modifying the core and
I'm sure there is a better way, but in case anyone needs to do this in the
future

Keep in mind this has only been tested on an Apache 2 server with default
mod_rewrite rules.

There are two values which you must modify to change the key that cake uses
to pass the url (default is $_GET['url'] which is common and may cause
conflicts).

in your *app/webroot/.htaccess* change *line 5* from:
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
to
RewriteRule ^(.*)$ index.php?the_url=$1 [QSA,L]

then in your CORE/dispatcher.php change *line 593* from:
$url = $_GET['url'];
to
$url = $_GET['the_url'];

Now be aware that all throughout dispatcher.php there are references to
$_GET['url'].  When I tried to change all of them to $_GET['the_url'] I
could not get it to work, and by process of elimination I came to change the
line which I did.  so I'm sure there are instances where my little work
around will not work as intended.

On Sat, Nov 14, 2009 at 1:32 PM, David Roda <[email protected]> wrote:

> Hi everybody,
>
> This may be obvious to some, I'm pretty sure I remember reading about it
> previously, but I could not find the article I originally read.
>
> I am creating a "shareItem" action for a site I am working on.  This is
> pretty standard it just builds a URL for a public view of the item and sends
> it to, for example, delicious.
>
> A little tweak is that the client wants the shareItem link to open in a new
> window with a left frame with more sharing links, and load the originally
> selected sharing link in the right frame.
>
> To do this I am passing the selected sharing url as well as the item ID to
> the shareItem action, which then loads the left frame with sharing links
> based on the item id, and loads the selected sharing url into the right
> frame.
>
> the problem is passing the selected sharing URL as a GET parameter.  The
> link to the shareItem action looks similar to this
>
>
> http://localhost/charity/dashboard/shareHo/33/?u=http://delicious.com/save?v=5&noui&jump=close&url=http://localhost/charity/items/shareItem/33&title=Following%20a%20short%20recapture%20of%20the%20Italian%20peninsu
>
> the problem is that cake uses url= as a special keyword, but this is
> required for most of these sharing sites.  Here is the error I get when I
> load this url into my browser:
>  Missing Controller
>
> *Error: * *Http:Controller* could not be found.
>
> *Error: * Create the class *Http:Controller* below in file:
> charity/controllers/http:controller.php
>
> <?php
> class Http:Controller extends AppController {
>
>       var $name = 'Http:';
> }
> ?>
>
>  *Notice: * If you want to customize this error message, create
> charity/views/errors/missing_controller.ctp
>  Now I know this is because of the url=http:// line because when I modify
> url= to anything else, for example, test= then the link loads properly.
> Unfortunately then delicious doesn't get the url.  I have tried using the
> php method urlencode() on the url string but it does not help.
>
> Anyone have any idea?  Am I going at this in the totally wrong way?  I
> think I can work around by sending the "target site" (ie. facebook,
> delicious, digg) to the shareItem action and then build the link from in
> there), but I would like to know if there is a way to stop Cake from parsing
> that url= line.
>
> Thanks in advance for any comments, critiques, or suggestions!
>
> Dave
>

--

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected].
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=.


Reply via email to