developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 10 years ago

Closed 9 years ago

#1073 closed new feature (fixed)

Create a class and a jTpl plugin to manage easily root Urls

Reported by: bricet Owned by:
Priority: normal Milestone: Jelix 1.4
Component: jelix:plugins:tpl Version: trunk
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description

According to http://developer.yahoo.com/performance/rules.html#cookie_free it is advised to host static files on a different domain or subdomain than the application itself. It is better for performances.

To be able to do that easily in Jelix, I propose to add a jRootUrl class in jelix utils and a jrooturl jTpl plugin.

This way, we could easily call jRootUrl::get('images') in an action or {jrooturl 'images'} in a template to get the root url for images.

Those root urls should be stored in config file under a rootUrls section in which an entry would associate ressource name to an url. If the ressource name is not set in the config file, jRootUrl::get() and {jrooturl} should return Jelix's basepath as a default.

For example in config file :

[rootUrls]
images = "http://static.mydomain.com/images/"

Note that jRootUrl class could be used more widely in Jelix in the future. For exemple, I am thinking to use it for jelix-www or theme with reserved ressource names like jelix.jelix-www and jelix.theme.

This way, things like http://jelix.org/articles/fr/manuel-1.1/configurer-application#si-vous-ne-pouvez-pas-specifier-le-document-root explains could become a lot simplier. And we could also easily switch between production and development servers just changing config file.

Attachments (3)

ticket_1073.diff (3.1 KB) - added by bricet 10 years ago.
Dumb bug corrected
patch_jrooturl_2.diff (5.9 KB) - added by bricet 9 years ago.
patch_jrooturl_3.diff (6.6 KB) - added by bricet 9 years ago.
Forgot to change testapp's manifest

Download all attachments as: .zip

Change History (9)

comment:1 Changed 10 years ago by bricet

  • review set to review?
  • Version changed from 1.1.5 to trunk

comment:2 Changed 10 years ago by laurentj

  • Component changed from jelix to jelix:plugins:tpl

Changed 10 years ago by bricet

Dumb bug corrected

comment:3 Changed 9 years ago by bricet

Actually, that patch was very crappy (malformed, missign stuff).

Here is a new one with UT.

Changed 9 years ago by bricet

Changed 9 years ago by bricet

Forgot to change testapp's manifest

comment:4 Changed 9 years ago by bricet

This is mostly for git-newbie training, but there is now https://github.com/jelix/jelix/pull/1

I have pull request 1 !!! ;)

comment:5 Changed 9 years ago by foxmask

i added a comment on your patch about the comment marker in the source code.

we use or / .. */ but not #

comment:6 Changed 9 years ago by laurentj

  • Milestone set to Jelix 1.4
  • Resolution set to fixed
  • review review? deleted
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.