3212 Posts in 847 Topics by 809 members
| Go to End | Next > | |
| Author | Topic: | 8826 Views |
-
Re: if and else_if with InSection()

27 March 2009 at 9:57am Last edited: 27 March 2009 9:58am
Decided to test straight away and had issues both with the latest SVN build of SS, and the patch. Decided to post here rather bog up the Trac entry in case I was doing something wrong.
Steps to duplicate errors:
1. Get latest SVN from http://svn.silverstripe.com/open/phpinstaller/trunk
2. Install SS as normal using Blackcandy Theme
3. Add following code to /themes/blackcandy/templates/Page.ss just above $Layout<% if InSection(home) %>
Home
<% else_if InSection(about-us) %>
About Us
<% else %>
Not Home or About Us
<% end_if %>
4. Check out the home page and about us page on new installation.ERRORS on SS Trunk
1. When on home page, not only is "Home" displayed by the above code, but the <% else_if InSection(about-us) %> statement is not parsed and "Home <% else_if InSection(about-us) %> About Us" is displayed on the page.2. When on about-us page, only "Not Home or About Us" is displayed.
The Patch
1. Apply patch with Tortoise SVN (Windows XP). /sapphire/core/SSViewer.php, /sapphire/tests/SSViewerTest.php and /cms/templates/Includes/CommentAdmin_SiteTree.ss all updated.
2. Go to home page and flush=1ERROR on Patch
Fatal error: Class 'TemplateParser' not found in C:\wamp\www\ss_latest\sapphire\core\SSViewer.php on line 405I havn't had time to go through the code to figure that out yet.
Cheers
Aaron -
Re: if and else_if with InSection()

27 March 2009 at 11:10am Last edited: 27 March 2009 11:11am
Aaron,
My bad. I forgot to include the template parser file in that patch file. Patch file revision 5 has been revised to include that file!
Does it work any better now?
Ben
-
Re: if and else_if with InSection()

27 March 2009 at 11:33am
No more fatal error. But there is a SS error there:
http://sandbox.ecomgroup.co.nz/aaron_ss/SS_TemplateParserStackTrace.htm (not live, just an HTML dump)
Occurs with or without the test template block in my previous post.
A little over my head without picking through the code and working out how this exactly works.
Cheers
Aaron -
Re: if and else_if with InSection()

28 March 2009 at 3:03am
Aaron,
This is valuable feedback. I think the problem is that my PHP install has a later version of the PCRE (Perl Compatible Regular Expressions) library which supports \g<name> syntax. I probably need to rework the expressions to not use that feature.
Would you be able to provide a copy of your server's phpinfo() output (at least the PHP version & PCRE info parts)? With that info, maybe I can find a matching PHP build for me to test on.
Thanks,
Ben -
Re: if and else_if with InSection()

28 March 2009 at 3:18am
In the mean time, I posted revision 5.1 which uses a different syntax style in the regular expressions. Maybe it will work on your PHP install.
Details:
Revision 5 used Oniguruma style subroutine calls; 5.1 uses Python's style.Ben
-
Re: if and else_if with InSection()

30 March 2009 at 9:46am
Hi Ben,
No luck there sorry. 5.1 fails to parse pretty much everything and just pumps out all the <% %> tags to browser.
I am using WAMP 2.0 on Windows XP.
http://sandbox.ecomgroup.co.nz/aaron_ss/phpinfo.htm
Cheers
Aaron -
Re: if and else_if with InSection()

31 March 2009 at 2:26am
Hi Aaron,
This is strange. To verify that the patch contains all of the necessary files, I just applied it to a fresh copy of truck. The patch worked flawlessly. Would you have time where we could hope on IRC together and troubleshoot this?
Ben
-
Re: if and else_if with InSection()

10 April 2010 at 4:40am
*Sigh* This still isn't fixed?
Just ran into this issue on a site I'm working on. Seems like a pretty common request and could be useful.
I was the one that originally brought this up when I stumbled across it in SS version 2.2.x
I would have thought/hoped this would be fixed now that we're coming up to 2.4 Any word on this? I see the ticket is still unassigned in trac.
| 8826 Views | ||
| Go to Top | Next > |



