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

Protostar template doesn't work with component links in SEF #5081

Closed
waveywhite opened this issue Nov 10, 2014 · 8 comments
Closed

Protostar template doesn't work with component links in SEF #5081

waveywhite opened this issue Nov 10, 2014 · 8 comments

Comments

@waveywhite
Copy link
Contributor

In index.php for the protostar template the css and javascript links are relative. With SEF & .htaccess enabled this causes the template to attempt to load these files relative to the current path. These paths map to the component and Joomla tries to map them to a page and outputs HTML instead of the desired CSS file.

To recreate this bug:
Create a new Joomla install with Protostar as default template and no content

  1. Enable SEF links via the global settings & copy htaccess.txt to .htaccess in web root
  2. Create a new article in the admin site (id should be 1)
  3. Manually enter the article name via the url siteurl/component/content/article/1

solution: prepend these with JUri::base calls to build the proper CSS and javascript paths.

-David.

@Bakual
Copy link
Contributor

Bakual commented Nov 10, 2014

I can't reproduce this here.
The files are loaded relative to the site root, starting with a slash. So the browser should ignore the path and call the files from the proper place.

Can you be more specific with which enviroment you're testing this?

@Fedik
Copy link
Member

Fedik commented Nov 10, 2014

@waveywhite I suppose, you have disabled a "System - SEF" plugin, right? 😄

@waveywhite
Copy link
Contributor Author

I have disabled the SEF plugin, yes. I guess that must be a factor as well! Thanks, Fedik.

I need to do that for performance reasons (the SEF plugin is lousy with embeded SVGs). Still, this problem doesn't happen in Beez and Protostar isn't following recommended practice (http://docs.joomla.org/Creating_a_basic_Joomla!_template) so I think it's still a bug.

To reproduce bug:

  1. Enable SEF links via the global settings & copy htaccess.txt to .htaccess in web root
  2. Create a new article in the admin site (id should be 1)
  3. Disable SEF plugin
  4. Manually enter the article name via the url siteurl/component/content/article/1

The file is templates/protostar/index.php. The line numbers in question are 41 and 43. The environment is Ubuntu 14.04 with Apache 2.4.7

@dgrammatiko
Copy link
Contributor

Can you replace $this->baseurl with JUri::base() and if it works then make a PR?

@waveywhite
Copy link
Contributor Author

Hi dgt41. Who would you like to do this?

Either this->baseurl or JUri::base() should work, a the moment neither is in place. Which is preferable?

@Bakual
Copy link
Contributor

Bakual commented Nov 10, 2014

Can you create a Pull Request then? See http://docs.joomla.org/Using_the_Github_UI_to_Make_Pull_Requests for how to do it.

If you do, you will get proper credits for doing it 😄

@Bakual
Copy link
Contributor

Bakual commented Nov 10, 2014

Either this->baseurl or JUri::base() should work, a the moment neither is in place. Which is preferable?

In theory, $this->baseurl should be a bit faster, so I'd use that.

@jissues-bot
Copy link

Set to "closed" on behalf of @brianteeman by The JTracker Application at issues.joomla.org/joomla-cms/5081

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

5 participants