Jimmy_hendrix
Jimmy_hendrix

Reputation: 9

Modx revo.2 contexts and Gallery.Gallery dont work in second context

I have a website on modx with 2 contexts.There is a template where was included Gallery plugin. The problem is that the plugin can not properly load the image in the second context.But in the web context images loaded normally. Does anyone have the same problem,any ideas?

Upvotes: 1

Views: 639

Answers (2)

Seba
Seba

Reputation: 1

I used you fix today, Modx Revo 2.3.1

$itemArray['thumbnail'] = str_replace(array('%2Fen%2F'),'',$item->get('thumbnail',$thumbProperties));
$itemArray['image'] = str_replace(array('%2Fen%2F'),'',$item->get('image',$imageProperties));

This is for english context, en, but en it´s not the context name, it´s the lexicon value.

This fixed thumbs and large image, line 131.

Hope this help

Upvotes: 0

Thomas Venturini
Thomas Venturini

Reputation: 3750

UPDATE

Just had to edit my old approach for that and thought I leave the way here.

I Simply duplicated the Gallery Snippet and edited the Line 119 to ...

$itemArray['thumbnail'] = str_replace(array('%2Fdeutsch%2F','%2Fslo%2F','%2Fen%2F'),'',$item->get('thumbnail',$thumbProperties));

... where deutsch, slo and en in the array are the context names. This should give you an idea how you could solve this permanantly in projects where you sometimes add or delete contexts.

Hope this helps someone! Have productive Day :)

Old Answer

Did you configured your .htaccess file correctly? (I guess you are using the Userfirendly URL Option)

A way to do so would be the following. In this example the contexts have the name of their language.

# redirect all requests from /[lang]/assets* to /assets*
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(de|en|fr|it|ru|hu|pl)/assets(.*)$ assets$2 [L,QSA]

Hope this helps :)

Upvotes: 1

Related Questions