Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong css path / Undefined index: alt #3

Open
Smirftsch opened this issue May 19, 2018 · 5 comments
Open

wrong css path / Undefined index: alt #3

Smirftsch opened this issue May 19, 2018 · 5 comments

Comments

@Smirftsch
Copy link

Smirftsch commented May 19, 2018

Hey, thanks for the plugin!
Unfortunately I couldn't make it work yet, but I am also pretty new to Processwire at all, so this may be a problem on my end as well.
First issue I have is, that I am using processwire not in document root on the page, but in some subdirectory called processwire.
It seems the css path is wrong as it does seem to miss the subdirectory processwire:

<link rel="stylesheet" type="text/css" href="/processwire/site/templates/styles/main.css" />
<link rel="stylesheet" type="text/css" href="/site/modules/MarkupProcesswirePhotoswipe/photoswipe/photoswipe.css">
<link rel="stylesheet" type="text/css" href="/site/modules/MarkupProcesswirePhotoswipe/photoswipe/default-skin/default-skin.css">
<link rel="stylesheet" type="text/css" href="/site/modules/MarkupProcesswirePhotoswipe/MarkupPwpswpGalleryHorizontalScroller.css">

Edited: The path to $scriptUrl seems to miss the subdirectory too.

second problem I have is that I always get
Notice: Undefined index: alt in /opt/users/www/html/processwire/site/modules/MarkupProcesswirePhotoswipe/MarkupPwpswpGallery.module on line 168

No matter what I try.
Editing line 168 to
$imageData['alt'] = $image->alt ?: $imageData['description'];
silences this warning, but I am not really sure if this would be correct approach.

Using PHP7.0.21 right now and processwire 3.0.98 if this is of any importance

@blynx
Copy link
Owner

blynx commented May 22, 2018

Hi,
thanks for the report here!
I'm pretty busy right now - I try to get into this next week, sorry for that.

Though, do you get the correct urls when you fetch an image manually on a template? Something like $page->imagefield?->someImage?->url(). So far I only read briefly about putting processwire into a subdirectory and I think there are a some threads about problems like this in the forum alreay. Maybe there is actually a way to solve this rather by configuring processwire instead of touching the module ... not sure

The solution for the notice seems fine - haven't looked at the code for a while now, but if it works for you then it seems to be good :)

@rSSi
Copy link

rSSi commented Jul 15, 2018

Thank you for the plugin!
I just wanted to use Photoswipe with my Processwire install and by accident found your module :)
I got the same issues and looked into the Undefined Index -> Smirftsch's edit is correct.
$imageData['alt'] is undefined and we want to define it:
$imageData['alt'] = $image->alt ?: $imageData['description'];

I have to look into the path problem because I am also using a subfolder to develop my site and move it as soon as i want to publish the new site.
I'm trying to find the solution to the path problem..

@Kholja
Copy link

Kholja commented Aug 15, 2018

Hello Blynx - thanks for the plugin. Regarding the Issue "wrong paths for css and js". This will come up when installing PW in a subdirectory. Easy fix to bring up correct paths is i.e. by adding:
$this->moduleUrl = $this->rootUrl.$this->moduleUrl;
after line 88
$this->rootUrl = $config->urls->root;

@Kholja
Copy link

Kholja commented Aug 16, 2018

... and to find the correct paths of css and js files of other gallery types, in MarkupPwpswpGallery.module Line 71 should be:
return wire('config')->urls->root.str_replace($this->rootPath, '/', $file);
instead of
return str_replace($this->rootPath, '/', $file);

@blynx
Copy link
Owner

blynx commented Sep 30, 2018

Damn, totally forgot about this one.
Will definitely get into it these days! Have some free time right now - thanks for the hints so far and sorry for the delaaaay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants