This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » eZ Publish 5 Platform » Not working URL with "_fragment" phrase
expandshrink

Not working URL with "_fragment" phrase

Not working URL with "_fragment" phrase

Thursday 03 October 2013 12:09:52 pm - 19 replies

Hi people.

I created Landing page with Content grid block which contains a few Articles.
The problem is that on frontpage that articles have incorrect url links, like this:
http://mypage/index_dev.php/_frag...unctions-even-if-they-re-called-once

The page on that address doesn't exists.
My question is what that phrase "_fragment" is for, and how can I make it working?

thanks
szymon

Thursday 03 October 2013 1:21:45 pm

It's for ESI and Hinclude sub-requests. You might have deactivated it.

Check that you have this in your config.yml:

framework:
    fragments: 

Thursday 03 October 2013 1:33:50 pm

Thanks Jerome but I have that in my config.yml...

Any other possible ideas?

Monday 07 October 2013 8:40:33 pm

Some rewrite rule maybe? Did you try with built-in PHP server?

Friday 18 October 2013 10:14:35 am

Hi Jérôme

I have the same problem here (2013.07)... A /content/download/ link resulting from a legacy embed file template gets prepended by _fragment.

Stragely enough only on my live server (PHP 5.3.26), but not on my local machine (PHP 5.3.25) when switched to "prod" environment.

I checked rewrite rules against https://confluence.ez.no/display/EZP/Virtual+host+example, no difference there...

Any suggestions? Thanks, Donat

Friday 18 October 2013 10:39:18 am

Hi Donat

It would be nice to have some steps to reproduce (e.g. a gist).

Could you also try on latest Community version and/or master ? It would be really helpful happy.gif Emoticon

Friday 18 October 2013 11:25:08 am

Hi Jérome

not easy to reproduce, except that I could walk you through the installation/website...

Some gists:

Thanks, Donat

Friday 18 October 2013 11:40:32 am

Thanks Donat

Do you know that you can embed gists in forum replies and blog posts ? And you can also have several files in one gist happy.gif Emoticon.

This would help readibility a lot here blunk.gif Emoticon

Friday 18 October 2013 12:03:49 pm

Yes, I know...  Unfortunately embedding gists here is kind of a mess. And btw: the first gist is three files blunk.gif Emoticon

Here are the configs...

Here my YAML "override" rules

and the legacy embed template

Cheers, Donat

Friday 18 October 2013 12:54:08 pm

Just for your information... I changed config.yml to contain the default configuration as per http://symfony.com/doc/current/reference/configuration/framework.html:

    # fragments configuration
    fragments:
        enabled:              false
        path:                 /_fragment

This lead to an infinite recursion on the server sad.gif Emoticon

I also changed the template to produce a full URL instead of a relative one

 <a href={concat("content/download/", $file.contentobject_id, "/", $file.id, "/file/", $file.content.original_filename)|ezurl("double","full")}>{$object.name|wash("xhtml")}</a>

but this also includes the "_fragment" prefix.

Modified on Friday 18 October 2013 12:55:05 pm by Donat Fritschy

Friday 18 October 2013 4:10:47 pm

You forced me to replace the legacy embed template by a TWIG template...

In 2013.7 this needed the fix by Marco Stipek in http://share.ez.no/forums/ez-publish-5-platform/how-to-override-an-embed-template to make content_view work.

But the injection of the _fragment is still (black) magic to me...

Modified on Friday 18 October 2013 4:15:17 pm by Donat Fritschy

Friday 18 October 2013 4:33:46 pm

 

You forced me to replace the legacy embed template by a TWIG template...

I never forced you of anything Donat...

Friday 18 October 2013 4:42:46 pm

Didn't mean to offend you, Jérôme. There was a blunk.gif Emoticon missing...

By the way - it's was good to get rid of the legacy template. The site is now pure eZ 5 and will soon be live happy.gif Emoticon

Friday 18 October 2013 4:49:37 pm

No offense taken happy.gif Emoticon.

And it's a real good news that your website is pure eZ5 ! Can't wait to see it live !

Just a remark on your Twig template : You could have used ez_render_field(), using a dedicated template to render your file field blunk.gif Emoticon. See this example in DemoBundle, with the content field template.

Monday 21 October 2013 12:41:02 pm

Thanks for the hint, Jérôme!

And I'm glad to see the massive progress on the DemoBundle - most helpful!

Thursday 27 February 2014 10:15:50 am

Note that the issue may have been identified, and in that case will be fixed in the context of https://github.com/ezsystems/ezpublish-kernel/pull/755.

When a sub-requests executes legacy code, the _fragment part of the sub-request may end up considered as the siteaccess uri part, leading to invalid URIs generated by template operators & methods.

Wednesday 05 March 2014 5:21:15 pm

Quote from Bertrand Dunogier :

When a sub-requests executes legacy code, the _fragment part of the sub-request may end up considered as the siteaccess uri part, leading to invalid URIs generated by template operators & methods.

Although I have first encountered the problem with a sub-request executing legacy code (with an embedded image), we encountered it recently in (as I hope) pure Symfony implementation when rendering an ezobjectrelation attribute with the ez_render_field twig function.

The behaviour is erratic, the only guess I have is that it could be a divergence of cached objects with different TTLs.

Thursday 06 March 2014 7:35:05 pm

I don't think it's erratic.

I need to read some code, but iirc, a relation field is rendered using a sub-request that renders the related objects (95% sure, tbh).

Feel free to apply the fix from the PR (it's one line: https://github.com/ezsystems/ezpublish-kernel/commit/ea70884).

Let me know !

Friday 07 March 2014 8:50:22 am

Thanks, Bertrand, for this quick reply. We will test it and report on it asap.

However, when I speak of "erratic" I mean that the behaviour is not consistently wrong. Sometimes (after clearing the caches?) the link is rendered correctly, soon after it appears as "_fragment". Would the PR really address this?

Cheers, Donat

Saturday 08 March 2014 9:33:43 am

I had noticed this as well. I'm not really an expert of sub requests and how they are handled exactly, but I'm pretty sure the patch wild fix it.

Note that I'll hopefully merge this to mastre on monday.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from