Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#1 2015-09-07 06:23:03

derk
Member
Registered: 2014-11-13
Posts: 13

Problem with publisher in MAMP testing environment; images not shown

Hi,

i am testing a new site locally in a MAMP environment with port set to default 8888.
(cannot change to 80, since then apache will not start;; cannot figure this out)

I have one publisher controlled home page gallery (slug: page-gallery; type: full-flip) and a client response gallery.
In both galleries the gallery pictures will not show up.

Plugins in use:   ttb-ge203, publisher231, crg610, pages6014a, stage614

(.. now, funny things go one ..)
I posted a similar problem some time ago (2014-11-14):
http://community.theturninggate.net/post/24674/#p24674

There BEN advised to change/add to the file ttg-be/framework/helpers/URLHelper.php  (then ttg-be201)
adding:

$resolvedURL .= $parsedURL['port'] ? ':'.$parsedURL['port'] : '';

below line 225:

$resolvedURL = $parsedURL['scheme'] ? $parsedURL['scheme'].'://'.$parsedURL['host'] : '';

so that it read together:

$resolvedURL = $parsedURL['scheme'] ? $parsedURL['scheme'].'://'.$parsedURL['host'] : '';
$resolvedURL .= $parsedURL['port'] ? ':'.$parsedURL['port'] : '';

Line 225 of URLHelper.php in ttg-be201 is now Line 235 of URLHelper.php in ttg-be203.
The 'fix' made it into ttg-be203, so that line 235 and 236 are now:

$resolvedURL = $parsedURL['scheme'] ? $parsedURL['scheme'].'://'.$parsedURL['host'] : '';
 $resolvedURL .= $parsedURL['port'] ? ':'.$parsedURL['port'] : '';

Now:
IMAGES WILL SHOW UP IF i reverse the 'old fix'  - commenting out line 236 - so that there is only:

        $resolvedURL = $parsedURL['scheme'] ? $parsedURL['scheme'].'://'.$parsedURL['host'] : '';

Nice, BUT:  This results in 'new issues'::
- In the CRG gallery i can NOT use any button (selecting image, commenting, sending feedback, dim ...)
though i can see and enlarge the images.
- the breadcum link to the parent (autoindex) folder goes wrong (it points to 'localhost/customers/' - but should point to 'localhost:8888/customers/').

IF CHANGE URLHelper.php BACK to original 235/236 lines:

$resolvedURL = $parsedURL['scheme'] ? $parsedURL['scheme'].'://'.$parsedURL['host'] : '';
  $resolvedURL .= $parsedURL['port'] ? ':'.$parsedURL['port'] : '';

then:
- i can use the selection/comment/dim/feedback etc. buttons again.
But i cannot see or enlarge the gallery pictures.
- The breadcum link from this gallery to the parent (autoindex) folder then pointx to 'nowhere' (opens a site 'about:blank')

In short:
If i reverse the 'old fix' i can see the gallery pictures but cannot use the crg gallery features.
If leave the ULRHelper.php (203) original i can see no images.
And in both cases there is an issue with the breadcum link to the parent forlder.

Is a 'unifying fix' possible?
(Sorry for this 'special' offline testing question!)

Thanks, Derk.

Offline

#2 2015-09-07 21:25:36

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: Problem with publisher in MAMP testing environment; images not shown

Hi Derk, you've found a bug.

We've been moving to use $_SERVER['HTTP_HOST'] when available instead of $_SERVER['SERVER_NAME'], as the former has proven more accurate in reflecting the domain shown in the browser's address bar.

Unfortunately, when ports are explicitly specified, such as in http://localhost:8888/, HTTP_HOST includes the port.  I had assumed it didn't.  The URL calculations then add the port to a host that already has the port, giving us http://localhost:8888:8888/, which breaks things.

We'll need to fix this in the templates by changing this line from:

if ($_SERVER["SERVER_PORT"] != "80") {

to:

if ($_SERVER["SERVER_PORT"] != "80" && strpos($host, ':') === false) {

Making the exact same change in line 182 or so in URLHelper will go a long way to fixing this for you.

As for port 80 on Mac, there could be a couple of causes.  Firstly, if you have web sharing on, then that may already tie up port 80.  If something loads on http://localhost/ then it's a good indicator that this is the case.  It seems that the web sharing setting is no longer available in the Sharing preferences, so if that port is tied up, you may need to run a terminal command to switch off or disable the built-in Apache.
The other potential issue is that low-numbered ports such as 80 require admin privileges to use.  Are you using an admin account?

Offline

#3 2015-09-08 16:36:59

derk
Member
Registered: 2014-11-13
Posts: 13

Re: Problem with publisher in MAMP testing environment; images not shown

Hi Ben,

thanks for your reply and the URLHelper-fix.
It's working now with port 8888.
I also can work on port 80 now; simply, Websharing was running - as you suggested.
Thanks for that hint. (So now i won't find any off the road bugs in the future;)

Best, Derk.

Offline

Board footer

Powered by FluxBB