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

Anomaly in site title link #5272

Closed
smanzi opened this issue Dec 1, 2014 · 58 comments
Closed

Anomaly in site title link #5272

smanzi opened this issue Dec 1, 2014 · 58 comments

Comments

@smanzi
Copy link

smanzi commented Dec 1, 2014

Seen this in protostar and I don't know if this is a template ore core issue:
While SEF URLs are activated the site title <a class="brand pull-left"> points to the site root (expected), while when NON SEF are in function the link points to the current page (unexpected).

@brianteeman
Copy link
Contributor

cannot confirm

This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5272.

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

@brianteeman & @richard67 (as you have tested too...)

This is with SEF:

sef

... and this is without SEF:

no sef

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

substitued SEF screenshot as there was something ill in the address bar (It still displayed non-sef address...)

@richard67
Copy link
Member

ah i see ... well i have my local joomla in a subdirectory, so i always have a href="/joomla3" ... maybe this is the reason why i cannot reproduce, because the problem exists only if joomla is located in the root directory (whish is of course the default for production sites).

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

can be...

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

@richard67: check if with SEF you have /joomla3/ and without /joomla3

@richard67
Copy link
Member

@smanzi no, I have in both cases "/joomla3".
Maybe we have to change in the protostar's index.php and error.php from JUri::base(true) to JUri::base() for the site title link?
The docu sais that if the pathonly parameter of JUri::base($pathonly) is set to true, the trailing "/"is omitted.
And so we get the "".
In the beez3 JUri::base() is used, so with beez3 it should be ok.

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

... unsure... I'll think it over...

In the meanwhile I can confirm that I have this also on the production VPS in Amsterdam, so this is not a trick by my local poltergeist...

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

you can see at http://test.smz.it

@richard67
Copy link
Member

yes, i see there. well, it comes from the link target being empty sting, and so someone who is more into it has to decide if the protostar template shall be changed from
href="baseurl; ?>"
to
href="baseurl; ?>/"
or if to change JUri::base so the trailing slash is not removed if there would be nothing left after it, i.e. the path of the baseurl is "/".

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

... or if it is a more general issue

@richard67
Copy link
Member

more general? i think JUri::base would be very general ;-)

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

yeap, you seems to be really right! flu making me retard... 😖
Do you want to make a PR?

@richard67
Copy link
Member

I think the protostar index.php and error.php have to be changed so they append a slash to $this->baseurl when using it for the site title link. Using JUri::base() instead of $this->baseurl would also be ok, but silly, and anythign else - change the JUri::base function itself or changing the function which sets $this->baseurl would cause a mess because require lots of calling programs to be changed. If I get positive feedback on this idea, I can try to make the pull request. I am not very experienced with this but I would do my best ;-)

@richard67
Copy link
Member

@brianteeman what do you think about the above results?

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

Question is: why when SEF URL are active we get a neat "/" ?

furthermore, few lines above $this->baseurl is used to build the path to a JS, and this is working for both SEF and NON-SEF...

puzzled...

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

look NOW at my site: SEF active, neat "/"

then we should have two // in the JS for lt IE9, but we don't...

@richard67
Copy link
Member

@smanzi Because the sef plugin does this when rewriting the URL, see plugins/system/sef/sef.php, function onAfterRender, where everything starts with "$base = JUri::base(true) . '/';".

@richard67
Copy link
Member

@smanzi But you are right, we cannot just append a "/" in the template when SEF is on. So either we make a bit of code in the template to append "/" only if "", or we use JUri::base instead of $this->baseurl in the template, or $this->baseurl has to be initialized with "/" in function _fetchTemplate in libraries/joomla/document/html/html.php (or wherever else it originally comes from) when it otherwise would be the empty string.

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

I don't want to break something I don't fully understand... better leave this to more experienced hands...

@richard67
Copy link
Member

yes, sure, I hope they have a look on it and our discussion at least helps them to find out how it has to be solved in the proper way.

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

