?
Related to # 5291
avatar smanzi
smanzi
1 Dec 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).

avatar smanzi smanzi - open - 1 Dec 2014
avatar smanzi smanzi - change - 1 Dec 2014
The description was changed
avatar brianteeman
brianteeman - comment - 2 Dec 2014

cannot confirm

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

avatar smanzi
smanzi - comment - 2 Dec 2014

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

This is with SEF:

sef

... and this is without SEF:

no sef

avatar smanzi
smanzi - comment - 2 Dec 2014

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

avatar richard67
richard67 - comment - 2 Dec 2014

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).

avatar smanzi
smanzi - comment - 2 Dec 2014

can be...

avatar smanzi
smanzi - comment - 2 Dec 2014

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

avatar richard67
richard67 - comment - 2 Dec 2014

@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 "".

avatar smanzi
smanzi - comment - 2 Dec 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...

avatar smanzi
smanzi - comment - 2 Dec 2014

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

avatar richard67
richard67 - comment - 2 Dec 2014

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

avatar smanzi
smanzi - comment - 2 Dec 2014

... or if it is a more general issue

avatar richard67
richard67 - comment - 2 Dec 2014

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

avatar smanzi
smanzi - comment - 2 Dec 2014

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

avatar richard67
richard67 - comment - 2 Dec 2014

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 ;-)

avatar richard67
richard67 - comment - 2 Dec 2014

@brianteeman what do you think about the above results?

avatar smanzi
smanzi - comment - 2 Dec 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...

avatar smanzi
smanzi - comment - 2 Dec 2014

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

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

avatar richard67
richard67 - comment - 2 Dec 2014

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

avatar richard67
richard67 - comment - 2 Dec 2014

@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, or $this->baseurl has to be initialized with "/" in function _fetchTemplate in libraries/joomla/document/html/html.php (o wherever else it originally comes from).

avatar smanzi
smanzi - comment - 2 Dec 2014

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

avatar richard67
richard67 - comment - 2 Dec 2014

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.

avatar smanzi
smanzi - comment - 2 Dec 2014

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

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

avatar smanzi
smanzi - comment - 2 Dec 2014

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

avatar dgt41
dgt41 - comment - 2 Dec 2014

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

avatar smanzi
smanzi - comment - 2 Dec 2014

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

avatar smanzi
smanzi - comment - 2 Dec 2014

ah sorry, the contrary...

avatar smanzi
smanzi - comment - 2 Dec 2014

wait..

avatar richard67
richard67 - comment - 2 Dec 2014

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

avatar smanzi
smanzi - comment - 2 Dec 2014

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

avatar dgt41
dgt41 - comment - 2 Dec 2014

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

avatar smanzi
smanzi - comment - 2 Dec 2014

turning rewrite engine off...

avatar dgt41
dgt41 - comment - 2 Dec 2014

@smanzi you need to restart apache...

avatar smanzi
smanzi - comment - 2 Dec 2014

nope... never had to do that in my VPS!

avatar smanzi
smanzi - comment - 2 Dec 2014

rewrite engine off, no way...

avatar dgt41
dgt41 - comment - 2 Dec 2014

can you send over Skype http.conf?

avatar smanzi
smanzi - comment - 2 Dec 2014

actually I can't manage Apache... (yes, wait)...

avatar smanzi
smanzi - comment - 2 Dec 2014

@richard67 Richard... if you are still there, can you please try with your installation (in subdir) to put this: JUri::root(true) . '/'; ?

avatar richard67
richard67 - comment - 2 Dec 2014

@smanzi to put this where? in index.php (and error.php) of the protostart template?

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

avatar richard67
richard67 - comment - 2 Dec 2014

@smanzi and why JUri::root(true) and not JUri::base(true)?

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

avatar smanzi
smanzi - comment - 2 Dec 2014

in index.php, in place of $this->baseurl; at line 138

avatar smanzi
smanzi - comment - 2 Dec 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...

avatar richard67
richard67 - comment - 2 Dec 2014

@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.

avatar smanzi
smanzi - comment - 2 Dec 2014

hold on...

avatar dgt41
dgt41 - comment - 2 Dec 2014

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 ?

avatar dgt41
dgt41 - comment - 2 Dec 2014

Actually this should be ```php
echo $this->baseurl . '/';

avatar smanzi
smanzi - comment - 2 Dec 2014

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

avatar dgt41
dgt41 - comment - 2 Dec 2014

nope

avatar richard67
richard67 - comment - 2 Dec 2014

@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?

avatar smanzi
smanzi - comment - 2 Dec 2014

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

avatar richard67
richard67 - comment - 2 Dec 2014

@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) . '/'.

avatar smanzi
smanzi - comment - 2 Dec 2014

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

avatar richard67
richard67 - comment - 2 Dec 2014

Whoever it does should not forget error.php.

avatar smanzi
smanzi - comment - 2 Dec 2014

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

avatar smanzi
smanzi - comment - 2 Dec 2014

... you will quickly get at least 2 @test :smile:

avatar richard67
richard67 - comment - 2 Dec 2014

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

avatar smanzi
smanzi - comment - 2 Dec 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...

avatar richard67
richard67 - comment - 2 Dec 2014

We have a PR #5291

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

avatar smanzi
smanzi - comment - 2 Dec 2014
avatar brianteeman brianteeman - change - 2 Dec 2014
Status New Closed
Rel_Number 5291
Relation Type Related to
avatar brianteeman brianteeman - close - 2 Dec 2014
avatar zero-24 zero-24 - close - 2 Dec 2014
avatar brianteeman brianteeman - change - 2 Dec 2014
Closed_Date 0000-00-00 00:00:00 2014-12-02 23:22:14
avatar zero-24 zero-24 - change - 7 Jul 2015
Labels Added: ?

Add a Comment

Login with GitHub to post a comment