17488 Posts in 4473 Topics by 1978 members
Page: 1 2
|Go to End||Next >|
15 August 2008 at 11:54am Last edited: 16 August 2008 8:28am
I needed to get nested URLs on a site I am making for a design company, using silverstripe.
I found this page and made the changes described. Now, when I go to a page on the site it says:
Parse error: syntax error, unexpected T_RETURN in /home/firemake/public_html/sapphire/core/control/ModelAsController.php on line 58
That is an entry that was added in the change:
"return $modelFinder::get_one('SiteTree', '`SiteTree`.URLSegment = \"$urlSegments[$currentSegment]\" AND `SiteTree`.ParentID = $model->ID');"
Anyone have any ideas?
The site is www.firemakerdesign.com.
15 August 2008 at 5:07pm
Could you post the code with a few lines before and after that line too?
It's a code syntax type error, rather than a SS error as such.
15 August 2008 at 5:19pm
Ahh.. had a look at the script. They're evaluating the object? Ouch.
I don't quite understand why they're doing it like that - maybe because they couldn't figure out the quote escaping?? Which seems unlikely considering the complexity of the solution.
See what happens if you replace the eval(...) with:
$modelFinder::get_one('SiteTree', '`SiteTree`.URLSegment = "'.$urlSegments[$currentSegment].'" AND `SiteTree`.ParentID = '.$model->ID);
15 August 2008 at 5:20pm
Although, reading the php documentation for eval, maybe they're testing if there is a parse error in that line - which is still a messed up way to do things.
15 August 2008 at 6:34pm
Thanks for your interest in my nested URL patch! Im the author of the code you mentioned. Firstly, id just like to say that you use this code at your own risk. I know it sounds cliche - but its completely untested and some of the more advanced functionality may break.
Firstly, your using the development version of the nested URL patch, which is now quite out of date. Im in the process of moving to a new site, and the new patch will be available there once i get my server working properly ;) For the time being, id reccomend using the non-dev version.
As for your problem: its not actually related to the eval() statement (which was a byproduct of me coding lazily ). Otherwise it would throw a different error. Instead, I think its a problem with how the patch was applied.
Instead of going through manually and adding and removing code, its best to use something like TortoiseSVN, and checkout the 2.2 branch of SilverStripe. Then you can click on your project, and select apply patch, and itll all be done automatically.
16 August 2008 at 1:25am
Thank you all for your responses!
I just grabbed TortoiseSVN, as well as the non-dev version of the patch.
I'll be messing with it now and hopefully have it up and running soon. Thank you all very much for your help. I'll post the results.
16 August 2008 at 2:11am
Ok, that program is nifty. However, I am having issues working getting it to patch the files.
I have silverstripe 2.2.2. I've never messed with the source files before now. I am using files that were backed up before I made the first changes for the nested url thing, so they are the originals.
When I try to apply the dif file, it pulls up the files necessary, but I cannot patch/preview them. I get an error that says "Could not retrieve revision 55074 of the file <my file path>/sapphire/core/control/Director.php. Patching is not possible."
According the the TortoiseSVN help area, that has to do with a version conflict. The way I understood it was that the patch file is to go from version 1 to version 2, but my file is version 1.4 or something (made up numbers).
Thank you all for you help.
Will that patch be making its way into an actual release in the near future?
16 August 2008 at 1:09pm
Hey there Seth,
I think what youll want to do is checkout the SilverStripe version that i created my patch against. To do that, create a folder called something like "nested" or whatever. Then right click on it -> SVN Checkout.
Enter http://svn.silverstripe.com/open/phpinstaller/trunk for the "URL of Repository", and then select "Revision" in the revision area, and enter 55074 in the text box. Thats the version my patch is create against. Once youve done this, just right click on your folder again, and go TortoiseSVN -> Apply Patch and select the patch.
As for making it into an actual release, not in its current form, as its quite hacky. Im working on a newer version though, so maybe a bit later down the track.
Page: 1 2
|Go to Top||Next >|