replace it, added your debug code suggestion & this is the result:
URL address: http://localhost/links/add/http://www.youtube.com/watch%3Fv%3DvDVnuFxsfbE
URL passed to form currently: www.youtube.com
debug result:
array(8) { ["controller"]=> string(5) "links" ["action"]=> &string(3)
"add" ["named"]=> array(1) { ["http"]=> string(0) "" } ["pass"]=>
array(2) { [0]=> string(15) "www.youtube.com" [1]=> string(5) "watch"
} ["plugin"]=> NULL ["form"]=> array(0) { } ["url"]=> array(2) {
["url"]=> string(37) "links/add/http:/www.youtube.com/watch" ["v"]=>
string(11) "vDVnuFxsfbE" } ["models"]=> array(1) { [0]=> string(4)
"Link" } }
Current routing code:
Router::connect(
'/links/add/:url',
array(
'controller' => 'links',
'action' => 'add'
),
array(
//Looks for http://
'url' => '^http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$',
// passes it
'pass' => array('url')
)
);
------------
add.ctp:
echo $this->Form->input('Link.url', array('value' => $url, 'type' => 'text'));
Thanks!
S
On Thu, Dec 30, 2010 at 11:05 PM, john lyles <confidential99@gmail.com> wrote:
> You are certain you are passing data to the url correctly?
>
> On Dec 30, 9:27 pm, Steve Mallett <steve.mall...@gmail.com> wrote:
>> I don't think so. With or without echo var_dump($this->params) that results in:
>> Notice (8): Undefined index: action [CORE/cake/dispatcher.php, line 269]
>> Notice (8): Undefined index: controller [CORE/cake/dispatcher.php, line 121]
>>
>> S
>>
>>
>>
>>
>>
>>
>>
>> On Thu, Dec 30, 2010 at 10:15 PM, john lyles <confidentia...@gmail.com> wrote:
>> > Let me see if I get this: You have a url such as
>> >http://localhost/controller/action?url=http://www.example.com/page.html
>> > And all you need to do is populate the url into the form?
>> > If I understand the situation correctly then here is my simple
>> > solution:
>> > echo var_dump($this->params);
>> > This will return an array. What you need will be here.
>>
>> > On Dec 30, 8:39 pm, Steve Mallett <steve.mall...@gmail.com> wrote:
>> >> On Thu, Dec 30, 2010 at 9:26 PM, cricket <zijn.digi...@gmail.com> wrote:
>> >> > On Thu, Dec 30, 2010 at 8:21 PM, Steve Mallett <steve.mall...@gmail.com> wrote:
>> >> >> More on routing, I think, if I use an URL with a subdirectory ie.
>> >> >> example.com/dir the "\" appears to break the routing defaulting to
>> >> >> example.com. Any suggestions on dealing with that?
>>
>> >> > Are you escaping the URL, actually? You're going to have problems if not.
>>
>> >> Well, if I encode example.com/dir as example.com%2fdir cake appears to
>> >> turn it back into example.com/dir... at least in the browser address
>> >> bar (chrome), but still can't deal with it turning it into example.com
>> >> in $url
>>
>> >> > Again, why not just add the URL in the form instead of first passing
>> >> > it in the request URL?
>>
>> >> I'm trying to prepopulate the url via a bookmarklet which just makes
>> >> saving an URL in the form much faster & easier.
>>
>> >> S
>>
>> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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+unsubscribe@googlegroups.com For more options, visit this group athttp://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+unsubscribe@googlegroups.com For 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment