Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Upgrading SilverStripe

Ask questions about upgrading SilverStripe to the latest version.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Upgrade problem : I can't handle sub-URLs of a xxxx object


Go to End
Reply

16 Posts   5482 Views

Avatar
Fuzz10

19 March 2009 at 12:02am Community Member, 787 Posts

I'm trying to upgrade quite a large site from 2.2 to 2.3 , but it seems some changes have been made to the way Silverstripe handles URLS.

For SEO purposes , we fake URL nesting by putting keywords and categories in the URL for specific pages , e.g. ;

www.blabla.com/details/category1/category2/category3/category4?actual_id=92932

Silverstripe 2.2. just ignored the category1/category2/category3/category4 bit , and called the page with URL segment /details .. I could then take the "actual_id" value from the $_REQUEST array and fill the template with data accordingly.

This worked pretty well for us , but Silverstripe 2.3 refuses to play nice. It throws a :

" I can't handle sub-URLs of a xxxx object" error.

I cannot figure out how to get the site going while keeping the same URL layout.

Help ! ;-)

Avatar
Fuzz10

19 March 2009 at 1:16am Community Member, 787 Posts

Update :

Did some diggin' , and the new

RequestHandler is the culprit...

More specific , the function handleRequest($request) , throws the error.....

Seems like it needs a little core-hack ....

Avatar
Fuzz10

19 March 2009 at 9:48pm Community Member, 787 Posts

Okay...

To Force Silverstripe to ignore the rest of the URL, I ended up hacking the core.

in /sapphire/core/control/requesthandler.php

In the function HandleRequest() , I changed

// But if we have more content on the URL and we don't know what to do with it, return an error.
               } else {
                  return $this->httpError(400, "I can't handle sub-URLs of a $this->class object.");
               }

in to

// But if we have more content on the URL and we don't know what to do with it, return an error.
               } else {
                  return $result;
               }

Avatar
biapar

8 July 2009 at 9:26pm Forum Moderator, 435 Posts

I've the same error.

"I can't handle sub-URLs of a CMSMain object."

Is your hack ss safe?

Avatar
Fuzz10

8 July 2009 at 9:33pm Community Member, 787 Posts

Works for me .... It still discards the rest of the URL , but instead of throwing an error , it returns the needed result ...
I can't think of a serious security problem that might arise because of the change ...

Avatar
biapar

8 July 2009 at 9:48pm Forum Moderator, 435 Posts

I've the problem with this:

$imagetable = new ComplexTableField(
$this,
'ImageAttachments', // relation name
'ImageAttachment', // object class
ImageAttachment::$field_names, // fields to show in table
ImageAttachment::getCMSFields_forPopup(), // form that pops up for edit
"ProductID = {$this->ID}", // a filter to only display item associated with this page
"Name ASC" // Sort by name
);

When I click on "Add Image" ( see this old post: http://www.silverstripe.org/archive/show/212710#post212710 )

I don't know to resolve.

Thanks

Avatar
Fuzz10

8 July 2009 at 9:54pm Community Member, 787 Posts

That is a totally different situation than mine ..... I tried to manually add stuff to the URL and needed to prevent Silverstripe from throwing an error....

The error you are getting seems like a real one .... ;) When handling "many" relationships , I advise using UncleCheeses DOM module.

Avatar
biapar

8 July 2009 at 9:59pm Forum Moderator, 435 Posts

How?

Go to Top