(resetting my site to NON-SEF, for reference...)

Yeah... I'm confident someone will jump in...

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

I think this is a minor issue (most are using SEF URLs), but anyway... for the sake of code quality...

@dgrammatiko
Copy link
Contributor

@smanzi before anything else can you unmute (or else comment it ) this # RewriteBase / , and tell us if anything changes?

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

tried: I've nuked .htaccess, but no success...

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

ah sorry, the contrary...

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

wait..

@richard67
Copy link
Member

@dgt41 hmm on a clean fresh new default install there is no .htacess in effect ... and it should also not be necessary.

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

I now have RewriteBase /, but still no success...

@dgrammatiko
Copy link
Contributor

@richard67 you are right, but this is apache option control over .htaccess

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

TBH, I don't know! I'm on skype with Dimitris and he has asked me to... it works here with both sef and non sef, but I'm in root... and we want to chheck if it works when in subdir...

@richard67
Copy link
Member

@smanzi I did, with JUri::root, and now I get "/joomla3/" in any case (homepage and other, i.e. login page, both with and without SEF URLs). But why JUri::root and not JUri::base? Other templates use JUri::base.

This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5272.

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

hold on...

@dgrammatiko
Copy link
Contributor

JUri::base A static method that returns the base URI of the Joomla site.
JUri::root A static method that returns the root URI of the Joomla site. If Joomla has been installed in the web server's document root then this method will return "/" for the path.

I guess base is better ?

@dgrammatiko
Copy link
Contributor

Actually this should be

echo $this->baseurl . '/';

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

will not I get // with SEF? Let me try...

@dgrammatiko
Copy link
Contributor

nope

@richard67
Copy link
Member

@dgt41 If Joomla has been installed in the web server's document root then this method will return "/" for the path ... this is what the docu says, but a few lines below is an explanation of the $pathonly parameter, as is with JUri::base, but it is not clearly told what $pathonly does in case of document root. From my point of view, behavior of JUri::base and JUri::root should be the same at this point, but maybe it isn't. For @smanzi i think the solution I have tested will result in "//" with SEF URLs on, or not?

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

confirmed OK both SEF and NON-SEF with href="<?php echo $this->baseurl . '/'; ?>"

@richard67
Copy link
Member

@dgt41 and @smanzi I think we should use echo $this->baseurl . '/'; in the template. The docu sais that this is equivalent to JUri::base(true) . '/'.

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

Let it be href="<?php echo $this->baseurl . '/'; ?>" ...
Who does the PR?

@richard67
Copy link
Member

Whoever it does should not forget error.php.

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

@richard67 do you want to check that it works when J! in subdir and do the PR yourself?

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

... you will quickly get at least 2 @test 😄

@richard67
Copy link
Member

I do so. I come back to you here in case of problems/questions.

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

no prob... I'm here... quite busy as I have to make a mailing... but I'm here... sergiomanzi on Skype if you wish...

richard67 added a commit to richard67/joomla-cms that referenced this issue Dec 2, 2014
richard67 added a commit to richard67/joomla-cms that referenced this issue Dec 2, 2014
richard67 added a commit to richard67/joomla-cms that referenced this issue Dec 2, 2014
richard67 added a commit to richard67/joomla-cms that referenced this issue Dec 2, 2014
richard67 added a commit to richard67/joomla-cms that referenced this issue Dec 2, 2014
@richard67
Copy link
Member

We have a PR #5291

This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5272.

@smanzi
Copy link
Author

smanzi commented Dec 2, 2014

👍 @richard67

smanzi pushed a commit to smz/joomla-cms that referenced this issue Dec 5, 2014
joomla#5291 inadvertently reverted by @richard67 - this re-instate its code...
infograf768 added a commit that referenced this issue Dec 6, 2014
@Bakual Bakual added this to the Joomla! 3.4.0 milestone Dec 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants